From 435c523797447d7700099a0469cff7223cde22d6 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 20 Feb 2020 02:49:21 +0000 Subject: [PATCH] Generated from b44fbabdfe4be6d0f4306c4152f7d3aab85a6eeb Adding new API version for Management Groups RP --- .../mgmt-v2017_11_01_preview/pom.xml | 135 ++ .../CreateManagementGroupRequest.java | 71 + .../v2017_11_01_preview/ErrorDetails.java | 69 + .../v2017_11_01_preview/ErrorResponse.java | 43 + .../ErrorResponseException.java | 44 + .../v2017_11_01_preview/ManagementGroup.java | 168 +++ .../ManagementGroupChildInfo.java | 125 ++ .../ManagementGroupDetails.java | 122 ++ .../ManagementGroupInfo.java | 45 + .../ManagementGroupSubscriptions.java | 37 + .../v2017_11_01_preview/ManagementGroups.java | 48 + .../v2017_11_01_preview/Operation.java | 30 + .../v2017_11_01_preview/OperationDisplay.java | 77 ++ .../v2017_11_01_preview/Operations.java | 27 + .../v2017_11_01_preview/ParentGroupInfo.java | 70 + .../implementation/IdParsingUtils.java | 57 + .../implementation/ManagementGroupImpl.java | 153 +++ .../ManagementGroupInfoImpl.java | 51 + .../ManagementGroupInfoInner.java | 120 ++ .../implementation/ManagementGroupInner.java | 128 ++ .../ManagementGroupSubscriptionsImpl.java | 40 + .../ManagementGroupSubscriptionsInner.java | 390 ++++++ .../ManagementGroupsAPIImpl.java | 201 +++ .../implementation/ManagementGroupsImpl.java | 82 ++ .../implementation/ManagementGroupsInner.java | 1188 +++++++++++++++++ .../implementation/ManagementManager.java | 120 ++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++++ .../implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 13 + .../v2017_11_01_preview/package-info.java | 13 + 33 files changed, 4170 insertions(+) create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/pom.xml create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/CreateManagementGroupRequest.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorDetails.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponse.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponseException.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroup.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupChildInfo.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupDetails.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupInfo.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupSubscriptions.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroups.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operation.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/OperationDisplay.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operations.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ParentGroupInfo.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/IdParsingUtils.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsAPIImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementManager.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsInner.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/PageImpl.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/package-info.java create mode 100644 sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/package-info.java diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/pom.xml b/sdk/managementgroups/mgmt-v2017_11_01_preview/pom.xml new file mode 100644 index 0000000000000..2f679aa2a2afa --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azuregroups.v2017_11_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-management + 1.0.0-beta + jar + Microsoft Azure SDK for Management Management + This package contains Microsoft Management 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/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/CreateManagementGroupRequest.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/CreateManagementGroupRequest.java new file mode 100644 index 0000000000000..57397dfec7442 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/CreateManagementGroupRequest.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.managementgroups.v2017_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Management group creation parameters. + */ +public class CreateManagementGroupRequest { + /** + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * (Optional) The fully qualified ID for the parent management group. For + * example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "parentId") + private String parentId; + + /** + * Get the friendly name of the management group. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the management group. + * + * @param displayName the displayName value to set + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the parentId value + */ + public String parentId() { + return this.parentId; + } + + /** + * Set (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param parentId the parentId value to set + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withParentId(String parentId) { + this.parentId = parentId; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorDetails.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorDetails.java new file mode 100644 index 0000000000000..c2db4e5aa007f --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorDetails.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.managementgroups.v2017_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * One of a server-defined set of error codes. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get one of a server-defined set of error codes. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set one of a server-defined set of error codes. + * + * @param code the code value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human-readable representation of the error. + * + * @param message the message value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponse.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..3f3c69716835e --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponse.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.managementgroups.v2017_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error object. + */ +public class ErrorResponse { + /** + * Error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the error value. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponseException.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponseException.java new file mode 100644 index 0000000000000..02439fd532735 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroup.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroup.java new file mode 100644 index 0000000000000..f2a2ad0a35df7 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroup.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.ManagementGroupInner; +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.managementgroups.v2017_11_01_preview.implementation.ManagementManager; +import java.util.List; + +/** + * Type representing ManagementGroup. + */ +public interface ManagementGroup extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the children value. + */ + List children(); + + /** + * @return the details value. + */ + ManagementGroupDetails details(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagementGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCacheControl, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagementGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagementGroup definition. + */ + interface Blank extends WithCacheControl { + } + + /** + * The stage of the managementgroup definition allowing to specify CacheControl. + */ + interface WithCacheControl { + /** + * Specifies cacheControl. + * @param cacheControl Indicates that the request shouldn't utilize any caches + * @return the next definition stage + */ + WithCreate withCacheControl(String cacheControl); + } + + /** + * The stage of the managementgroup definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The friendly name of the management group + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the managementgroup definition allowing to specify ParentId. + */ + interface WithParentId { + /** + * Specifies parentId. + * @param parentId (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @return the next definition stage + */ + WithCreate withParentId(String parentId); + } + + /** + * 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.WithDisplayName, DefinitionStages.WithParentId { + } + } + /** + * The template for a ManagementGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCacheControl, UpdateStages.WithDisplayName, UpdateStages.WithParentId { + } + + /** + * Grouping of ManagementGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the managementgroup update allowing to specify CacheControl. + */ + interface WithCacheControl { + /** + * Specifies cacheControl. + * @param cacheControl Indicates that the request shouldn't utilize any caches + * @return the next update stage + */ + Update withCacheControl(String cacheControl); + } + + /** + * The stage of the managementgroup update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The friendly name of the management group + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the managementgroup update allowing to specify ParentId. + */ + interface WithParentId { + /** + * Specifies parentId. + * @param parentId (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @return the next update stage + */ + Update withParentId(String parentId); + } + + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupChildInfo.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupChildInfo.java new file mode 100644 index 0000000000000..c223476fe5c7d --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupChildInfo.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The child information of a management group. + */ +public class ManagementGroupChildInfo { + /** + * The type of child resource. + * Possible values include: 'ManagementGroup', 'Subscription'. + */ + @JsonProperty(value = "childType") + private String childType; + + /** + * The fully qualified ID for the child resource (management group or + * subscription). For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "childId") + private String childId; + + /** + * The friendly name of the child resource. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get possible values include: 'ManagementGroup', 'Subscription'. + * + * @return the childType value + */ + public String childType() { + return this.childType; + } + + /** + * Set possible values include: 'ManagementGroup', 'Subscription'. + * + * @param childType the childType value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withChildType(String childType) { + this.childType = childType; + return this; + } + + /** + * Get the fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the childId value + */ + public String childId() { + return this.childId; + } + + /** + * Set the fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param childId the childId value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withChildId(String childId) { + this.childId = childId; + return this; + } + + /** + * Get the friendly name of the child resource. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the child resource. + * + * @param displayName the displayName value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the list of children. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set the list of children. + * + * @param children the children value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withChildren(List children) { + this.children = children; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupDetails.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupDetails.java new file mode 100644 index 0000000000000..9dcb3d54de735 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupDetails.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.managementgroups.v2017_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of a management group. + */ +public class ManagementGroupDetails { + /** + * The version number of the object. + */ + @JsonProperty(value = "version") + private Double version; + + /** + * The date and time when this object was last updated. + */ + @JsonProperty(value = "updatedTime") + private DateTime updatedTime; + + /** + * The identity of the principal or process that updated the object. + */ + @JsonProperty(value = "updatedBy") + private String updatedBy; + + /** + * Parent. + */ + @JsonProperty(value = "parent") + private ParentGroupInfo parent; + + /** + * Get the version number of the object. + * + * @return the version value + */ + public Double version() { + return this.version; + } + + /** + * Set the version number of the object. + * + * @param version the version value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withVersion(Double version) { + this.version = version; + return this; + } + + /** + * Get the date and time when this object was last updated. + * + * @return the updatedTime value + */ + public DateTime updatedTime() { + return this.updatedTime; + } + + /** + * Set the date and time when this object was last updated. + * + * @param updatedTime the updatedTime value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withUpdatedTime(DateTime updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get the identity of the principal or process that updated the object. + * + * @return the updatedBy value + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Set the identity of the principal or process that updated the object. + * + * @param updatedBy the updatedBy value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Get the parent value. + * + * @return the parent value + */ + public ParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent value. + * + * @param parent the parent value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withParent(ParentGroupInfo parent) { + this.parent = parent; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupInfo.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupInfo.java new file mode 100644 index 0000000000000..ecddeb9319146 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupInfo.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.ManagementManager; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.ManagementGroupInfoInner; + +/** + * Type representing ManagementGroupInfo. + */ +public interface ManagementGroupInfo extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupSubscriptions.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupSubscriptions.java new file mode 100644 index 0000000000000..120f799f13366 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroupSubscriptions.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.managementgroups.v2017_11_01_preview; + +import rx.Completable; + +/** + * Type representing ManagementGroupSubscriptions. + */ +public interface ManagementGroupSubscriptions { + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String groupId, String subscriptionId); + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String groupId, String subscriptionId); + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroups.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroups.java new file mode 100644 index 0000000000000..06fb52d117a43 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ManagementGroups.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.managementgroups.v2017_11_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.ManagementGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagementGroups. + */ +public interface ManagementGroups extends SupportsCreating, HasInner { + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String groupId); + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String groupId); + + /** + * List management groups for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operation.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operation.java new file mode 100644 index 0000000000000..34b207020d19e --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/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.managementgroups.v2017_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.ManagementManager; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/OperationDisplay.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..8f2d7278a0a25 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/OperationDisplay.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * The name of the provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The operation that can be performed. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the name of the provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation that can be performed. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operations.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operations.java new file mode 100644 index 0000000000000..b332193a0e488 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Management REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ParentGroupInfo.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ParentGroupInfo.java new file mode 100644 index 0000000000000..23f6dacc872b1 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/ParentGroupInfo.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.managementgroups.v2017_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * (Optional) The ID of the parent management group. + */ +public class ParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "parentId") + private String parentId; + + /** + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the parentId value + */ + public String parentId() { + return this.parentId; + } + + /** + * Set the fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param parentId the parentId value to set + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withParentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Get the friendly name of the parent management group. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the parent management group. + * + * @param displayName the displayName value to set + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/IdParsingUtils.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..57c1dbeb6e7a2 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupImpl.java new file mode 100644 index 0000000000000..756b16120b0fd --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupImpl.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.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.CreateManagementGroupRequest; +import java.util.List; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupChildInfo; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupDetails; +import rx.functions.Func1; + +class ManagementGroupImpl extends CreatableUpdatableImpl implements ManagementGroup, ManagementGroup.Definition, ManagementGroup.Update { + private String groupId; + private String ccacheControl; + private String ucacheControl; + private CreateManagementGroupRequest createOrUpdateParameter; + private final ManagementManager manager; + + ManagementGroupImpl(String name, ManagementManager manager) { + super(name, new ManagementGroupInner()); + this.manager = manager; + // Set resource name + this.groupId = name; + // + this.createOrUpdateParameter = new CreateManagementGroupRequest(); + } + + ManagementGroupImpl(ManagementGroupInner inner, ManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.groupId = inner.name(); + // set resource ancestor and positional variables + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "managementGroups"); + // set other parameters for create and update + this.createOrUpdateParameter = new CreateManagementGroupRequest(); + } + + @Override + public ManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagementGroupsInner client = this.manager().inner().managementGroups(); + return client.createOrUpdateAsync(this.groupId, this.createOrUpdateParameter, this.ccacheControl) + .map(new Func1() { + @Override + public ManagementGroupInner call(ManagementGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagementGroupsInner client = this.manager().inner().managementGroups(); + return client.updateAsync(this.groupId, this.createOrUpdateParameter, this.ucacheControl) + .map(new Func1() { + @Override + public ManagementGroupInner call(ManagementGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagementGroupsInner client = this.manager().inner().managementGroups(); + return client.getAsync(this.groupId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new CreateManagementGroupRequest(); + } + + @Override + public List children() { + return this.inner().children(); + } + + @Override + public ManagementGroupDetails details() { + return this.inner().details(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagementGroupImpl withCacheControl(String cacheControl) { + if (isInCreateMode()) { + this.ccacheControl = cacheControl; + } else { + this.ucacheControl = cacheControl; + } + return this; + } + + @Override + public ManagementGroupImpl withDisplayName(String displayName) { + this.createOrUpdateParameter.withDisplayName(displayName); + return this; + } + + @Override + public ManagementGroupImpl withParentId(String parentId) { + this.createOrUpdateParameter.withParentId(parentId); + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoImpl.java new file mode 100644 index 0000000000000..0faee437b1931 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoImpl.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class ManagementGroupInfoImpl extends WrapperImpl implements ManagementGroupInfo { + private final ManagementManager manager; + ManagementGroupInfoImpl(ManagementGroupInfoInner inner, ManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ManagementManager manager() { + return this.manager; + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoInner.java new file mode 100644 index 0000000000000..9a2876eed20a5 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInfoInner.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.managementgroups.v2017_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The management group resource. + */ +@JsonFlatten +public class ManagementGroupInfoInner { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The type of the resource. For example, + * /providers/Microsoft.Management/managementGroups. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "properties.tenantId") + private String tenantId; + + /** + * The friendly name of the management group. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Get the fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type of the resource. For example, /providers/Microsoft.Management/managementGroups. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the friendly name of the management group. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the management group. + * + * @param displayName the displayName value to set + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInner.java new file mode 100644 index 0000000000000..44eae1042117f --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupDetails; +import java.util.List; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupChildInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The management group details. + */ +@JsonFlatten +public class ManagementGroupInner extends ProxyResource { + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "properties.tenantId") + private String tenantId; + + /** + * The friendly name of the management group. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Details. + */ + @JsonProperty(value = "properties.details") + private ManagementGroupDetails details; + + /** + * The list of children. + */ + @JsonProperty(value = "properties.children") + private List children; + + /** + * Get the AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the friendly name of the management group. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the management group. + * + * @param displayName the displayName value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the details value. + * + * @return the details value + */ + public ManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDetails(ManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the list of children. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set the list of children. + * + * @param children the children value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withChildren(List children) { + this.children = children; + return this; + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsImpl.java new file mode 100644 index 0000000000000..67b72c372bd6d --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsImpl.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupSubscriptions; +import rx.Completable; + +class ManagementGroupSubscriptionsImpl extends WrapperImpl implements ManagementGroupSubscriptions { + private final ManagementManager manager; + + ManagementGroupSubscriptionsImpl(ManagementManager manager) { + super(manager.inner().managementGroupSubscriptions()); + this.manager = manager; + } + + public ManagementManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String groupId, String subscriptionId) { + ManagementGroupSubscriptionsInner client = this.inner(); + return client.createAsync(groupId, subscriptionId).toCompletable(); + } + + @Override + public Completable deleteAsync(String groupId, String subscriptionId) { + ManagementGroupSubscriptionsInner client = this.inner(); + return client.deleteAsync(groupId, subscriptionId).toCompletable(); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsInner.java new file mode 100644 index 0000000000000..a3d081cfcd171 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupSubscriptionsInner.java @@ -0,0 +1,390 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagementGroupSubscriptions. + */ +public class ManagementGroupSubscriptionsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ManagementGroupSubscriptionsService service; + /** The service client containing this operation class. */ + private ManagementGroupsAPIImpl client; + + /** + * Initializes an instance of ManagementGroupSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagementGroupSubscriptionsInner(Retrofit retrofit, ManagementGroupsAPIImpl client) { + this.service = retrofit.create(ManagementGroupSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagementGroupSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupSubscriptions create" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + Observable> create(@Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @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.managementgroups.v2017_11_01_preview.ManagementGroupSubscriptions delete" }) + @HTTP(path = "providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String groupId, String subscriptionId) { + createWithServiceResponseAsync(groupId, subscriptionId).toBlocking().single().body(); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription 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 createAsync(String groupId, String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(groupId, subscriptionId), serviceCallback); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String groupId, String subscriptionId) { + return createWithServiceResponseAsync(groupId, subscriptionId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String groupId, String subscriptionId) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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 cacheControl = null; + return service.create(groupId, subscriptionId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String groupId, String subscriptionId, String cacheControl) { + createWithServiceResponseAsync(groupId, subscriptionId, cacheControl).toBlocking().single().body(); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String groupId, String subscriptionId, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(groupId, subscriptionId, cacheControl), serviceCallback); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String groupId, String subscriptionId, String cacheControl) { + return createWithServiceResponseAsync(groupId, subscriptionId, cacheControl).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String groupId, String subscriptionId, String cacheControl) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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.create(groupId, subscriptionId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String groupId, String subscriptionId) { + deleteWithServiceResponseAsync(groupId, subscriptionId).toBlocking().single().body(); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription 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 deleteAsync(String groupId, String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(groupId, subscriptionId), serviceCallback); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String groupId, String subscriptionId) { + return deleteWithServiceResponseAsync(groupId, subscriptionId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String groupId, String subscriptionId) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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 cacheControl = null; + return service.delete(groupId, subscriptionId, this.client.apiVersion(), cacheControl, 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); + } + } + }); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String groupId, String subscriptionId, String cacheControl) { + deleteWithServiceResponseAsync(groupId, subscriptionId, cacheControl).toBlocking().single().body(); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback 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 groupId, String subscriptionId, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(groupId, subscriptionId, cacheControl), serviceCallback); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String groupId, String subscriptionId, String cacheControl) { + return deleteWithServiceResponseAsync(groupId, subscriptionId, cacheControl).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String groupId, String subscriptionId, String cacheControl) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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(groupId, subscriptionId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsAPIImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsAPIImpl.java new file mode 100644 index 0000000000000..1b5389758a47e --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsAPIImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ManagementGroupsAPIImpl class. + */ +public class ManagementGroupsAPIImpl 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; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-01-preview. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-01-preview. + * + * @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 ManagementGroupsAPIImpl 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 ManagementGroupsAPIImpl 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 ManagementGroupsAPIImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ManagementGroupsInner object to access its operations. + */ + private ManagementGroupsInner managementGroups; + + /** + * Gets the ManagementGroupsInner object to access its operations. + * @return the ManagementGroupsInner object. + */ + public ManagementGroupsInner managementGroups() { + return this.managementGroups; + } + + /** + * The ManagementGroupSubscriptionsInner object to access its operations. + */ + private ManagementGroupSubscriptionsInner managementGroupSubscriptions; + + /** + * Gets the ManagementGroupSubscriptionsInner object to access its operations. + * @return the ManagementGroupSubscriptionsInner object. + */ + public ManagementGroupSubscriptionsInner managementGroupSubscriptions() { + return this.managementGroupSubscriptions; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of ManagementGroupsAPI client. + * + * @param credentials the management credentials for Azure + */ + public ManagementGroupsAPIImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ManagementGroupsAPI client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ManagementGroupsAPIImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ManagementGroupsAPI client. + * + * @param restClient the REST client to connect to Azure. + */ + public ManagementGroupsAPIImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-11-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.managementGroups = new ManagementGroupsInner(restClient().retrofit(), this); + this.managementGroupSubscriptions = new ManagementGroupSubscriptionsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ManagementGroupsAPI", "2017-11-01-preview"); + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsImpl.java new file mode 100644 index 0000000000000..7459abd202c53 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsImpl.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroups; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroup; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupInfo; + +class ManagementGroupsImpl extends WrapperImpl implements ManagementGroups { + private final ManagementManager manager; + + ManagementGroupsImpl(ManagementManager manager) { + super(manager.inner().managementGroups()); + this.manager = manager; + } + + public ManagementManager manager() { + return this.manager; + } + + @Override + public ManagementGroupImpl define(String name) { + return wrapModel(name); + } + + private ManagementGroupImpl wrapModel(ManagementGroupInner inner) { + return new ManagementGroupImpl(inner, manager()); + } + + private ManagementGroupImpl wrapModel(String name) { + return new ManagementGroupImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String groupId) { + ManagementGroupsInner client = this.inner(); + return client.getAsync(groupId) + .map(new Func1() { + @Override + public ManagementGroup call(ManagementGroupInner inner) { + return new ManagementGroupImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String groupId) { + ManagementGroupsInner client = this.inner(); + return client.deleteAsync(groupId).toCompletable(); + } + + @Override + public Observable listAsync() { + ManagementGroupsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagementGroupInfo call(ManagementGroupInfoInner inner) { + return new ManagementGroupInfoImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsInner.java new file mode 100644 index 0000000000000..6c7727f9a5d52 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementGroupsInner.java @@ -0,0 +1,1188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.CreateManagementGroupRequest; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.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 ManagementGroups. + */ +public class ManagementGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ManagementGroupsService service; + /** The service client containing this operation class. */ + private ManagementGroupsAPIImpl client; + + /** + * Initializes an instance of ManagementGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagementGroupsInner(Retrofit retrofit, ManagementGroupsAPIImpl client) { + this.service = retrofit.create(ManagementGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagementGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroups list" }) + @GET("providers/Microsoft.Management/managementGroups") + Observable> list(@Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @Query("$skiptoken") String skiptoken, @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.managementgroups.v2017_11_01_preview.ManagementGroups get" }) + @GET("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> get(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$recurse") Boolean recurse, @Header("Cache-Control") String cacheControl, @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.managementgroups.v2017_11_01_preview.ManagementGroups createOrUpdate" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> createOrUpdate(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Body CreateManagementGroupRequest createManagementGroupRequest, @Header("Cache-Control") String cacheControl, @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.managementgroups.v2017_11_01_preview.ManagementGroups update" }) + @PATCH("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> update(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Body CreateManagementGroupRequest createManagementGroupRequest, @Header("Cache-Control") String cacheControl, @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.managementgroups.v2017_11_01_preview.ManagementGroups delete" }) + @HTTP(path = "providers/Microsoft.Management/managementGroups/{groupId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @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.managementgroups.v2017_11_01_preview.ManagementGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("Cache-Control") String cacheControl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List management groups for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagementGroupInfoInner> 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, null).toBlocking().single().body(); + } + }; + } + + /** + * List management groups for the authenticated user. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * List management groups for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> 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, null)); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagementGroupInfoInner> 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."); + } + final String cacheControl = null; + final String skiptoken = null; + return service.list(this.client.apiVersion(), cacheControl, skiptoken, 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); + } + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagementGroupInfoInner> object if successful. + */ + public PagedList list(final String cacheControl, final String skiptoken) { + ServiceResponse> response = listSinglePageAsync(cacheControl, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl).toBlocking().single().body(); + } + }; + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent 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> listAsync(final String cacheControl, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(cacheControl, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl); + } + }, + serviceCallback); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> object + */ + public Observable> listAsync(final String cacheControl, final String skiptoken) { + return listWithServiceResponseAsync(cacheControl, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> object + */ + public Observable>> listWithServiceResponseAsync(final String cacheControl, final String skiptoken) { + return listSinglePageAsync(cacheControl, skiptoken) + .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, cacheControl)); + } + }); + } + + /** + * List management groups for the authenticated user. + * + ServiceResponse> * @param cacheControl Indicates that the request shouldn't utilize any caches. + ServiceResponse> * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagementGroupInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String cacheControl, final String skiptoken) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), cacheControl, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner get(String groupId) { + return getWithServiceResponseAsync(groupId).toBlocking().single().body(); + } + + /** + * Get the details of the management group. + * + * @param groupId 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 getAsync(String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(groupId), serviceCallback); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable getAsync(String groupId) { + return getWithServiceResponseAsync(groupId).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> getWithServiceResponseAsync(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 expand = null; + final Boolean recurse = null; + final String cacheControl = null; + return service.get(groupId, this.client.apiVersion(), expand, recurse, cacheControl, 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); + } + } + }); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the response payload. Possible values include: 'children' + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner get(String groupId, String expand, Boolean recurse, String cacheControl) { + return getWithServiceResponseAsync(groupId, expand, recurse, cacheControl).toBlocking().single().body(); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the response payload. Possible values include: 'children' + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback 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 groupId, String expand, Boolean recurse, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(groupId, expand, recurse, cacheControl), serviceCallback); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the response payload. Possible values include: 'children' + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable getAsync(String groupId, String expand, Boolean recurse, String cacheControl) { + return getWithServiceResponseAsync(groupId, expand, recurse, cacheControl).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the response payload. Possible values include: 'children' + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> getWithServiceResponseAsync(String groupId, String expand, Boolean recurse, String cacheControl) { + 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.get(groupId, this.client.apiVersion(), expand, recurse, cacheControl, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest).toBlocking().single().body(); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation 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 createOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest), serviceCallback); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable createOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + 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."); + } + if (createManagementGroupRequest == null) { + throw new IllegalArgumentException("Parameter createManagementGroupRequest is required and cannot be null."); + } + Validator.validate(createManagementGroupRequest); + final String cacheControl = null; + return service.createOrUpdate(groupId, this.client.apiVersion(), createManagementGroupRequest, cacheControl, 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); + } + } + }); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).toBlocking().single().body(); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback 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 groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl), serviceCallback); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable createOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + 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."); + } + if (createManagementGroupRequest == null) { + throw new IllegalArgumentException("Parameter createManagementGroupRequest is required and cannot be null."); + } + Validator.validate(createManagementGroupRequest); + return service.createOrUpdate(groupId, this.client.apiVersion(), createManagementGroupRequest, cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner update(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return updateWithServiceResponseAsync(groupId, createManagementGroupRequest).toBlocking().single().body(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation 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 updateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(groupId, createManagementGroupRequest), serviceCallback); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable updateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return updateWithServiceResponseAsync(groupId, createManagementGroupRequest).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> updateWithServiceResponseAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + 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."); + } + if (createManagementGroupRequest == null) { + throw new IllegalArgumentException("Parameter createManagementGroupRequest is required and cannot be null."); + } + Validator.validate(createManagementGroupRequest); + final String cacheControl = null; + return service.update(groupId, this.client.apiVersion(), createManagementGroupRequest, cacheControl, 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); + } + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupInner object if successful. + */ + public ManagementGroupInner update(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return updateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).toBlocking().single().body(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback 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 groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl), serviceCallback); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable updateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return updateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> updateWithServiceResponseAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + 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."); + } + if (createManagementGroupRequest == null) { + throw new IllegalArgumentException("Parameter createManagementGroupRequest is required and cannot be null."); + } + Validator.validate(createManagementGroupRequest); + return service.update(groupId, this.client.apiVersion(), createManagementGroupRequest, cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String groupId) { + deleteWithServiceResponseAsync(groupId).toBlocking().single().body(); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId 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 deleteAsync(String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(groupId), serviceCallback); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String groupId) { + return deleteWithServiceResponseAsync(groupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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 cacheControl = null; + return service.delete(groupId, this.client.apiVersion(), cacheControl, 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); + } + } + }); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String groupId, String cacheControl) { + deleteWithServiceResponseAsync(groupId, cacheControl).toBlocking().single().body(); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @param serviceCallback 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 groupId, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(groupId, cacheControl), serviceCallback); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String groupId, String cacheControl) { + return deleteWithServiceResponseAsync(groupId, cacheControl).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete management group. + If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String groupId, String cacheControl) { + 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.delete(groupId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagementGroupInfoInner> 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, null).toBlocking().single().body(); + } + }; + } + + /** + * List management groups for the authenticated user. + * + * @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, null); + } + }, + serviceCallback); + } + + /** + * List management groups for the authenticated user. + * + * @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<ManagementGroupInfoInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @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<ManagementGroupInfoInner> 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, null)); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagementGroupInfoInner> 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."); + } + final String cacheControl = null; + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, cacheControl, 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); + } + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagementGroupInfoInner> object if successful. + */ + public PagedList listNext(final String nextPageLink, final String cacheControl) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink, cacheControl).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl).toBlocking().single().body(); + } + }; + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @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 String cacheControl, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink, cacheControl), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl); + } + }, + serviceCallback); + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> object + */ + public Observable> listNextAsync(final String nextPageLink, final String cacheControl) { + return listNextWithServiceResponseAsync(nextPageLink, cacheControl) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List management groups for the authenticated user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagementGroupInfoInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink, final String cacheControl) { + return listNextSinglePageAsync(nextPageLink, cacheControl) + .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, cacheControl)); + } + }); + } + + /** + * List management groups for the authenticated user. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagementGroupInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink, final String cacheControl) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementManager.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementManager.java new file mode 100644 index 0000000000000..da43980ca8eaf --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/ManagementManager.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.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroups; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ManagementGroupSubscriptions; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Management resource management. + */ +public final class ManagementManager extends ManagerCore { + private ManagementGroups managementGroups; + private ManagementGroupSubscriptions managementGroupSubscriptions; + private Operations operations; + /** + * Get a Configurable instance that can be used to create ManagementManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ManagementManager.ConfigurableImpl(); + } + /** + * Creates an instance of ManagementManager that exposes Management resource management API entry points. + * + * @param credentials the credentials to use + * @return the ManagementManager + */ + public static ManagementManager authenticate(AzureTokenCredentials credentials) { + return new ManagementManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of ManagementManager that exposes Management resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the ManagementManager + */ + public static ManagementManager authenticate(RestClient restClient) { + return new ManagementManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ManagementManager that exposes Management management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Management management API entry points that work across subscriptions + */ + ManagementManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage ManagementGroups. + */ + public ManagementGroups managementGroups() { + if (this.managementGroups == null) { + this.managementGroups = new ManagementGroupsImpl(this); + } + return this.managementGroups; + } + + /** + * @return Entry point to manage ManagementGroupSubscriptions. + */ + public ManagementGroupSubscriptions managementGroupSubscriptions() { + if (this.managementGroupSubscriptions == null) { + this.managementGroupSubscriptions = new ManagementGroupSubscriptionsImpl(this); + } + return this.managementGroupSubscriptions; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ManagementManager authenticate(AzureTokenCredentials credentials) { + return ManagementManager.authenticate(buildRestClient(credentials)); + } + } + private ManagementManager(RestClient restClient) { + super( + restClient, + null, + new ManagementGroupsAPIImpl(restClient)); + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..80c5f43ea01bf --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/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.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ManagementManager manager; + OperationImpl(OperationInner inner, ManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ManagementManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..a9509b3879586 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationInner.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.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation supported by the Microsoft.Management resource provider. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + 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; + } + + /** + * 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/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..f44e7e386a2ed --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ManagementManager manager; + + OperationsImpl(ManagementManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ManagementManager 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/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsInner.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..9af1e33aef345 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.managementgroups.v2017_11_01_preview.ErrorResponseException; +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 ManagementGroupsAPIImpl 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, ManagementGroupsAPIImpl 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.managementgroups.v2017_11_01_preview.Operations list" }) + @GET("providers/Microsoft.Management/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.managementgroups.v2017_11_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the 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 Management 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 Management 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 Management 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 Management 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available Management REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 Management 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 Management 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 Management 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 Management 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/PageImpl.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..fd62a9de74abd --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/package-info.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..42f7a19c544bd --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights 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 ManagementGroupsAPI. + * The Azure Management Groups API enables consolidation of multiple + subscriptions/resources into an organizational hierarchy and centrally + manage access control, policies, alerting and reporting for those resources. + */ +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview.implementation; diff --git a/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/package-info.java b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/package-info.java new file mode 100644 index 0000000000000..7a27eb4bb4076 --- /dev/null +++ b/sdk/managementgroups/mgmt-v2017_11_01_preview/src/main/java/com/microsoft/azure/management/managementgroups/v2017_11_01_preview/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights 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 ManagementGroupsAPI. + * The Azure Management Groups API enables consolidation of multiple + subscriptions/resources into an organizational hierarchy and centrally + manage access control, policies, alerting and reporting for those resources. + */ +package com.microsoft.azure.management.managementgroups.v2017_11_01_preview;