diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CheckNameAvailabilityRequest.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CheckNameAvailabilityRequest.java new file mode 100644 index 00000000000..bf3fcc18e92 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CheckNameAvailabilityRequest.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Management group name availability check parameters. + */ +public class CheckNameAvailabilityRequest { + /** + * the name to check for availability. + */ + @JsonProperty(value = "name") + private String name; + + /** + * fully qualified resource type which includes provider namespace. + * Possible values include: + * '/providers/Microsoft.Management/managementGroups'. + */ + @JsonProperty(value = "type") + private Type type; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public Type type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(Type type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupChildInfo.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupChildInfo.java new file mode 100644 index 00000000000..4cbdfe02aa2 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupChildInfo.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The child information of a management group used during creation. + */ +public class CreateManagementGroupChildInfo { + /** + * The type of child resource. + * The fully qualified resource type which includes provider namespace + * (e.g. /providers/Microsoft.Management/managementGroups). Possible values + * include: '/providers/Microsoft.Management/managementGroups', + * '/subscriptions'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * 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 = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the child entity. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The friendly name of the child resource. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The roles definitions associated with the management group. + */ + @JsonProperty(value = "roles", access = JsonProperty.Access.WRITE_ONLY) + private List roles; + + /** + * The list of children. + */ + @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the roles value. + * + * @return the roles value + */ + public List roles() { + return this.roles; + } + + /** + * Get the children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupDetails.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupDetails.java new file mode 100644 index 00000000000..04c2fd83c9c --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupDetails.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of a management group used during creation. + */ +public class CreateManagementGroupDetails { + /** + * The version number of the object. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private Double version; + + /** + * The date and time when this object was last updated. + */ + @JsonProperty(value = "updatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedTime; + + /** + * The identity of the principal or process that updated the object. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private String updatedBy; + + /** + * Parent. + */ + @JsonProperty(value = "parent") + private CreateParentGroupInfo parent; + + /** + * Get the version value. + * + * @return the version value + */ + public Double version() { + return this.version; + } + + /** + * Get the updatedTime value. + * + * @return the updatedTime value + */ + public DateTime updatedTime() { + return this.updatedTime; + } + + /** + * Get the updatedBy value. + * + * @return the updatedBy value + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Get the parent value. + * + * @return the parent value + */ + public CreateParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent value. + * + * @param parent the parent value to set + * @return the CreateManagementGroupDetails object itself. + */ + public CreateManagementGroupDetails withParent(CreateParentGroupInfo parent) { + this.parent = parent; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupRequest.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupRequest.java new file mode 100644 index 00000000000..da5d5bb1b4c --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateManagementGroupRequest.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Management group creation parameters. + */ +@JsonFlatten +public class CreateManagementGroupRequest { + /** + * 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") + private String name; + + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The friendly name of the management group. If no value is passed then + * this field will be set to the groupId. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The roles definitions associated with the management group. + */ + @JsonProperty(value = "properties.roles", access = JsonProperty.Access.WRITE_ONLY) + private List roles; + + /** + * Details. + */ + @JsonProperty(value = "properties.details") + private CreateManagementGroupDetails details; + + /** + * The list of children. + */ + @JsonProperty(value = "properties.children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the roles value. + * + * @return the roles value + */ + public List roles() { + return this.roles; + } + + /** + * Get the details value. + * + * @return the details value + */ + public CreateManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withDetails(CreateManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateParentGroupInfo.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateParentGroupInfo.java new file mode 100644 index 00000000000..53716ee1498 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/CreateParentGroupInfo.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * (Optional) The ID of the parent management group used during creation. + */ +public class CreateParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The name of the parent management group. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the CreateParentGroupInfo object itself. + */ + public CreateParentGroupInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityHierarchyItem.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityHierarchyItem.java new file mode 100644 index 00000000000..46cd44a5be7 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityHierarchyItem.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The management group details for the hierarchy view. + */ +@JsonFlatten +public class EntityHierarchyItem { + /** + * 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 friendly name of the management group. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Permissions. + * Possible values include: 'noaccess', 'view', 'edit', 'delete'. + */ + @JsonProperty(value = "properties.permissions") + private String permissions; + + /** + * The list of children. + */ + @JsonProperty(value = "properties.children") + private List children; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the permissions value. + * + * @return the permissions value + */ + public String permissions() { + return this.permissions; + } + + /** + * Set the permissions value. + * + * @param permissions the permissions value to set + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set the children value. + * + * @param children the children value to set + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withChildren(List children) { + this.children = children; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityParentGroupInfo.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityParentGroupInfo.java new file mode 100644 index 00000000000..d25a057ef2f --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/EntityParentGroupInfo.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * (Optional) The ID of the parent management group. + */ +public class EntityParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the EntityParentGroupInfo object itself. + */ + public EntityParentGroupInfo withId(String id) { + this.id = id; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorDetails.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorDetails.java new file mode 100644 index 00000000000..c684342d4d7 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorDetails.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +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; + + /** + * A human-readable representation of the error's details. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details value. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorResponse.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorResponse.java new file mode 100644 index 00000000000..91af58df21e --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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; + +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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorResponseException.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ErrorResponseException.java new file mode 100644 index 00000000000..7bbbb1bc6f3 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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; + +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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ManagementGroupChildInfo.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ManagementGroupChildInfo.java new file mode 100644 index 00000000000..aebd3e3f505 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ManagementGroupChildInfo.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +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. + * The fully qualified resource type which includes provider namespace + * (e.g. /providers/Microsoft.Management/managementGroups). Possible values + * include: '/providers/Microsoft.Management/managementGroups', + * '/subscriptions'. + */ + @JsonProperty(value = "type") + private String type; + + /** + * 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 = "id") + private String id; + + /** + * The name of the child entity. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The friendly name of the child resource. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The roles definitions associated with the management group. + */ + @JsonProperty(value = "roles") + private List roles; + + /** + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withType(String type) { + this.type = type; + return this; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the roles value. + * + * @return the roles value + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles value. + * + * @param roles the roles value to set + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withRoles(List roles) { + this.roles = roles; + return this; + } + + /** + * Get the children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set the children value. + * + * @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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ManagementGroupDetails.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ManagementGroupDetails.java new file mode 100644 index 00000000000..2fa32afacac --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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; + +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 value. + * + * @return the version value + */ + public Double version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withVersion(Double version) { + this.version = version; + return this; + } + + /** + * Get the updatedTime value. + * + * @return the updatedTime value + */ + public DateTime updatedTime() { + return this.updatedTime; + } + + /** + * Set the updatedTime value. + * + * @param updatedTime the updatedTime value to set + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withUpdatedTime(DateTime updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get the updatedBy value. + * + * @return the updatedBy value + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Set the updatedBy value. + * + * @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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/OperationDisplay.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/OperationDisplay.java new file mode 100644 index 00000000000..e02dd0aedea --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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; + +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 provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/OperationDisplayProperties.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/OperationDisplayProperties.java new file mode 100644 index 00000000000..620a0d578f2 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/OperationDisplayProperties.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplayProperties { + /** + * 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 provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ParentGroupInfo.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ParentGroupInfo.java new file mode 100644 index 00000000000..0cdcbb629c9 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/ParentGroupInfo.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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; + +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 = "id") + private String id; + + /** + * The name of the parent management group. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/PatchManagementGroupRequest.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/PatchManagementGroupRequest.java new file mode 100644 index 00000000000..1013903b444 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/PatchManagementGroupRequest.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Management group patch parameters. + */ +public class PatchManagementGroupRequest { + /** + * 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 displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the PatchManagementGroupRequest object itself. + */ + public PatchManagementGroupRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parentId value. + * + * @return the parentId value + */ + public String parentId() { + return this.parentId; + } + + /** + * Set the parentId value. + * + * @param parentId the parentId value to set + * @return the PatchManagementGroupRequest object itself. + */ + public PatchManagementGroupRequest withParentId(String parentId) { + this.parentId = parentId; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Reason.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Reason.java new file mode 100644 index 00000000000..8c1352fdcbb --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Reason.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Reason. + */ +public enum Reason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a Reason instance. */ + private String value; + + Reason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Reason instance. + * + * @param value the serialized value to parse. + * @return the parsed Reason object, or null if unable to parse. + */ + @JsonCreator + public static Reason fromString(String value) { + Reason[] items = Reason.values(); + for (Reason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Status.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Status.java new file mode 100644 index 00000000000..c083a75067b --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Status.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Status. + */ +public enum Status { + /** Enum value NotStarted. */ + NOT_STARTED("NotStarted"), + + /** Enum value NotStartedButGroupsExist. */ + NOT_STARTED_BUT_GROUPS_EXIST("NotStartedButGroupsExist"), + + /** Enum value Started. */ + STARTED("Started"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"), + + /** Enum value Completed. */ + COMPLETED("Completed"); + + /** The actual serialized value for a Status instance. */ + private String value; + + Status(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Status instance. + * + * @param value the serialized value to parse. + * @return the parsed Status object, or null if unable to parse. + */ + @JsonCreator + public static Status fromString(String value) { + Status[] items = Status.values(); + for (Status item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Type.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Type.java new file mode 100644 index 00000000000..5e725f60d71 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/Type.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Type. + */ +public enum Type { + /** Enum value /providers/Microsoft.Management/managementGroups. */ + PROVIDERS_MICROSOFT_MANAGEMENTMANAGEMENT_GROUPS("/providers/Microsoft.Management/managementGroups"); + + /** The actual serialized value for a Type instance. */ + private String value; + + Type(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Type instance. + * + * @param value the serialized value to parse. + * @return the parsed Type object, or null if unable to parse. + */ + @JsonCreator + public static Type fromString(String value) { + Type[] items = Type.values(); + for (Type item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityRequestInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityRequestInner.java new file mode 100644 index 00000000000..7c82d8b55f1 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityRequestInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.implementation; + +import com.microsoft.azure.management.managementgroups.Type; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Management group name availability check parameters. + */ +public class CheckNameAvailabilityRequestInner { + /** + * the name to check for availability. + */ + @JsonProperty(value = "name") + private String name; + + /** + * fully qualified resource type which includes provider namespace. + * Possible values include: + * '/providers/Microsoft.Management/managementGroup'. + */ + @JsonProperty(value = "type") + private Type type; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the CheckNameAvailabilityRequestInner object itself. + */ + public CheckNameAvailabilityRequestInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public Type type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the CheckNameAvailabilityRequestInner object itself. + */ + public CheckNameAvailabilityRequestInner withType(Type type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityResultInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 00000000000..543a3950e58 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CheckNameAvailabilityResultInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.implementation; + +import com.microsoft.azure.management.managementgroups.Reason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the result of the request to check management group name + * availability. + */ +public class CheckNameAvailabilityResultInner { + /** + * Required. True indicates name is valid and available. False indicates + * the name is invalid, unavailable, or both. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * Required if nameAvailable == false. Invalid indicates the name provided + * does not match the resource provider's naming requirements (incorrect + * length, unsupported characters, etc.) AlreadyExists indicates that the + * name is already in use and is therefore unavailable. Possible values + * include: 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private Reason reason; + + /** + * Required if nameAvailable == false. Localized. If reason == invalid, + * provide the user with the reason why the given name is invalid, and + * provide the resource naming requirements so that the user can select a + * valid name. If reason == AlreadyExists, explain that is already in use, + * and direct them to select a different name. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CreateManagementGroupRequestInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CreateManagementGroupRequestInner.java new file mode 100644 index 00000000000..4b16ff0dbc4 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/CreateManagementGroupRequestInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managementgroups.implementation; + +import java.util.List; +import com.microsoft.azure.management.managementgroups.CreateManagementGroupDetails; +import com.microsoft.azure.management.managementgroups.CreateManagementGroupChildInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Management group creation parameters. + */ +@JsonFlatten +public class CreateManagementGroupRequestInner { + /** + * 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") + private String name; + + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The friendly name of the management group. If no value is passed then + * this field will be set to the groupId. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The roles definitions associated with the management group. + */ + @JsonProperty(value = "properties.roles", access = JsonProperty.Access.WRITE_ONLY) + private List roles; + + /** + * Details. + */ + @JsonProperty(value = "properties.details") + private CreateManagementGroupDetails details; + + /** + * The list of children. + */ + @JsonProperty(value = "properties.children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the CreateManagementGroupRequestInner object itself. + */ + public CreateManagementGroupRequestInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the CreateManagementGroupRequestInner object itself. + */ + public CreateManagementGroupRequestInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the roles value. + * + * @return the roles value + */ + public List roles() { + return this.roles; + } + + /** + * Get the details value. + * + * @return the details value + */ + public CreateManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the CreateManagementGroupRequestInner object itself. + */ + public CreateManagementGroupRequestInner withDetails(CreateManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntitiesInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntitiesInner.java new file mode 100644 index 00000000000..d1192520d2d --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntitiesInner.java @@ -0,0 +1,545 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.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.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Entities. + */ +public class EntitiesInner { + /** The Retrofit service to perform REST calls. */ + private EntitiesService service; + /** The service client containing this operation class. */ + private ManagementGroupsAPIImpl client; + + /** + * Initializes an instance of EntitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EntitiesInner(Retrofit retrofit, ManagementGroupsAPIImpl client) { + this.service = retrofit.create(EntitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Entities to be + * used by Retrofit to perform actually REST calls. + */ + interface EntitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managementgroups.Entities list" }) + @POST("providers/Microsoft.Management/getEntities") + Observable> list(@Query("api-version") String apiVersion, @Query("$skiptoken") String skiptoken, @Query("$skip") Integer skip, @Query("$top") Integer top, @Query("$select") String select, @Query("$search") String search, @Query("$filter") String filter, @Query("$view") String view, @Query("groupName") String groupName, @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.Entities listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("Cache-Control") String cacheControl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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 all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EntityInfoInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EntityInfoInner> 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 skiptoken = null; + final Integer skip = null; + final Integer top = null; + final String select = null; + final String search = null; + final String filter = null; + final String view = null; + final String groupName = null; + final String cacheControl = null; + return service.list(this.client.apiVersion(), skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, 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 all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @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 skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities call. Possible values include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * @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<EntityInfoInner> object if successful. + */ + public PagedList list(final String skiptoken, final Integer skip, final Integer top, final String select, final String search, final String filter, final String view, final String groupName, final String cacheControl) { + ServiceResponse> response = listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl).toBlocking().single().body(); + } + }; + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @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 skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities call. Possible values include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * @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> listAsync(final String skiptoken, final Integer skip, final Integer top, final String select, final String search, final String filter, final String view, final String groupName, final String cacheControl, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, cacheControl); + } + }, + serviceCallback); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @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 skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities call. Possible values include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * @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<EntityInfoInner> object + */ + public Observable> listAsync(final String skiptoken, final Integer skip, final Integer top, final String select, final String search, final String filter, final String view, final String groupName, final String cacheControl) { + return listWithServiceResponseAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @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 skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities call. Possible values include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * @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<EntityInfoInner> object + */ + public Observable>> listWithServiceResponseAsync(final String skiptoken, final Integer skip, final Integer top, final String select, final String search, final String filter, final String view, final String groupName, final String cacheControl) { + return listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, 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 all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + 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. + ServiceResponse> * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + ServiceResponse> * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + ServiceResponse> * @param select This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken. + ServiceResponse> * @param search The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + ServiceResponse> * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + ServiceResponse> * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities call. Possible values include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + ServiceResponse> * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + ServiceResponse> * @param cacheControl Indicates that the request shouldn't utilize any caches. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EntityInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String skiptoken, final Integer skip, final Integer top, final String select, final String search, final String filter, final String view, final String groupName, final String cacheControl) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, 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); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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 all entities (Management Groups, Subscriptions, etc.) 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<EntityInfoInner> 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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntityInfoInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntityInfoInner.java new file mode 100644 index 00000000000..445188ce4f8 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/EntityInfoInner.java @@ -0,0 +1,281 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.implementation; + +import com.microsoft.azure.management.managementgroups.EntityParentGroupInfo; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The entity. + */ +@JsonFlatten +public class EntityInfoInner { + /** + * The fully qualified ID for the entity. 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 entity. 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 entity. 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; + + /** + * Parent. + */ + @JsonProperty(value = "properties.parent") + private EntityParentGroupInfo parent; + + /** + * Permissions. + * Possible values include: 'noaccess', 'view', 'edit', 'delete'. + */ + @JsonProperty(value = "properties.permissions") + private String permissions; + + /** + * Inherited Permissions. + * Possible values include: 'noaccess', 'view', 'edit', 'delete'. + */ + @JsonProperty(value = "properties.inheritedPermissions") + private String inheritedPermissions; + + /** + * Number of Descendants. + */ + @JsonProperty(value = "properties.numberOfDescendants") + private Integer numberOfDescendants; + + /** + * The parent display name chain from the root group to the immediate + * parent. + */ + @JsonProperty(value = "properties.parentDisplayNameChain") + private List parentDisplayNameChain; + + /** + * The parent name chain from the root group to the immediate parent. + */ + @JsonProperty(value = "properties.parentNameChain") + private List parentNameChain; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent value. + * + * @return the parent value + */ + public EntityParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent value. + * + * @param parent the parent value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParent(EntityParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the permissions value. + * + * @return the permissions value + */ + public String permissions() { + return this.permissions; + } + + /** + * Set the permissions value. + * + * @param permissions the permissions value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the inheritedPermissions value. + * + * @return the inheritedPermissions value + */ + public String inheritedPermissions() { + return this.inheritedPermissions; + } + + /** + * Set the inheritedPermissions value. + * + * @param inheritedPermissions the inheritedPermissions value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withInheritedPermissions(String inheritedPermissions) { + this.inheritedPermissions = inheritedPermissions; + return this; + } + + /** + * Get the numberOfDescendants value. + * + * @return the numberOfDescendants value + */ + public Integer numberOfDescendants() { + return this.numberOfDescendants; + } + + /** + * Set the numberOfDescendants value. + * + * @param numberOfDescendants the numberOfDescendants value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfDescendants(Integer numberOfDescendants) { + this.numberOfDescendants = numberOfDescendants; + return this; + } + + /** + * Get the parentDisplayNameChain value. + * + * @return the parentDisplayNameChain value + */ + public List parentDisplayNameChain() { + return this.parentDisplayNameChain; + } + + /** + * Set the parentDisplayNameChain value. + * + * @param parentDisplayNameChain the parentDisplayNameChain value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentDisplayNameChain(List parentDisplayNameChain) { + this.parentDisplayNameChain = parentDisplayNameChain; + return this; + } + + /** + * Get the parentNameChain value. + * + * @return the parentNameChain value + */ + public List parentNameChain() { + return this.parentNameChain; + } + + /** + * Set the parentNameChain value. + * + * @param parentNameChain the parentNameChain value to set + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentNameChain(List parentNameChain) { + this.parentNameChain = parentNameChain; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupInfoInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupInfoInner.java new file mode 100644 index 00000000000..e7c24880027 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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.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 id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupInner.java new file mode 100644 index 00000000000..5027f46ca62 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupInner.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.implementation; + +import java.util.List; +import com.microsoft.azure.management.managementgroups.ManagementGroupDetails; +import com.microsoft.azure.management.managementgroups.ManagementGroupChildInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The management group details. + */ +@JsonFlatten +public class ManagementGroupInner { + /** + * 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; + + /** + * The role definitions associated with the management group. + */ + @JsonProperty(value = "properties.roles") + private List roles; + + /** + * Details. + */ + @JsonProperty(value = "properties.details") + private ManagementGroupDetails details; + + /** + * The list of children. + */ + @JsonProperty(value = "properties.children") + private List children; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the roles value. + * + * @return the roles value + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles value. + * + * @param roles the roles value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withRoles(List roles) { + this.roles = roles; + 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 children value. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set the children value. + * + * @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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupSubscriptionsInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupSubscriptionsInner.java new file mode 100644 index 00000000000..9ace5af0cbb --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.managementgroups.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.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.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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsAPIImpl.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsAPIImpl.java new file mode 100644 index 00000000000..58578e44f25 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsAPIImpl.java @@ -0,0 +1,474 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.management.managementgroups.CheckNameAvailabilityRequest; +import com.microsoft.azure.management.managementgroups.ErrorResponseException; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the ManagementGroupsAPIImpl class. + */ +public class ManagementGroupsAPIImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private ManagementGroupsAPIService service; + /** 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 2018-01-01-preview. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2018-01-01-preview. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or 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; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or 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; + } + + /** 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 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 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; + } + + /** + * The EntitiesInner object to access its operations. + */ + private EntitiesInner entities; + + /** + * Gets the EntitiesInner object to access its operations. + * @return the EntitiesInner object. + */ + public EntitiesInner entities() { + return this.entities; + } + + /** + * 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 = "2018-03-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.entities = new EntitiesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "ManagementGroupsAPI", "2018-03-01-preview"); + } + + private void initializeService() { + service = restClient().retrofit().create(ManagementGroupsAPIService.class); + } + + /** + * The interface defining all the services for ManagementGroupsAPI to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagementGroupsAPIService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managementgroups.ManagementGroupsAPI checkNameAvailability" }) + @POST("providers/Microsoft.Management/checkNameAvailability") + Observable> checkNameAvailability(@Query("api-version") String apiVersion, @Body CheckNameAvailabilityRequest checkNameAvailabilityRequest, @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.ManagementGroupsAPI startTenantBackfill" }) + @POST("providers/Microsoft.Management/startTenantBackfill") + Observable> startTenantBackfill(@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.ManagementGroupsAPI tenantBackfillStatus" }) + @POST("providers/Microsoft.Management/tenantBackfillStatus") + Observable> tenantBackfillStatus(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check 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 CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + return checkNameAvailabilityWithServiceResponseAsync(checkNameAvailabilityRequest).toBlocking().single().body(); + } + + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check 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 checkNameAvailabilityAsync(CheckNameAvailabilityRequest checkNameAvailabilityRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(checkNameAvailabilityRequest), serviceCallback); + } + + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityAsync(CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + return checkNameAvailabilityWithServiceResponseAsync(checkNameAvailabilityRequest).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + if (checkNameAvailabilityRequest == null) { + throw new IllegalArgumentException("Parameter checkNameAvailabilityRequest is required and cannot be null."); + } + Validator.validate(checkNameAvailabilityRequest); + return service.checkNameAvailability(this.apiVersion(), checkNameAvailabilityRequest, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 TenantBackfillStatusResultInner object if successful. + */ + public TenantBackfillStatusResultInner startTenantBackfill() { + return startTenantBackfillWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startTenantBackfillAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startTenantBackfillWithServiceResponseAsync(), serviceCallback); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantBackfillStatusResultInner object + */ + public Observable startTenantBackfillAsync() { + return startTenantBackfillWithServiceResponseAsync().map(new Func1, TenantBackfillStatusResultInner>() { + @Override + public TenantBackfillStatusResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantBackfillStatusResultInner object + */ + public Observable> startTenantBackfillWithServiceResponseAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.startTenantBackfill(this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = startTenantBackfillDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse startTenantBackfillDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets tenant backfill status. + * + * @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 TenantBackfillStatusResultInner object if successful. + */ + public TenantBackfillStatusResultInner tenantBackfillStatus() { + return tenantBackfillStatusWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets tenant backfill status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture tenantBackfillStatusAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tenantBackfillStatusWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets tenant backfill status. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantBackfillStatusResultInner object + */ + public Observable tenantBackfillStatusAsync() { + return tenantBackfillStatusWithServiceResponseAsync().map(new Func1, TenantBackfillStatusResultInner>() { + @Override + public TenantBackfillStatusResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets tenant backfill status. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantBackfillStatusResultInner object + */ + public Observable> tenantBackfillStatusWithServiceResponseAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.tenantBackfillStatus(this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = tenantBackfillStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse tenantBackfillStatusDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsInner.java new file mode 100644 index 00000000000..3868997873b --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/ManagementGroupsInner.java @@ -0,0 +1,1444 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.CreateManagementGroupRequest; +import com.microsoft.azure.management.managementgroups.ErrorResponseException; +import com.microsoft.azure.management.managementgroups.PatchManagementGroupRequest; +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.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.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, @Query("$filter") String filter, @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.ManagementGroups createOrUpdate" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> createOrUpdate(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @Body CreateManagementGroupRequest createManagementGroupRequest, @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.ManagementGroups beginCreateOrUpdate" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> beginCreateOrUpdate(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @Body CreateManagementGroupRequest createManagementGroupRequest, @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.ManagementGroups update" }) + @PATCH("providers/Microsoft.Management/managementGroups/{groupId}") + Observable> update(@Path("groupId") String groupId, @Query("api-version") String apiVersion, @Header("Cache-Control") String cacheControl, @Body PatchManagementGroupRequest patchGroupRequest, @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.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.ManagementGroups beginDelete" }) + @HTTP(path = "providers/Microsoft.Management/managementGroups/{groupId}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.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 filter = null; + final String cacheControl = null; + return service.get(groupId, this.client.apiVersion(), expand, recurse, filter, 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. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') + * @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 filter, String cacheControl) { + return getWithServiceResponseAsync(groupId, expand, recurse, filter, 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. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') + * @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 filter, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(groupId, expand, recurse, filter, 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. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') + * @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 filter, String cacheControl) { + return getWithServiceResponseAsync(groupId, expand, recurse, filter, 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. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') + * @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 filter, 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, filter, 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 Object object if successful. + */ + public Object createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest).toBlocking().last().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 for the request + */ + public Observable createOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest).map(new Func1, Object>() { + @Override + public Object 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 for the request + */ + 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; + Observable> observable = service.createOrUpdate(groupId, this.client.apiVersion(), cacheControl, createManagementGroupRequest, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * 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 Object object if successful. + */ + public Object createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).toBlocking().last().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 for the request + */ + public Observable createOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return createOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).map(new Func1, Object>() { + @Override + public Object 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 for the request + */ + 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); + Observable> observable = service.createOrUpdate(groupId, this.client.apiVersion(), cacheControl, createManagementGroupRequest, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 Object object if successful. + */ + public Object beginCreateOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return beginCreateOrUpdateWithServiceResponseAsync(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 beginCreateOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 Object object + */ + public Observable beginCreateOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + return beginCreateOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest).map(new Func1, Object>() { + @Override + public Object 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 Object object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(groupId, this.client.apiVersion(), cacheControl, createManagementGroupRequest, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 Object object if successful. + */ + public Object beginCreateOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return beginCreateOrUpdateWithServiceResponseAsync(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 beginCreateOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 Object object + */ + public Observable beginCreateOrUpdateAsync(String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return beginCreateOrUpdateWithServiceResponseAsync(groupId, createManagementGroupRequest, cacheControl).map(new Func1, Object>() { + @Override + public Object 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 Object object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(groupId, this.client.apiVersion(), cacheControl, createManagementGroupRequest, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest) { + return updateWithServiceResponseAsync(groupId, patchGroupRequest).toBlocking().single().body(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(groupId, patchGroupRequest), serviceCallback); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable updateAsync(String groupId, PatchManagementGroupRequest patchGroupRequest) { + return updateWithServiceResponseAsync(groupId, patchGroupRequest).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupInner object + */ + public Observable> updateWithServiceResponseAsync(String groupId, PatchManagementGroupRequest patchGroupRequest) { + 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 (patchGroupRequest == null) { + throw new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null."); + } + Validator.validate(patchGroupRequest); + final String cacheControl = null; + return service.update(groupId, this.client.apiVersion(), cacheControl, patchGroupRequest, 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 patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest, String cacheControl) { + return updateWithServiceResponseAsync(groupId, patchGroupRequest, cacheControl).toBlocking().single().body(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(groupId, patchGroupRequest, cacheControl), serviceCallback); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest, String cacheControl) { + return updateWithServiceResponseAsync(groupId, patchGroupRequest, cacheControl).map(new Func1, ManagementGroupInner>() { + @Override + public ManagementGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch 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, PatchManagementGroupRequest patchGroupRequest, 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 (patchGroupRequest == null) { + throw new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null."); + } + Validator.validate(patchGroupRequest); + return service.update(groupId, this.client.apiVersion(), cacheControl, patchGroupRequest, 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 + * @return the OperationResultsInner object if successful. + */ + public OperationResultsInner delete(String groupId) { + return deleteWithServiceResponseAsync(groupId).toBlocking().last().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 observable for the request + */ + public Observable deleteAsync(String groupId) { + return deleteWithServiceResponseAsync(groupId).map(new Func1, OperationResultsInner>() { + @Override + public OperationResultsInner 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 observable for the request + */ + 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; + Observable> observable = service.delete(groupId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * 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 + * @return the OperationResultsInner object if successful. + */ + public OperationResultsInner delete(String groupId, String cacheControl) { + return deleteWithServiceResponseAsync(groupId, cacheControl).toBlocking().last().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 observable for the request + */ + public Observable deleteAsync(String groupId, String cacheControl) { + return deleteWithServiceResponseAsync(groupId, cacheControl).map(new Func1, OperationResultsInner>() { + @Override + public OperationResultsInner 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 observable for the request + */ + 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."); + } + Observable> observable = service.delete(groupId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 + * @return the OperationResultsInner object if successful. + */ + public OperationResultsInner beginDelete(String groupId) { + return beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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 observable to the OperationResultsInner object + */ + public Observable beginDeleteAsync(String groupId) { + return beginDeleteWithServiceResponseAsync(groupId).map(new Func1, OperationResultsInner>() { + @Override + public OperationResultsInner 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 observable to the OperationResultsInner object + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(groupId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 + * @return the OperationResultsInner object if successful. + */ + public OperationResultsInner beginDelete(String groupId, String cacheControl) { + return beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String groupId, String cacheControl, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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 observable to the OperationResultsInner object + */ + public Observable beginDeleteAsync(String groupId, String cacheControl) { + return beginDeleteWithServiceResponseAsync(groupId, cacheControl).map(new Func1, OperationResultsInner>() { + @Override + public OperationResultsInner 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 observable to the OperationResultsInner object + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(groupId, this.client.apiVersion(), cacheControl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, 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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationInner.java new file mode 100644 index 00000000000..811dc48731b --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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.implementation; + +import com.microsoft.azure.management.managementgroups.OperationDisplayProperties; +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; + + /** + * Display. + */ + @JsonProperty(value = "display") + private OperationDisplayProperties display; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplayProperties display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplayProperties display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationResultsInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationResultsInner.java new file mode 100644 index 00000000000..abf3a66ff7d --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationResultsInner.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The results of an asynchronous operation. + */ +@JsonFlatten +public class OperationResultsInner { + /** + * 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; + + /** + * Provisioning State. + * Possible values include: 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the OperationResultsInner object itself. + */ + public OperationResultsInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationsInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/OperationsInner.java new file mode 100644 index 00000000000..f8acae3fc5b --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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.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.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.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.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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/PageImpl.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/PageImpl.java new file mode 100644 index 00000000000..3119f9eae35 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/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.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/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/PatchManagementGroupRequestInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/PatchManagementGroupRequestInner.java new file mode 100644 index 00000000000..6b574d83223 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/PatchManagementGroupRequestInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Management group patch parameters. + */ +public class PatchManagementGroupRequestInner { + /** + * 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 displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the PatchManagementGroupRequestInner object itself. + */ + public PatchManagementGroupRequestInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parentId value. + * + * @return the parentId value + */ + public String parentId() { + return this.parentId; + } + + /** + * Set the parentId value. + * + * @param parentId the parentId value to set + * @return the PatchManagementGroupRequestInner object itself. + */ + public PatchManagementGroupRequestInner withParentId(String parentId) { + this.parentId = parentId; + return this; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/TenantBackfillStatusResultInner.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/TenantBackfillStatusResultInner.java new file mode 100644 index 00000000000..44c055a4c37 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/TenantBackfillStatusResultInner.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.implementation; + +import com.microsoft.azure.management.managementgroups.Status; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The tenant backfill status. + */ +public class TenantBackfillStatusResultInner { + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The status of the Tenant Backfill. Possible values include: + * 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', + * 'Cancelled', 'Completed'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the status value. + * + * @return the status value + */ + public Status status() { + return this.status; + } + +} diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/package-info.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/package-info.java new file mode 100644 index 00000000000..b0e0550f21b --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for 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.implementation; diff --git a/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/package-info.java b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/package-info.java new file mode 100644 index 00000000000..0aaf94d4ad4 --- /dev/null +++ b/azure-mgmt-managementgroups/src/main/java/com/microsoft/azure/management/managementgroups/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for 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;