diff --git a/sdk/resources/mgmt-v2019_08_01/pom.xml b/sdk/resources/mgmt-v2019_08_01/pom.xml new file mode 100644 index 0000000000000..931b87f3d30b1 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2019_08_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.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 + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/AliasPathType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/AliasPathType.java new file mode 100644 index 0000000000000..28fc7588bddcb --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/AliasType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/AliasType.java new file mode 100644 index 0000000000000..4da3513c0f808 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/BasicDependency.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/BasicDependency.java new file mode 100644 index 0000000000000..1fed8d57300d2 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ChangeType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ChangeType.java new file mode 100644 index 0000000000000..97f9d78872b32 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ChangeType.java @@ -0,0 +1,65 @@ +/** + * 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_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ChangeType. + */ +public enum ChangeType { + /** The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. */ + CREATE("Create"), + + /** The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. */ + DELETE("Delete"), + + /** The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. */ + IGNORE("Ignore"), + + /** The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. */ + DEPLOY("Deploy"), + + /** The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. */ + NO_CHANGE("NoChange"), + + /** The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. */ + MODIFY("Modify"); + + /** The actual serialized value for a ChangeType instance. */ + private String value; + + ChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeType object, or null if unable to parse. + */ + @JsonCreator + public static ChangeType fromString(String value) { + ChangeType[] items = ChangeType.values(); + for (ChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DebugSetting.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DebugSetting.java new file mode 100644 index 0000000000000..fe4c3762ff24e --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Dependency.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Dependency.java new file mode 100644 index 0000000000000..e982cf818267e --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExportResult.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExportResult.java new file mode 100644 index 0000000000000..b0bf985aae606 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.DeploymentExportResultInner; + +/** + * Type representing DeploymentExportResult. + */ +public interface DeploymentExportResult extends HasInner, HasManager { + /** + * @return the template value. + */ + Object template(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExtended.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExtended.java new file mode 100644 index 0000000000000..c466e9139c99f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExtended.java @@ -0,0 +1,133 @@ +/** + * 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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.DeploymentExtendedInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; + +/** + * Type representing DeploymentExtended. + */ +public interface DeploymentExtended extends HasInner, Indexable, Updatable, Refreshable, 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.WithResourceGroupName, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DeploymentExtended definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DeploymentExtended definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the deploymentextended definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist + * @return the next definition stage + */ + WithProperties withResourceGroupName(String resourceGroupName); + } + + /** + * 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExtendedFilter.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentExtendedFilter.java new file mode 100644 index 0000000000000..e869108382778 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentMode.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentMode.java new file mode 100644 index 0000000000000..eddbb422c2450 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperation.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperation.java new file mode 100644 index 0000000000000..48e05cff2b847 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperationProperties.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperationProperties.java new file mode 100644 index 0000000000000..9c08bbe6812d6 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperations.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperations.java new file mode 100644 index 0000000000000..efeadbee4186d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentOperations.java @@ -0,0 +1,120 @@ +/** + * 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_08_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.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 getAtTenantScopeAsync(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 listAtTenantScopeAsync(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); + + /** + * 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 scope The scope of a deployment. + * @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 getAtScopeAsync(String scope, String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtScopeAsync(final String scope, final String deploymentName); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentProperties.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentProperties.java new file mode 100644 index 0000000000000..10325e03815ac --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentPropertiesExtended.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentPropertiesExtended.java new file mode 100644 index 0000000000000..5a817e2b6e9c5 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentValidateResult.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentValidateResult.java new file mode 100644 index 0000000000000..6683df7cfef18 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.DeploymentValidateResultInner; + +/** + * Type representing DeploymentValidateResult. + */ +public interface DeploymentValidateResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ErrorResponse error(); + + /** + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIf.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIf.java new file mode 100644 index 0000000000000..86f65353bf2dd --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIf.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment What-if operation parameters. + */ +public class DeploymentWhatIf { + /** + * The location to store the deployment data. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentWhatIfProperties 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 DeploymentWhatIf object itself. + */ + public DeploymentWhatIf withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the deployment properties. + * + * @return the properties value + */ + public DeploymentWhatIfProperties properties() { + return this.properties; + } + + /** + * Set the deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentWhatIf object itself. + */ + public DeploymentWhatIf withProperties(DeploymentWhatIfProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfProperties.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfProperties.java new file mode 100644 index 0000000000000..a22ad0a335dd9 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfProperties.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment What-if properties. + */ +public class DeploymentWhatIfProperties extends DeploymentProperties { + /** + * Optional What-If operation settings. + */ + @JsonProperty(value = "whatIfSettings") + private DeploymentWhatIfSettings whatIfSettings; + + /** + * Get optional What-If operation settings. + * + * @return the whatIfSettings value + */ + public DeploymentWhatIfSettings whatIfSettings() { + return this.whatIfSettings; + } + + /** + * Set optional What-If operation settings. + * + * @param whatIfSettings the whatIfSettings value to set + * @return the DeploymentWhatIfProperties object itself. + */ + public DeploymentWhatIfProperties withWhatIfSettings(DeploymentWhatIfSettings whatIfSettings) { + this.whatIfSettings = whatIfSettings; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfSettings.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfSettings.java new file mode 100644 index 0000000000000..9ae28a0db8779 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentWhatIfSettings.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment What-If operation settings. + */ +public class DeploymentWhatIfSettings { + /** + * The format of the What-If results. Possible values include: + * 'ResourceIdOnly', 'FullResourcePayloads'. + */ + @JsonProperty(value = "resultFormat") + private WhatIfResultFormat resultFormat; + + /** + * Get the format of the What-If results. Possible values include: 'ResourceIdOnly', 'FullResourcePayloads'. + * + * @return the resultFormat value + */ + public WhatIfResultFormat resultFormat() { + return this.resultFormat; + } + + /** + * Set the format of the What-If results. Possible values include: 'ResourceIdOnly', 'FullResourcePayloads'. + * + * @param resultFormat the resultFormat value to set + * @return the DeploymentWhatIfSettings object itself. + */ + public DeploymentWhatIfSettings withResultFormat(WhatIfResultFormat resultFormat) { + this.resultFormat = resultFormat; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Deployments.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Deployments.java new file mode 100644 index 0000000000000..a7ff377906957 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Deployments.java @@ -0,0 +1,411 @@ +/** + * 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_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.DeploymentInner; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.DeploymentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Deployments. + */ +public interface Deployments extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtScopeAsync(String scope, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAtScopeAsync(String scope, String deploymentName); + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 createOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters); + + /** + * Gets a deployment. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtScopeAsync(String scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAtScopeAsync(String scope, String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param scope The scope of a deployment. + * @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 validateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAtScopeAsync(String scope, 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. 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 deleteAtTenantScopeAsync(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 checkExistenceAtTenantScopeAsync(String deploymentName); + + /** + * Deploys resources at tenant 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 createOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment 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 getAtTenantScopeAsync(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 cancelAtTenantScopeAsync(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 validateAtTenantScopeAsync(String deploymentName, ScopedDeployment 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 exportTemplateAtTenantScopeAsync(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. 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); + + /** + * 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 + */ + Observable createOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * 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, ScopedDeployment 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); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable whatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf 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); + + /** + * 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); + + /** + * 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); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 whatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf 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 at the given scope. + * + * @param scope The scope of a deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtScopeAsync(final String scope); + + /** + * Get all the deployments at the tenant scope. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtTenantScopeAsync(); + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable calculateTemplateHashAsync(Object template); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfAtSubscriptionScopeHeaders.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfAtSubscriptionScopeHeaders.java new file mode 100644 index 0000000000000..8d04c997c81c5 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfAtSubscriptionScopeHeaders.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for WhatIfAtSubscriptionScope operation. + */ +public class DeploymentsWhatIfAtSubscriptionScopeHeaders { + /** + * URL to get status of this long-running operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of seconds to wait before polling for status. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get uRL to get status of this long-running operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set uRL to get status of this long-running operation. + * + * @param location the location value to set + * @return the DeploymentsWhatIfAtSubscriptionScopeHeaders object itself. + */ + public DeploymentsWhatIfAtSubscriptionScopeHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get number of seconds to wait before polling for status. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set number of seconds to wait before polling for status. + * + * @param retryAfter the retryAfter value to set + * @return the DeploymentsWhatIfAtSubscriptionScopeHeaders object itself. + */ + public DeploymentsWhatIfAtSubscriptionScopeHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfHeaders.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfHeaders.java new file mode 100644 index 0000000000000..b65bfac0b4a01 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/DeploymentsWhatIfHeaders.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for WhatIf operation. + */ +public class DeploymentsWhatIfHeaders { + /** + * URL to get status of this long-running operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of seconds to wait before polling for status. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get uRL to get status of this long-running operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set uRL to get status of this long-running operation. + * + * @param location the location value to set + * @return the DeploymentsWhatIfHeaders object itself. + */ + public DeploymentsWhatIfHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get number of seconds to wait before polling for status. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set number of seconds to wait before polling for status. + * + * @param retryAfter the retryAfter value to set + * @return the DeploymentsWhatIfHeaders object itself. + */ + public DeploymentsWhatIfHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorAdditionalInfo.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorAdditionalInfo.java new file mode 100644 index 0000000000000..65c05f7dd9a41 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorAdditionalInfo.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error additional info. + */ +public class ErrorAdditionalInfo { + /** + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the additional info type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the additional info. + * + * @return the info value + */ + public Object info() { + return this.info; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorResponse.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorResponse.java new file mode 100644 index 0000000000000..aee60a9a558d1 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ErrorResponse.java @@ -0,0 +1,93 @@ +/** + * 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_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error response. + */ +public class ErrorResponse { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The error target. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * The error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * The error additional info. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the error target. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get the error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Get the error additional info. + * + * @return the additionalInfo value + */ + public List additionalInfo() { + return this.additionalInfo; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ExportTemplateRequest.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ExportTemplateRequest.java new file mode 100644 index 0000000000000..bfd48db70db95 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResource.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResource.java new file mode 100644 index 0000000000000..1cc0ee8e6b7a3 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.GenericResourceInner; +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResourceExpanded.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResourceExpanded.java new file mode 100644 index 0000000000000..0826aebe9eda7 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResourceExpanded.java @@ -0,0 +1,92 @@ +/** + * 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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.GenericResourceExpandedInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing GenericResourceExpanded. + */ +public interface GenericResourceExpanded extends HasInner, HasManager { + /** + * @return the changedTime value. + */ + DateTime changedTime(); + + /** + * @return the createdTime value. + */ + DateTime createdTime(); + + /** + * @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 provisioningState value. + */ + String provisioningState(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResourceFilter.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/GenericResourceFilter.java new file mode 100644 index 0000000000000..ffafddeac807d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/HttpMessage.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/HttpMessage.java new file mode 100644 index 0000000000000..36b9c9671b2b6 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Identity.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Identity.java new file mode 100644 index 0000000000000..0cb591157e45f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/IdentityUserAssignedIdentitiesValue.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/IdentityUserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..92b9992289f4a --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeployment.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeployment.java new file mode 100644 index 0000000000000..d218dc2bd39db --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeploymentExtended.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeploymentExtended.java new file mode 100644 index 0000000000000..be3da11e63692 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeploymentType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OnErrorDeploymentType.java new file mode 100644 index 0000000000000..f48f9afa6b882 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Operation.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Operation.java new file mode 100644 index 0000000000000..f0249b00177c2 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OperationDisplay.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/OperationDisplay.java new file mode 100644 index 0000000000000..06e05f0cd32d0 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Operations.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Operations.java new file mode 100644 index 0000000000000..1862034c5240a --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ParametersLink.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ParametersLink.java new file mode 100644 index 0000000000000..962fd9d9b6a32 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Plan.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Plan.java new file mode 100644 index 0000000000000..a1b5bfb9402ab --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/PropertyChangeType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/PropertyChangeType.java new file mode 100644 index 0000000000000..8bf817a3f5365 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/PropertyChangeType.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_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PropertyChangeType. + */ +public enum PropertyChangeType { + /** The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. */ + CREATE("Create"), + + /** The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. */ + DELETE("Delete"), + + /** The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. */ + MODIFY("Modify"), + + /** The property is an array and contains nested changes. */ + ARRAY("Array"); + + /** The actual serialized value for a PropertyChangeType instance. */ + private String value; + + PropertyChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PropertyChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed PropertyChangeType object, or null if unable to parse. + */ + @JsonCreator + public static PropertyChangeType fromString(String value) { + PropertyChangeType[] items = PropertyChangeType.values(); + for (PropertyChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Provider.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Provider.java new file mode 100644 index 0000000000000..134ced9191205 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ProviderResourceType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ProviderResourceType.java new file mode 100644 index 0000000000000..9a1200d98a0bf --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Providers.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Providers.java new file mode 100644 index 0000000000000..6829f56fe17c4 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroup.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroup.java new file mode 100644 index 0000000000000..873657c54c099 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupExportResult.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupExportResult.java new file mode 100644 index 0000000000000..4d914d70337e1 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourceGroupExportResultInner; + +/** + * Type representing ResourceGroupExportResult. + */ +public interface ResourceGroupExportResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ErrorResponse error(); + + /** + * @return the template value. + */ + Object template(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupFilter.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupFilter.java new file mode 100644 index 0000000000000..adbb9772eb453 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupPatchable.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupPatchable.java new file mode 100644 index 0000000000000..1f505eb94a481 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupProperties.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroupProperties.java new file mode 100644 index 0000000000000..01d2069a49d15 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroups.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceGroups.java new file mode 100644 index 0000000000000..bb48f980df291 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.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. The name is case insensitive. + * @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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceIdentityType.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceIdentityType.java new file mode 100644 index 0000000000000..68faf089d4f49 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceProviderOperationDisplayProperties.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourceProviderOperationDisplayProperties.java new file mode 100644 index 0000000000000..db5f9150a7e4d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Resources.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Resources.java new file mode 100644 index 0000000000000..132979b9c7892 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.GenericResourceInner; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourcesMoveInfo.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ResourcesMoveInfo.java new file mode 100644 index 0000000000000..ade8f1b2cdc7f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ScopedDeployment.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ScopedDeployment.java new file mode 100644 index 0000000000000..50fff20834d2b --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/ScopedDeployment.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_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation parameters. + */ +public class ScopedDeployment { + /** + * The location to store the deployment data. + */ + @JsonProperty(value = "location", required = true) + 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 ScopedDeployment object itself. + */ + public ScopedDeployment 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 ScopedDeployment object itself. + */ + public ScopedDeployment withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Sku.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/Sku.java new file mode 100644 index 0000000000000..52d8def8fb7d9 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagCount.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagCount.java new file mode 100644 index 0000000000000..c0b46b35c3a0c --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagDetails.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagDetails.java new file mode 100644 index 0000000000000..9d5b54ef12ae0 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.TagDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagOperations.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagOperations.java new file mode 100644 index 0000000000000..6929920fb711d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagOperations.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_08_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.TagDetails; +import rx.Completable; + +/** + * Type representing TagOperations. + */ +public interface TagOperations { + /** + * 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagValue.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TagValue.java new file mode 100644 index 0000000000000..df30086deb6a7 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TargetResource.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TargetResource.java new file mode 100644 index 0000000000000..e32d44093eebf --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TemplateHashResult.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TemplateHashResult.java new file mode 100644 index 0000000000000..5cca985939fcb --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TemplateHashResult.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_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.TemplateHashResultInner; + +/** + * Type representing TemplateHashResult. + */ +public interface TemplateHashResult extends HasInner, HasManager { + /** + * @return the minifiedTemplate value. + */ + String minifiedTemplate(); + + /** + * @return the templateHash value. + */ + String templateHash(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TemplateLink.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/TemplateLink.java new file mode 100644 index 0000000000000..021967f213887 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01; + +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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfChange.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfChange.java new file mode 100644 index 0000000000000..b34778d939c66 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfChange.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a single resource change predicted by What-If operation. + */ +public class WhatIfChange { + /** + * Resource ID. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * Type of change that will be made to the resource when the deployment is + * executed. Possible values include: 'Create', 'Delete', 'Ignore', + * 'Deploy', 'NoChange', 'Modify'. + */ + @JsonProperty(value = "changeType", required = true) + private ChangeType changeType; + + /** + * The snapshot of the resource before the deployment is executed. + */ + @JsonProperty(value = "before") + private Object before; + + /** + * The predicted snapshot of the resource after the deployment is executed. + */ + @JsonProperty(value = "after") + private Object after; + + /** + * The predicted changes to resource properties. + */ + @JsonProperty(value = "delta") + private List delta; + + /** + * Get resource ID. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set resource ID. + * + * @param resourceId the resourceId value to set + * @return the WhatIfChange object itself. + */ + public WhatIfChange withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get type of change that will be made to the resource when the deployment is executed. Possible values include: 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify'. + * + * @return the changeType value + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set type of change that will be made to the resource when the deployment is executed. Possible values include: 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify'. + * + * @param changeType the changeType value to set + * @return the WhatIfChange object itself. + */ + public WhatIfChange withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the snapshot of the resource before the deployment is executed. + * + * @return the before value + */ + public Object before() { + return this.before; + } + + /** + * Set the snapshot of the resource before the deployment is executed. + * + * @param before the before value to set + * @return the WhatIfChange object itself. + */ + public WhatIfChange withBefore(Object before) { + this.before = before; + return this; + } + + /** + * Get the predicted snapshot of the resource after the deployment is executed. + * + * @return the after value + */ + public Object after() { + return this.after; + } + + /** + * Set the predicted snapshot of the resource after the deployment is executed. + * + * @param after the after value to set + * @return the WhatIfChange object itself. + */ + public WhatIfChange withAfter(Object after) { + this.after = after; + return this; + } + + /** + * Get the predicted changes to resource properties. + * + * @return the delta value + */ + public List delta() { + return this.delta; + } + + /** + * Set the predicted changes to resource properties. + * + * @param delta the delta value to set + * @return the WhatIfChange object itself. + */ + public WhatIfChange withDelta(List delta) { + this.delta = delta; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfOperationResult.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfOperationResult.java new file mode 100644 index 0000000000000..d2c9bbd91baef --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfOperationResult.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_08_01.implementation.WhatIfOperationResultInner; +import java.util.List; + +/** + * Type representing WhatIfOperationResult. + */ +public interface WhatIfOperationResult extends HasInner, HasManager { + /** + * @return the changes value. + */ + List changes(); + + /** + * @return the error value. + */ + ErrorResponse error(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfPropertyChange.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfPropertyChange.java new file mode 100644 index 0000000000000..630c96e7ea5ea --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfPropertyChange.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The predicted change to the resource property. + */ +public class WhatIfPropertyChange { + /** + * The path of the property. + */ + @JsonProperty(value = "path", required = true) + private String path; + + /** + * The type of property change. Possible values include: 'Create', + * 'Delete', 'Modify', 'Array'. + */ + @JsonProperty(value = "propertyChangeType", required = true) + private PropertyChangeType propertyChangeType; + + /** + * The value of the property before the deployment is executed. + */ + @JsonProperty(value = "before") + private Object before; + + /** + * The value of the property after the deployment is executed. + */ + @JsonProperty(value = "after") + private Object after; + + /** + * Nested property changes. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get the path of the property. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path of the property. + * + * @param path the path value to set + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the type of property change. Possible values include: 'Create', 'Delete', 'Modify', 'Array'. + * + * @return the propertyChangeType value + */ + public PropertyChangeType propertyChangeType() { + return this.propertyChangeType; + } + + /** + * Set the type of property change. Possible values include: 'Create', 'Delete', 'Modify', 'Array'. + * + * @param propertyChangeType the propertyChangeType value to set + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withPropertyChangeType(PropertyChangeType propertyChangeType) { + this.propertyChangeType = propertyChangeType; + return this; + } + + /** + * Get the value of the property before the deployment is executed. + * + * @return the before value + */ + public Object before() { + return this.before; + } + + /** + * Set the value of the property before the deployment is executed. + * + * @param before the before value to set + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withBefore(Object before) { + this.before = before; + return this; + } + + /** + * Get the value of the property after the deployment is executed. + * + * @return the after value + */ + public Object after() { + return this.after; + } + + /** + * Set the value of the property after the deployment is executed. + * + * @param after the after value to set + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withAfter(Object after) { + this.after = after; + return this; + } + + /** + * Get nested property changes. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set nested property changes. + * + * @param children the children value to set + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withChildren(List children) { + this.children = children; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfResultFormat.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfResultFormat.java new file mode 100644 index 0000000000000..69a56d763e6ef --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/WhatIfResultFormat.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_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for WhatIfResultFormat. + */ +public enum WhatIfResultFormat { + /** Enum value ResourceIdOnly. */ + RESOURCE_ID_ONLY("ResourceIdOnly"), + + /** Enum value FullResourcePayloads. */ + FULL_RESOURCE_PAYLOADS("FullResourcePayloads"); + + /** The actual serialized value for a WhatIfResultFormat instance. */ + private String value; + + WhatIfResultFormat(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a WhatIfResultFormat instance. + * + * @param value the serialized value to parse. + * @return the parsed WhatIfResultFormat object, or null if unable to parse. + */ + @JsonCreator + public static WhatIfResultFormat fromString(String value) { + WhatIfResultFormat[] items = WhatIfResultFormat.values(); + for (WhatIfResultFormat item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExportResultImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExportResultImpl.java new file mode 100644 index 0000000000000..de276c5ae2aa3 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExportResultInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExportResultInner.java new file mode 100644 index 0000000000000..6c7506f838af6 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExtendedImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExtendedImpl.java new file mode 100644 index 0000000000000..69f55368dec44 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExtendedImpl.java @@ -0,0 +1,137 @@ +/** + * 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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentExtended; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentProperties; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentPropertiesExtended; +import rx.functions.Func1; + +class DeploymentExtendedImpl extends CreatableUpdatableImpl implements DeploymentExtended, DeploymentExtended.Definition, DeploymentExtended.Update { + private String resourceGroupName; + private String deploymentName; + private DeploymentInner createOrUpdateParameter; + private final ResourcesManager manager; + + 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.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + // set other parameters for create and update + this.createOrUpdateParameter = new DeploymentInner(); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.createOrUpdateAsync(this.resourceGroupName, 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.createOrUpdateAsync(this.resourceGroupName, 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 client.getByResourceGroupAsync(this.resourceGroupName, this.deploymentName); + } + + @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 withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExtendedInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentExtendedInner.java new file mode 100644 index 0000000000000..9960963591fd2 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentInner.java new file mode 100644 index 0000000000000..043de948136d6 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationImpl.java new file mode 100644 index 0000000000000..b169955b114f6 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentOperation; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentOperationProperties; + +class DeploymentOperationImpl extends IndexableRefreshableWrapperImpl implements DeploymentOperation { + private final ResourcesManager manager; + private String scope; + private String deploymentName; + private String operationId; + + DeploymentOperationImpl(DeploymentOperationInner inner, ResourcesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DeploymentOperationsInner client = this.manager().inner().deploymentOperations(); + return client.getAtScopeAsync(this.scope, 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationInner.java new file mode 100644 index 0000000000000..1c99aefbc1038 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsImpl.java new file mode 100644 index 0000000000000..22274046b94d8 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsImpl.java @@ -0,0 +1,189 @@ +/** + * 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_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_08_01.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 getAtTenantScopeAsync(String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAtTenantScopeAsync(deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtTenantScopeAsync(final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listAtTenantScopeAsync(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 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 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 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 listAtScopeAsync(final String scope, final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listAtScopeAsync(scope, 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 getAtScopeAsync(String scope, String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAtScopeAsync(scope, deploymentName, operationId) + .flatMap(new Func1>() { + @Override + public Observable call(DeploymentOperationInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DeploymentOperation)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsInner.java new file mode 100644 index 0000000000000..ebe919694a15f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentOperationsInner.java @@ -0,0 +1,2294 @@ +/** + * 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_08_01.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_08_01.DeploymentOperations getAtScope" }) + @GET("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + Observable> getAtScope(@Path("scope") String scope, @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_08_01.DeploymentOperations listAtScope" }) + @GET("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + Observable> listAtScope(@Path("scope") String scope, @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_08_01.DeploymentOperations getAtTenantScope" }) + @GET("providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + Observable> getAtTenantScope(@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_08_01.DeploymentOperations listAtTenantScope" }) + @GET("providers/Microsoft.Resources/deployments/{deploymentName}/operations") + Observable> listAtTenantScope(@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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.DeploymentOperations listAtScopeNext" }) + @GET + Observable> listAtScopeNext(@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_08_01.DeploymentOperations listAtTenantScopeNext" }) + @GET + Observable> listAtTenantScopeNext(@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_08_01.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_08_01.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_08_01.DeploymentOperations listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a deployments operation. + * + * @param scope The scope of a deployment. + * @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 getAtScope(String scope, String deploymentName, String operationId) { + return getAtScopeWithServiceResponseAsync(scope, deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param scope The scope of a deployment. + * @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 getAtScopeAsync(String scope, String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtScopeWithServiceResponseAsync(scope, deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param scope The scope of a deployment. + * @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 getAtScopeAsync(String scope, String deploymentName, String operationId) { + return getAtScopeWithServiceResponseAsync(scope, deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param scope The scope of a deployment. + * @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> getAtScopeWithServiceResponseAsync(String scope, String deploymentName, String operationId) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.getAtScope(scope, deploymentName, operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtScopeDelegate(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 scope The scope of 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 listAtScope(final String scope, final String deploymentName) { + ServiceResponse> response = listAtScopeSinglePageAsync(scope, deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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> listAtScopeAsync(final String scope, final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeSinglePageAsync(scope, deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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> listAtScopeAsync(final String scope, final String deploymentName) { + return listAtScopeWithServiceResponseAsync(scope, deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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>> listAtScopeWithServiceResponseAsync(final String scope, final String deploymentName) { + return listAtScopeSinglePageAsync(scope, 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(listAtScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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>> listAtScopeSinglePageAsync(final String scope, final String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.listAtScope(scope, deploymentName, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeDelegate(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 scope The scope of 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 listAtScope(final String scope, final String deploymentName, final Integer top) { + ServiceResponse> response = listAtScopeSinglePageAsync(scope, deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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> listAtScopeAsync(final String scope, final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeSinglePageAsync(scope, deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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> listAtScopeAsync(final String scope, final String deploymentName, final Integer top) { + return listAtScopeWithServiceResponseAsync(scope, deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The scope of 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>> listAtScopeWithServiceResponseAsync(final String scope, final String deploymentName, final Integer top) { + return listAtScopeSinglePageAsync(scope, 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(listAtScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param scope The scope of 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>> listAtScopeSinglePageAsync(final String scope, final String deploymentName, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.listAtScope(scope, deploymentName, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtScopeDelegate(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 getAtTenantScope(String deploymentName, String operationId) { + return getAtTenantScopeWithServiceResponseAsync(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 getAtTenantScopeAsync(String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtTenantScopeWithServiceResponseAsync(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 getAtTenantScopeAsync(String deploymentName, String operationId) { + return getAtTenantScopeWithServiceResponseAsync(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> getAtTenantScopeWithServiceResponseAsync(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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtTenantScope(deploymentName, operationId, 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 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 listAtTenantScope(final String deploymentName) { + ServiceResponse> response = listAtTenantScopeSinglePageAsync(deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(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> listAtTenantScopeAsync(final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeSinglePageAsync(deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(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> listAtTenantScopeAsync(final String deploymentName) { + return listAtTenantScopeWithServiceResponseAsync(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>> listAtTenantScopeWithServiceResponseAsync(final String deploymentName) { + return listAtTenantScopeSinglePageAsync(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(listAtTenantScopeNextWithServiceResponseAsync(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>> listAtTenantScopeSinglePageAsync(final String deploymentName) { + 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.listAtTenantScope(deploymentName, top, 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 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 listAtTenantScope(final String deploymentName, final Integer top) { + ServiceResponse> response = listAtTenantScopeSinglePageAsync(deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(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> listAtTenantScopeAsync(final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeSinglePageAsync(deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(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> listAtTenantScopeAsync(final String deploymentName, final Integer top) { + return listAtTenantScopeWithServiceResponseAsync(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>> listAtTenantScopeWithServiceResponseAsync(final String deploymentName, final Integer top) { + return listAtTenantScopeSinglePageAsync(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(listAtTenantScopeNextWithServiceResponseAsync(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>> listAtTenantScopeSinglePageAsync(final String deploymentName, final Integer top) { + 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.listAtTenantScope(deploymentName, top, 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 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 listAtScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(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> listAtScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(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> listAtScopeNextAsync(final String nextPageLink) { + return listAtScopeNextWithServiceResponseAsync(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>> listAtScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtScopeNextSinglePageAsync(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(listAtScopeNextWithServiceResponseAsync(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>> listAtScopeNextSinglePageAsync(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.listAtScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtScopeNextDelegate(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 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 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> 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 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> listAtTenantScopeNextAsync(final String nextPageLink) { + return listAtTenantScopeNextWithServiceResponseAsync(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>> 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 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>> 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); + } + + /** + * 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentValidateResultImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentValidateResultImpl.java new file mode 100644 index 0000000000000..fb5bfdf08874d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentValidateResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; +import com.microsoft.azure.management.resources.v2019_08_01.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 ErrorResponse error() { + return this.inner().error(); + } + + @Override + public DeploymentPropertiesExtended properties() { + return this.inner().properties(); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentValidateResultInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentValidateResultInner.java new file mode 100644 index 0000000000000..5da0eecec15eb --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information from validate template deployment response. + */ +public class DeploymentValidateResultInner { + /** + * The deployment validation error. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * The template deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get the deployment validation error. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the deployment validation error. + * + * @param error the error value to set + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withError(ErrorResponse 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsImpl.java new file mode 100644 index 0000000000000..140407111a518 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsImpl.java @@ -0,0 +1,581 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.resources.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.Deployments; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentExtended; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentValidateResult; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentExportResult; +import com.microsoft.azure.management.resources.v2019_08_01.WhatIfOperationResult; +import com.microsoft.azure.management.resources.v2019_08_01.TemplateHashResult; +import com.microsoft.azure.management.resources.v2019_08_01.ScopedDeployment; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentWhatIf; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class DeploymentsImpl extends WrapperImpl implements Deployments { + private PagedListConverter converter; + private final ResourcesManager manager; + + DeploymentsImpl(ResourcesManager manager) { + super(manager.inner().deployments()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(DeploymentExtendedInner inner) { + return Observable.just((DeploymentExtended) wrapModel(inner)); + } + }; + } + + 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 deleteAtScopeAsync(String scope, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAtScopeAsync(scope, deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAtScopeAsync(String scope, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAtScopeAsync(scope, deploymentName) + ;} + + @Override + public Observable createOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAtScopeAsync(scope, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtScopeAsync(String scope, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getAtScopeAsync(scope, deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAtScopeAsync(String scope, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAtScopeAsync(scope, deploymentName).toCompletable(); + } + + @Override + public Observable validateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAtScopeAsync(scope, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAtScopeAsync(String scope, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAtScopeAsync(scope, deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtTenantScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAtTenantScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAtTenantScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAtTenantScopeAsync(deploymentName) + ;} + + @Override + public Observable createOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAtTenantScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtTenantScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getAtTenantScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAtTenantScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAtTenantScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable validateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + DeploymentsInner client = this.inner(); + return client.validateAtTenantScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAtTenantScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAtTenantScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, 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 createOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, ScopedDeployment parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @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, ScopedDeployment 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 whatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters) { + DeploymentsInner client = this.inner(); + return client.whatIfAtSubscriptionScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public WhatIfOperationResult call(WhatIfOperationResultInner inner) { + return new WhatIfOperationResultImpl(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 Observable checkExistenceAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName, deploymentName) + ;} + + @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 whatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + DeploymentsInner client = this.inner(); + return client.whatIfAsync(resourceGroupName, deploymentName, parameters) + .map(new Func1() { + @Override + public WhatIfOperationResult call(WhatIfOperationResultInner inner) { + return new WhatIfOperationResultImpl(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 listAtScopeAsync(final String scope) { + DeploymentsInner client = this.inner(); + return client.listAtScopeAsync(scope) + .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 listAtTenantScopeAsync() { + DeploymentsInner client = this.inner(); + return client.listAtTenantScopeAsync() + .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 calculateTemplateHashAsync(Object template) { + DeploymentsInner client = this.inner(); + return client.calculateTemplateHashAsync(template) + .map(new Func1() { + @Override + public TemplateHashResult call(TemplateHashResultInner inner) { + return new TemplateHashResultImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + DeploymentsInner client = this.inner(); + return converter.convert(client.list()); + } + + @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 wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + DeploymentsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(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 wrapModel(inner); + } + }); + } + + private Observable getInnerAsync(String resourceGroupName, String name) { + DeploymentsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + public DeploymentExtended getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupAsync(resourceGroupName, name).toBlocking().last(); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return this.getInnerAsync(resourceGroupName, name).flatMap(new Func1> () { + @Override + public Observable call(DeploymentExtendedInner innerT) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DeploymentExtended)wrapModel(innerT)); + } + } + }); + } + + @Override + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback callback) { + return ServiceFuture.fromBody(getByResourceGroupAsync(resourceGroupName, name), callback); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.deleteByResourceGroupAsync(resourceGroupName, name).await(); + } + + @Override + public Completable deleteByResourceGroupAsync(String resourceGroupName, String name) { + return this.inner().deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback serviceCallback) { + return ServiceFuture.fromBody(deleteByResourceGroupAsync(resourceGroupName, name), serviceCallback); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsInner.java new file mode 100644 index 0000000000000..74cca6ecbc65f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/DeploymentsInner.java @@ -0,0 +1,6122 @@ +/** + * 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_08_01.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.management.resources.v2019_08_01.DeploymentsWhatIfAtSubscriptionScopeHeaders; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentsWhatIfHeaders; +import com.microsoft.azure.management.resources.v2019_08_01.DeploymentWhatIf; +import com.microsoft.azure.management.resources.v2019_08_01.ScopedDeployment; +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.ServiceResponseWithHeaders; +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; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * 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_08_01.Deployments deleteAtScope" }) + @HTTP(path = "{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> deleteAtScope(@Path("scope") String scope, @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_08_01.Deployments beginDeleteAtScope" }) + @HTTP(path = "{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDeleteAtScope(@Path("scope") String scope, @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_08_01.Deployments checkExistenceAtScope" }) + @HEAD("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistenceAtScope(@Path("scope") String scope, @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_08_01.Deployments createOrUpdateAtScope" }) + @PUT("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtScope(@Path("scope") String scope, @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_08_01.Deployments beginCreateOrUpdateAtScope" }) + @PUT("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtScope(@Path("scope") String scope, @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_08_01.Deployments getAtScope" }) + @GET("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getAtScope(@Path("scope") String scope, @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_08_01.Deployments cancelAtScope" }) + @POST("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancelAtScope(@Path("scope") String scope, @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_08_01.Deployments validateAtScope" }) + @POST("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validateAtScope(@Path("scope") String scope, @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_08_01.Deployments exportTemplateAtScope" }) + @POST("{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplateAtScope(@Path("scope") String scope, @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_08_01.Deployments listAtScope" }) + @GET("{scope}/providers/Microsoft.Resources/deployments/") + Observable> listAtScope(@Path("scope") String scope, @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_08_01.Deployments deleteAtTenantScope" }) + @HTTP(path = "providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> deleteAtTenantScope(@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_08_01.Deployments beginDeleteAtTenantScope" }) + @HTTP(path = "providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDeleteAtTenantScope(@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_08_01.Deployments checkExistenceAtTenantScope" }) + @HEAD("providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistenceAtTenantScope(@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_08_01.Deployments createOrUpdateAtTenantScope" }) + @PUT("providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtTenantScope(@Path("deploymentName") String deploymentName, @Body ScopedDeployment 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_08_01.Deployments beginCreateOrUpdateAtTenantScope" }) + @PUT("providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtTenantScope(@Path("deploymentName") String deploymentName, @Body ScopedDeployment 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_08_01.Deployments getAtTenantScope" }) + @GET("providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getAtTenantScope(@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_08_01.Deployments cancelAtTenantScope" }) + @POST("providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancelAtTenantScope(@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_08_01.Deployments validateAtTenantScope" }) + @POST("providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validateAtTenantScope(@Path("deploymentName") String deploymentName, @Body ScopedDeployment 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_08_01.Deployments exportTemplateAtTenantScope" }) + @POST("providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplateAtTenantScope(@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_08_01.Deployments listAtTenantScope" }) + @GET("providers/Microsoft.Resources/deployments/") + Observable> listAtTenantScope(@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_08_01.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_08_01.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_08_01.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_08_01.Deployments createOrUpdateAtManagementGroupScope" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Body ScopedDeployment 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_08_01.Deployments beginCreateOrUpdateAtManagementGroupScope" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Body ScopedDeployment 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_08_01.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_08_01.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_08_01.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 ScopedDeployment 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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.Deployments whatIfAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + Observable> whatIfAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentWhatIf 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_08_01.Deployments beginWhatIfAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + Observable> beginWhatIfAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentWhatIf 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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.Deployments whatIf" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + Observable> whatIf(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentWhatIf 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_08_01.Deployments beginWhatIf" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + Observable> beginWhatIf(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentWhatIf 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_08_01.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_08_01.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_08_01.Deployments calculateTemplateHash" }) + @POST("providers/Microsoft.Resources/calculateTemplateHash") + Observable> calculateTemplateHash(@Query("api-version") String apiVersion, @Body Object template, @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_08_01.Deployments listAtScopeNext" }) + @GET + Observable> listAtScopeNext(@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_08_01.Deployments listAtTenantScopeNext" }) + @GET + Observable> listAtTenantScopeNext(@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_08_01.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_08_01.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_08_01.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 scope The scope of 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 + */ + public void deleteAtScope(String scope, String deploymentName) { + deleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of 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 deleteAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAtScopeAsync(String scope, String deploymentName) { + return deleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.deleteAtScope(scope, 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 scope The scope of 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 + */ + public void beginDeleteAtScope(String scope, String deploymentName) { + beginDeleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of 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 beginDeleteAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAtScopeAsync(String scope, String deploymentName) { + return beginDeleteAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.beginDeleteAtScope(scope, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteAtScopeDelegate(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 scope The scope of 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 boolean object if successful. + */ + public boolean checkExistenceAtScope(String scope, String deploymentName) { + return checkExistenceAtScopeWithServiceResponseAsync(scope, deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The scope of 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 checkExistenceAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceAtScopeWithServiceResponseAsync(scope, deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAtScopeAsync(String scope, String deploymentName) { + return checkExistenceAtScopeWithServiceResponseAsync(scope, deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.checkExistenceAtScope(scope, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceAtScopeDelegate(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 a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 createOrUpdateAtScope(String scope, String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 createOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 createOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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> createOrUpdateAtScopeWithServiceResponseAsync(String scope, String deploymentName, DeploymentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.createOrUpdateAtScope(scope, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 beginCreateOrUpdateAtScope(String scope, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 beginCreateOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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 beginCreateOrUpdateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at a given scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The scope of a deployment. + * @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> beginCreateOrUpdateAtScopeWithServiceResponseAsync(String scope, String deploymentName, DeploymentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.beginCreateOrUpdateAtScope(scope, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtScopeDelegate(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 scope The scope of 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 getAtScope(String scope, String deploymentName) { + return getAtScopeWithServiceResponseAsync(scope, deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param scope The scope of 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 getAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtScopeWithServiceResponseAsync(scope, deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param scope The scope of 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 getAtScopeAsync(String scope, String deploymentName) { + return getAtScopeWithServiceResponseAsync(scope, deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param scope The scope of 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> getAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.getAtScope(scope, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtScopeDelegate(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 scope The scope of 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 + */ + public void cancelAtScope(String scope, String deploymentName) { + cancelAtScopeWithServiceResponseAsync(scope, 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 scope The scope of 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 cancelAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAtScopeAsync(String scope, String deploymentName) { + return cancelAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.cancelAtScope(scope, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtScopeDelegate(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 scope The scope of a deployment. + * @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 validateAtScope(String scope, String deploymentName, DeploymentInner parameters) { + return validateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param scope The scope of a deployment. + * @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 validateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateAtScopeWithServiceResponseAsync(scope, deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param scope The scope of a deployment. + * @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 validateAtScopeAsync(String scope, String deploymentName, DeploymentInner parameters) { + return validateAtScopeWithServiceResponseAsync(scope, 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 scope The scope of a deployment. + * @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> validateAtScopeWithServiceResponseAsync(String scope, String deploymentName, DeploymentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.validateAtScope(scope, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateAtScopeDelegate(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 scope The scope of 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 DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplateAtScope(String scope, String deploymentName) { + return exportTemplateAtScopeWithServiceResponseAsync(scope, deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The scope of 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 exportTemplateAtScopeAsync(String scope, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateAtScopeWithServiceResponseAsync(scope, deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The scope of a 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 exportTemplateAtScopeAsync(String scope, String deploymentName) { + return exportTemplateAtScopeWithServiceResponseAsync(scope, deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The scope of a 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> exportTemplateAtScopeWithServiceResponseAsync(String scope, String deploymentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.exportTemplateAtScope(scope, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateAtScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateAtScopeDelegate(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 at the given scope. + * + * @param scope The scope of a 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<DeploymentExtendedInner> object if successful. + */ + public PagedList listAtScope(final String scope) { + ServiceResponse> response = listAtScopeSinglePageAsync(scope).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a 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> listAtScopeAsync(final String scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAtScopeAsync(final String scope) { + return listAtScopeWithServiceResponseAsync(scope) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listAtScopeWithServiceResponseAsync(final String scope) { + return listAtScopeSinglePageAsync(scope) + .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(listAtScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtScopeSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.listAtScope(scope, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @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 listAtScope(final String scope, final String filter, final Integer top) { + ServiceResponse> response = listAtScopeSinglePageAsync(scope, filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @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> listAtScopeAsync(final String scope, final String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeSinglePageAsync(scope, filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @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> listAtScopeAsync(final String scope, final String filter, final Integer top) { + return listAtScopeWithServiceResponseAsync(scope, filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The scope of a deployment. + * @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>> listAtScopeWithServiceResponseAsync(final String scope, final String filter, final Integer top) { + return listAtScopeSinglePageAsync(scope, 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(listAtScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + ServiceResponse> * @param scope The scope of a deployment. + 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>> listAtScopeSinglePageAsync(final String scope, final String filter, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.listAtScope(scope, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtScopeDelegate(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 deleteAtTenantScope(String deploymentName) { + deleteAtTenantScopeWithServiceResponseAsync(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 deleteAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtTenantScopeWithServiceResponseAsync(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 deleteAtTenantScopeAsync(String deploymentName) { + return deleteAtTenantScopeWithServiceResponseAsync(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> deleteAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.deleteAtTenantScope(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 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 beginDeleteAtTenantScope(String deploymentName) { + beginDeleteAtTenantScopeWithServiceResponseAsync(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 beginDeleteAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteAtTenantScopeWithServiceResponseAsync(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 beginDeleteAtTenantScopeAsync(String deploymentName) { + return beginDeleteAtTenantScopeWithServiceResponseAsync(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> beginDeleteAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.beginDeleteAtTenantScope(deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteAtTenantScopeDelegate(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 checkExistenceAtTenantScope(String deploymentName) { + return checkExistenceAtTenantScopeWithServiceResponseAsync(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 checkExistenceAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceAtTenantScopeWithServiceResponseAsync(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 checkExistenceAtTenantScopeAsync(String deploymentName) { + return checkExistenceAtTenantScopeWithServiceResponseAsync(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> checkExistenceAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.checkExistenceAtTenantScope(deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceAtTenantScopeDelegate(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 tenant 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 createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return createOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources at tenant 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 createOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at tenant 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 createOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + return createOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at tenant 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> createOrUpdateAtTenantScopeWithServiceResponseAsync(String deploymentName, ScopedDeployment parameters) { + 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.createOrUpdateAtTenantScope(deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources at tenant 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 beginCreateOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources at tenant 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 beginCreateOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at tenant 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 beginCreateOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtTenantScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at tenant 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> beginCreateOrUpdateAtTenantScopeWithServiceResponseAsync(String deploymentName, ScopedDeployment parameters) { + 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.beginCreateOrUpdateAtTenantScope(deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtTenantScopeDelegate(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 getAtTenantScope(String deploymentName) { + return getAtTenantScopeWithServiceResponseAsync(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 getAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtTenantScopeWithServiceResponseAsync(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 getAtTenantScopeAsync(String deploymentName) { + return getAtTenantScopeWithServiceResponseAsync(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> getAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.getAtTenantScope(deploymentName, 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); + } + + /** + * 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 cancelAtTenantScope(String deploymentName) { + cancelAtTenantScopeWithServiceResponseAsync(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 cancelAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtTenantScopeWithServiceResponseAsync(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 cancelAtTenantScopeAsync(String deploymentName) { + return cancelAtTenantScopeWithServiceResponseAsync(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> cancelAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.cancelAtTenantScope(deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtTenantScopeDelegate(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 validateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return validateAtTenantScopeWithServiceResponseAsync(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 validateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateAtTenantScopeWithServiceResponseAsync(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 validateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + return validateAtTenantScopeWithServiceResponseAsync(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> validateAtTenantScopeWithServiceResponseAsync(String deploymentName, ScopedDeployment parameters) { + 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.validateAtTenantScope(deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateAtTenantScopeDelegate(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 exportTemplateAtTenantScope(String deploymentName) { + return exportTemplateAtTenantScopeWithServiceResponseAsync(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 exportTemplateAtTenantScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateAtTenantScopeWithServiceResponseAsync(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 exportTemplateAtTenantScopeAsync(String deploymentName) { + return exportTemplateAtTenantScopeWithServiceResponseAsync(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> exportTemplateAtTenantScopeWithServiceResponseAsync(String deploymentName) { + 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.exportTemplateAtTenantScope(deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateAtTenantScopeDelegate(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 at the tenant scope. + * + * @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 listAtTenantScope() { + ServiceResponse> response = listAtTenantScopeSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments at the tenant scope. + * + * @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); + } + + /** + * Get all the deployments at the tenant scope. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAtTenantScopeAsync() { + return listAtTenantScopeWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> 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)); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> 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 String filter = null; + final Integer top = null; + return service.listAtTenantScope(filter, top, 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); + } + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + * @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 listAtTenantScope(final String filter, final Integer top) { + ServiceResponse> response = listAtTenantScopeSinglePageAsync(filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments at the tenant scope. + * + * @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> listAtTenantScopeAsync(final String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeSinglePageAsync(filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments at the tenant scope. + * + * @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> listAtTenantScopeAsync(final String filter, final Integer top) { + return listAtTenantScopeWithServiceResponseAsync(filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + * @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>> listAtTenantScopeWithServiceResponseAsync(final String filter, final Integer top) { + return listAtTenantScopeSinglePageAsync(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(listAtTenantScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + 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>> listAtTenantScopeSinglePageAsync(final String filter, final Integer top) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAtTenantScope(filter, top, 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); + } + + /** + * 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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, ScopedDeployment 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); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 WhatIfOperationResultInner object if successful. + */ + public WhatIfOperationResultInner whatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters) { + return whatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 whatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(whatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable whatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters) { + return whatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, WhatIfOperationResultInner>() { + @Override + public WhatIfOperationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> whatIfAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentWhatIf 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.whatIfAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), DeploymentsWhatIfAtSubscriptionScopeHeaders.class); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 WhatIfOperationResultInner object if successful. + */ + public WhatIfOperationResultInner beginWhatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 beginWhatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginWhatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WhatIfOperationResultInner object + */ + public Observable beginWhatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, WhatIfOperationResultInner>() { + @Override + public WhatIfOperationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WhatIfOperationResultInner object + */ + public Observable> beginWhatIfAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentWhatIf 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.beginWhatIfAtSubscriptionScope(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 { + ServiceResponseWithHeaders clientResponse = beginWhatIfAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginWhatIfAtSubscriptionScopeDelegate(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) + .buildWithHeaders(response, DeploymentsWhatIfAtSubscriptionScopeHeaders.class); + } + + /** + * 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); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 WhatIfOperationResultInner object if successful. + */ + public WhatIfOperationResultInner whatIf(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return whatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 whatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(whatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 + */ + public Observable whatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return whatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, WhatIfOperationResultInner>() { + @Override + public WhatIfOperationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 + */ + public Observable> whatIfWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf 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.whatIf(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), DeploymentsWhatIfHeaders.class); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 WhatIfOperationResultInner object if successful. + */ + public WhatIfOperationResultInner beginWhatIf(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 beginWhatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginWhatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 WhatIfOperationResultInner object + */ + public Observable beginWhatIfAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, WhatIfOperationResultInner>() { + @Override + public WhatIfOperationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @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 WhatIfOperationResultInner object + */ + public Observable> beginWhatIfWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentWhatIf 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.beginWhatIf(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 { + ServiceResponseWithHeaders clientResponse = beginWhatIfDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginWhatIfDelegate(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) + .buildWithHeaders(response, DeploymentsWhatIfHeaders.class); + } + + /** + * 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); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 TemplateHashResultInner object if successful. + */ + public TemplateHashResultInner calculateTemplateHash(Object template) { + return calculateTemplateHashWithServiceResponseAsync(template).toBlocking().single().body(); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 calculateTemplateHashAsync(Object template, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(calculateTemplateHashWithServiceResponseAsync(template), serviceCallback); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TemplateHashResultInner object + */ + public Observable calculateTemplateHashAsync(Object template) { + return calculateTemplateHashWithServiceResponseAsync(template).map(new Func1, TemplateHashResultInner>() { + @Override + public TemplateHashResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TemplateHashResultInner object + */ + public Observable> calculateTemplateHashWithServiceResponseAsync(Object template) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (template == null) { + throw new IllegalArgumentException("Parameter template is required and cannot be null."); + } + return service.calculateTemplateHash(this.client.apiVersion(), template, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = calculateTemplateHashDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse calculateTemplateHashDelegate(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 at the given scope. + * + * @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 listAtScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments at the given scope. + * + * @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> listAtScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments at the given scope. + * + * @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> listAtScopeNextAsync(final String nextPageLink) { + return listAtScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + * @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>> listAtScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtScopeNextSinglePageAsync(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(listAtScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments at the given scope. + * + 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>> listAtScopeNextSinglePageAsync(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.listAtScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtScopeNextDelegate(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 at the tenant scope. + * + * @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 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(); + } + }; + } + + /** + * Get all the deployments at the tenant scope. + * + * @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); + } + + /** + * Get all the deployments at the tenant scope. + * + * @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> listAtTenantScopeNextAsync(final String nextPageLink) { + return listAtTenantScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + * @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>> 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)); + } + }); + } + + /** + * Get all the deployments at the tenant scope. + * + 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>> 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); + } + + /** + * 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedImpl.java new file mode 100644 index 0000000000000..b2436d43835dd --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedImpl.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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.GenericResourceExpanded; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.resources.v2019_08_01.Identity; +import com.microsoft.azure.management.resources.v2019_08_01.Plan; +import com.microsoft.azure.management.resources.v2019_08_01.Sku; +import java.util.Map; + +class GenericResourceExpandedImpl extends WrapperImpl implements GenericResourceExpanded { + private final ResourcesManager manager; + + GenericResourceExpandedImpl(GenericResourceExpandedInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public DateTime changedTime() { + return this.inner().changedTime(); + } + + @Override + public DateTime createdTime() { + return this.inner().createdTime(); + } + + @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 String provisioningState() { + return this.inner().provisioningState(); + } + + @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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedInner.java new file mode 100644 index 0000000000000..2e6929735d001 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceExpandedInner.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_08_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource information. + */ +public class GenericResourceExpandedInner extends GenericResourceInner { + /** + * The created time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdTime; + + /** + * The changed time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "changedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime changedTime; + + /** + * The provisioning state of the resource. This is only present if + * requested via the $expand query parameter. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the created time of the resource. This is only present if requested via the $expand query parameter. + * + * @return the createdTime value + */ + public DateTime createdTime() { + return this.createdTime; + } + + /** + * Get the changed time of the resource. This is only present if requested via the $expand query parameter. + * + * @return the changedTime value + */ + public DateTime changedTime() { + return this.changedTime; + } + + /** + * Get the provisioning state of the resource. This is only present if requested via the $expand query parameter. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceImpl.java new file mode 100644 index 0000000000000..d9159bca93a56 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceImpl.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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.GenericResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.Identity; +import com.microsoft.azure.management.resources.v2019_08_01.Plan; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/GenericResourceInner.java new file mode 100644 index 0000000000000..610e495fe5bbe --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.Plan; +import com.microsoft.azure.management.resources.v2019_08_01.Sku; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/IdParsingUtils.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..3481ddbc7351c --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..48a69bdefa5f3 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..e00e47d3283cc --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..deceab536fdad --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..10c8d52dc1cf1 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.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_08_01.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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/PageImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..2b40ff41b811b --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProviderImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProviderImpl.java new file mode 100644 index 0000000000000..476b9339e60a4 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.Provider; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProviderInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProviderInner.java new file mode 100644 index 0000000000000..0db03ae4aac39 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProvidersImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProvidersImpl.java new file mode 100644 index 0000000000000..187237ae44326 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProvidersImpl.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.Providers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_08_01.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) + .flatMap(new Func1>() { + @Override + public Observable call(ProviderInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Provider)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProvidersInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ProvidersInner.java new file mode 100644 index 0000000000000..bddc0df3d76ac --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupExportResultImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupExportResultImpl.java new file mode 100644 index 0000000000000..63cd191394ee2 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroupExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; + +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 ErrorResponse error() { + return this.inner().error(); + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupExportResultInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupExportResultInner.java new file mode 100644 index 0000000000000..ffec0beaaeba2 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group export result. + */ +public class ResourceGroupExportResultInner { + /** + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The template export error. + */ + @JsonProperty(value = "error") + private ErrorResponse 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 template export error. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the template export error. + * + * @param error the error value to set + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupImpl.java new file mode 100644 index 0000000000000..91a389f64f45d --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroupPatchable; +import java.util.Map; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupInner.java new file mode 100644 index 0000000000000..48eb2c918efe5 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsImpl.java new file mode 100644 index 0000000000000..7f3d338bbe7b9 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsImpl.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_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroupExportResult; +import com.microsoft.azure.management.resources.v2019_08_01.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_08_01.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) + .flatMap(new Func1>() { + @Override + public Observable call(ResourceGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ResourceGroup)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName).toCompletable(); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsInner.java new file mode 100644 index 0000000000000..d1fdf6e94d322 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceGroupsInner.java @@ -0,0 +1,1087 @@ +/** + * 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_08_01.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_08_01.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_08_01.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; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * 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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.ResourceGroups exportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") + Observable> exportTemplate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Body ExportTemplateRequest 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_08_01.ResourceGroups beginExportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") + Observable> beginExportTemplate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Body ExportTemplateRequest 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_08_01.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_08_01.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. The name is case insensitive. + * @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().last().body(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + 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. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportTemplateWithServiceResponseAsync(String resourceGroupName, ExportTemplateRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.exportTemplate(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 beginExportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { + return beginExportTemplateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 beginExportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportTemplateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable beginExportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + return beginExportTemplateWithServiceResponseAsync(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. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable> beginExportTemplateWithServiceResponseAsync(String resourceGroupName, ExportTemplateRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginExportTemplate(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExportTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportTemplateDelegate(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 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceManagementClientImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceManagementClientImpl.java new file mode 100644 index 0000000000000..6de7877fb2ceb --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourceManagementClientImpl.java @@ -0,0 +1,282 @@ +/** + * 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_08_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the 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 TagOperationsInner object to access its operations. + */ + private TagOperationsInner tagOperations; + + /** + * Gets the TagOperationsInner object to access its operations. + * @return the TagOperationsInner object. + */ + public TagOperationsInner tagOperations() { + return this.tagOperations; + } + + /** + * 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-08-01"; + 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.tagOperations = new TagOperationsInner(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-08-01"); + } +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesImpl.java new file mode 100644 index 0000000000000..37da40154efef --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesImpl.java @@ -0,0 +1,182 @@ +/** + * 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_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.Resources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_08_01.GenericResourceExpanded; +import com.microsoft.azure.management.resources.v2019_08_01.GenericResource; +import com.microsoft.azure.management.resources.v2019_08_01.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 GenericResourceExpandedImpl wrapModel(GenericResourceExpandedInner inner) { + return new GenericResourceExpandedImpl(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 GenericResourceExpanded call(GenericResourceExpandedInner inner) { + return new GenericResourceExpandedImpl(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 GenericResourceExpanded call(GenericResourceExpandedInner 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesInner.java new file mode 100644 index 0000000000000..369e1b98acf01 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesInner.java @@ -0,0 +1,2681 @@ +/** + * 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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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_08_01.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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + 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<GenericResourceExpandedInner> 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()) + .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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @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<GenericResourceExpandedInner> 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'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<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 Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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<GenericResourceExpandedInner> 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesManager.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..576cdf1c87be0 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.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_08_01.Operations; +import com.microsoft.azure.management.resources.v2019_08_01.Deployments; +import com.microsoft.azure.management.resources.v2019_08_01.Providers; +import com.microsoft.azure.management.resources.v2019_08_01.Resources; +import com.microsoft.azure.management.resources.v2019_08_01.ResourceGroups; +import com.microsoft.azure.management.resources.v2019_08_01.TagOperations; +import com.microsoft.azure.management.resources.v2019_08_01.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 TagOperations tagOperations; + 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 TagOperations. + */ + public TagOperations tagOperations() { + if (this.tagOperations == null) { + this.tagOperations = new TagOperationsImpl(this); + } + return this.tagOperations; + } + + /** + * @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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagDetailsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagDetailsImpl.java new file mode 100644 index 0000000000000..51e7780270c45 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.TagDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_08_01.TagCount; +import java.util.ArrayList; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagDetailsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagDetailsInner.java new file mode 100644 index 0000000000000..24e93cb11394f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsImpl.java new file mode 100644 index 0000000000000..d94d946f3d4e7 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsImpl.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_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.TagOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_08_01.TagDetails; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_08_01.TagValue; + +class TagOperationsImpl extends WrapperImpl implements TagOperations { + private final ResourcesManager manager; + + TagOperationsImpl(ResourcesManager manager) { + super(manager.inner().tagOperations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private TagDetailsImpl wrapTagDetailsModel(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + TagOperationsInner 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) { + TagOperationsInner client = this.inner(); + return client.deleteAsync(tagName).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String tagName) { + TagOperationsInner 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) { + TagOperationsInner client = this.inner(); + return client.deleteValueAsync(tagName, tagValue).toCompletable(); + } + + @Override + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + TagOperationsInner 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsInner.java new file mode 100644 index 0000000000000..69c7c74f1483f --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagOperationsInner.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_08_01.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 TagOperations. + */ +public class TagOperationsInner { + /** The Retrofit service to perform REST calls. */ + private TagOperationsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of TagOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagOperationsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(TagOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TagOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface TagOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_08_01.TagOperations 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_08_01.TagOperations 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_08_01.TagOperations 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_08_01.TagOperations 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_08_01.TagOperations 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_08_01.TagOperations 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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagValueImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagValueImpl.java new file mode 100644 index 0000000000000..883108ddd455e --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.TagValue; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagValueInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TagValueInner.java new file mode 100644 index 0000000000000..99c173ff6a21c --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.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/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultImpl.java new file mode 100644 index 0000000000000..25056d1f028b7 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.TemplateHashResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class TemplateHashResultImpl extends WrapperImpl implements TemplateHashResult { + private final ResourcesManager manager; + TemplateHashResultImpl(TemplateHashResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String minifiedTemplate() { + return this.inner().minifiedTemplate(); + } + + @Override + public String templateHash() { + return this.inner().templateHash(); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultInner.java new file mode 100644 index 0000000000000..7f68bec999d91 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/TemplateHashResultInner.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_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the request to calculate template hash. It contains a string of + * minified template and its hash. + */ +public class TemplateHashResultInner { + /** + * The minified template string. + */ + @JsonProperty(value = "minifiedTemplate") + private String minifiedTemplate; + + /** + * The template hash. + */ + @JsonProperty(value = "templateHash") + private String templateHash; + + /** + * Get the minified template string. + * + * @return the minifiedTemplate value + */ + public String minifiedTemplate() { + return this.minifiedTemplate; + } + + /** + * Set the minified template string. + * + * @param minifiedTemplate the minifiedTemplate value to set + * @return the TemplateHashResultInner object itself. + */ + public TemplateHashResultInner withMinifiedTemplate(String minifiedTemplate) { + this.minifiedTemplate = minifiedTemplate; + return this; + } + + /** + * Get the template hash. + * + * @return the templateHash value + */ + public String templateHash() { + return this.templateHash; + } + + /** + * Set the template hash. + * + * @param templateHash the templateHash value to set + * @return the TemplateHashResultInner object itself. + */ + public TemplateHashResultInner withTemplateHash(String templateHash) { + this.templateHash = templateHash; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultImpl.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultImpl.java new file mode 100644 index 0000000000000..eacffba946b71 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultImpl.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_08_01.implementation; + +import com.microsoft.azure.management.resources.v2019_08_01.WhatIfOperationResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_08_01.WhatIfChange; +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; + +class WhatIfOperationResultImpl extends WrapperImpl implements WhatIfOperationResult { + private final ResourcesManager manager; + WhatIfOperationResultImpl(WhatIfOperationResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public List changes() { + return this.inner().changes(); + } + + @Override + public ErrorResponse error() { + return this.inner().error(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultInner.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultInner.java new file mode 100644 index 0000000000000..c6dda5425b23a --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/WhatIfOperationResultInner.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_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.resources.v2019_08_01.WhatIfChange; +import com.microsoft.azure.management.resources.v2019_08_01.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Result of the What-If operation. Contains a list of predicted changes and a + * URL link to get to the next set of results. + */ +@JsonFlatten +public class WhatIfOperationResultInner { + /** + * Status of the What-If operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * List of resource changes predicted by What-If operation. + */ + @JsonProperty(value = "properties.changes") + private List changes; + + /** + * Error when What-If operation fails. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get status of the What-If operation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status of the What-If operation. + * + * @param status the status value to set + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get list of resource changes predicted by What-If operation. + * + * @return the changes value + */ + public List changes() { + return this.changes; + } + + /** + * Set list of resource changes predicted by What-If operation. + * + * @param changes the changes value to set + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withChanges(List changes) { + this.changes = changes; + return this; + } + + /** + * Get error when What-If operation fails. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set error when What-If operation fails. + * + * @param error the error value to set + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/package-info.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/implementation/package-info.java new file mode 100644 index 0000000000000..e39fa15174b70 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01.implementation; diff --git a/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/package-info.java b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/package-info.java new file mode 100644 index 0000000000000..467ea5f3a9a39 --- /dev/null +++ b/sdk/resources/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/resources/v2019_08_01/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_08_01;