diff --git a/sdk/resources/mgmt-v2018_06_01/pom.xml b/sdk/resources/mgmt-v2018_06_01/pom.xml new file mode 100644 index 0000000000000..09306bd774343 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2018_06_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-resources + 1.0.0-beta + jar + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorDefinition.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorDefinition.java new file mode 100644 index 0000000000000..2591c29d1a459 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorDefinition.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error description and code explaining why resource name is invalid. + */ +public class ErrorDefinition { + /** + * Description of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Code of the error. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Get description of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set description of the error. + * + * @param message the message value to set + * @return the ErrorDefinition object itself. + */ + public ErrorDefinition withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get code of the error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set code of the error. + * + * @param code the code value to set + * @return the ErrorDefinition object itself. + */ + public ErrorDefinition withCode(String code) { + this.code = code; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorResponse.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorResponse.java new file mode 100644 index 0000000000000..44433ade488c5 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + */ +public class ErrorResponse { + /** + * The error details. + */ + @JsonProperty(value = "error") + private ErrorDefinition error; + + /** + * Get the error details. + * + * @return the error value + */ + public ErrorDefinition error() { + return this.error; + } + + /** + * Set the error details. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDefinition error) { + this.error = error; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorResponseException.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ErrorResponseException.java new file mode 100644 index 0000000000000..9c4e46c3088e2 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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.resources.v2018_06_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.java new file mode 100644 index 0000000000000..21ff9f051cfdc --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.LocationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; + +/** + * Type representing Location. + */ +public interface Location extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the latitude value. + */ + String latitude(); + + /** + * @return the longitude value. + */ + String longitude(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java new file mode 100644 index 0000000000000..82b99b86f4e33 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java new file mode 100644 index 0000000000000..4e8cd7776b811 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java new file mode 100644 index 0000000000000..105dd1e27b099 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceName.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceName.java new file mode 100644 index 0000000000000..4091e38606b28 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceName.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Name and Type of the Resource. + */ +public class ResourceName { + /** + * Name of the resource. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of the resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get name of the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the resource. + * + * @param name the name value to set + * @return the ResourceName object itself. + */ + public ResourceName withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the resource. + * + * @param type the type value to set + * @return the ResourceName object itself. + */ + public ResourceName withType(String type) { + this.type = type; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceNameStatus.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceNameStatus.java new file mode 100644 index 0000000000000..f10cda5d430ad --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/ResourceNameStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ResourceNameStatus. + */ +public final class ResourceNameStatus extends ExpandableStringEnum { + /** Static value Allowed for ResourceNameStatus. */ + public static final ResourceNameStatus ALLOWED = fromString("Allowed"); + + /** Static value Reserved for ResourceNameStatus. */ + public static final ResourceNameStatus RESERVED = fromString("Reserved"); + + /** + * Creates or finds a ResourceNameStatus from its string representation. + * @param name a name to look for + * @return the corresponding ResourceNameStatus + */ + @JsonCreator + public static ResourceNameStatus fromString(String name) { + return fromString(name, ResourceNameStatus.class); + } + + /** + * @return known ResourceNameStatus values + */ + public static Collection values() { + return values(ResourceNameStatus.class); + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java new file mode 100644 index 0000000000000..56c5366ae0cf3 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SpendingLimit. + */ +public enum SpendingLimit { + /** Enum value On. */ + ON("On"), + + /** Enum value Off. */ + OFF("Off"), + + /** Enum value CurrentPeriodOff. */ + CURRENT_PERIOD_OFF("CurrentPeriodOff"); + + /** The actual serialized value for a SpendingLimit instance. */ + private String value; + + SpendingLimit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SpendingLimit instance. + * + * @param value the serialized value to parse. + * @return the parsed SpendingLimit object, or null if unable to parse. + */ + @JsonCreator + public static SpendingLimit fromString(String value) { + SpendingLimit[] items = SpendingLimit.values(); + for (SpendingLimit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java new file mode 100644 index 0000000000000..d1092af976d67 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.SubscriptionInner; + +/** + * Type representing Subscription. + */ +public interface Subscription extends HasInner, HasManager { + /** + * @return the authorizationSource value. + */ + String authorizationSource(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionPolicies value. + */ + SubscriptionPolicies subscriptionPolicies(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java new file mode 100644 index 0000000000000..d63439320814a --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription policies. + */ +public class SubscriptionPolicies { + /** + * The subscription location placement ID. The ID indicates which regions + * are visible for a subscription. For example, a subscription with a + * location placement Id of Public_2014-09-01 has access to Azure public + * regions. + */ + @JsonProperty(value = "locationPlacementId", access = JsonProperty.Access.WRITE_ONLY) + private String locationPlacementId; + + /** + * The subscription quota ID. + */ + @JsonProperty(value = "quotaId", access = JsonProperty.Access.WRITE_ONLY) + private String quotaId; + + /** + * The subscription spending limit. Possible values include: 'On', 'Off', + * 'CurrentPeriodOff'. + */ + @JsonProperty(value = "spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /** + * Get the subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. + * + * @return the locationPlacementId value + */ + public String locationPlacementId() { + return this.locationPlacementId; + } + + /** + * Get the subscription quota ID. + * + * @return the quotaId value + */ + public String quotaId() { + return this.quotaId; + } + + /** + * Get the subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff'. + * + * @return the spendingLimit value + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java new file mode 100644 index 0000000000000..b95c3f15619f4 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SubscriptionState. + */ +public enum SubscriptionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Warned. */ + WARNED("Warned"), + + /** Enum value PastDue. */ + PAST_DUE("PastDue"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Deleted. */ + DELETED("Deleted"); + + /** The actual serialized value for a SubscriptionState instance. */ + private String value; + + SubscriptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SubscriptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed SubscriptionState object, or null if unable to parse. + */ + @JsonCreator + public static SubscriptionState fromString(String value) { + SubscriptionState[] items = SubscriptionState.values(); + for (SubscriptionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java new file mode 100644 index 0000000000000..6235c858aad63 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2018_06_01.Location; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends HasInner { + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String subscriptionId); + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLocationsAsync(String subscriptionId); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java new file mode 100644 index 0000000000000..3243520adc823 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.TenantIdDescriptionInner; +import java.util.List; + +/** + * Type representing TenantIdDescription. + */ +public interface TenantIdDescription extends HasInner, HasManager { + /** + * @return the country value. + */ + String country(); + + /** + * @return the countryCode value. + */ + String countryCode(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the domains value. + */ + List domains(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java new file mode 100644 index 0000000000000..393eb21bb4ea1 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.TenantsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Tenants. + */ +public interface Tenants extends HasInner { + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/CheckResourceNameResultInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/CheckResourceNameResultInner.java new file mode 100644 index 0000000000000..cd3083c94e0d2 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/CheckResourceNameResultInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.ResourceNameStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource Name valid if not a reserved word, does not contain a reserved word + * and does not start with a reserved word. + */ +public class CheckResourceNameResultInner { + /** + * Name of Resource. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Type of Resource. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Is the resource name Allowed or Reserved. Possible values include: + * 'Allowed', 'Reserved'. + */ + @JsonProperty(value = "status") + private ResourceNameStatus status; + + /** + * Get name of Resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of Resource. + * + * @param name the name value to set + * @return the CheckResourceNameResultInner object itself. + */ + public CheckResourceNameResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get type of Resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type of Resource. + * + * @param type the type value to set + * @return the CheckResourceNameResultInner object itself. + */ + public CheckResourceNameResultInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get is the resource name Allowed or Reserved. Possible values include: 'Allowed', 'Reserved'. + * + * @return the status value + */ + public ResourceNameStatus status() { + return this.status; + } + + /** + * Set is the resource name Allowed or Reserved. Possible values include: 'Allowed', 'Reserved'. + * + * @param status the status value to set + * @return the CheckResourceNameResultInner object itself. + */ + public CheckResourceNameResultInner withStatus(ResourceNameStatus status) { + this.status = status; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..9dae72f0db0c5 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java new file mode 100644 index 0000000000000..81b0ce0ab5184 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Location; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class LocationImpl extends WrapperImpl implements Location { + private final ResourcesManager manager; + + LocationImpl(LocationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String latitude() { + return this.inner().latitude(); + } + + @Override + public String longitude() { + return this.inner().longitude(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java new file mode 100644 index 0000000000000..cd6c91f43c5ad --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Location information. + */ +public class LocationInner { + /** + * The fully qualified ID of the location. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the location. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The latitude of the location. + */ + @JsonProperty(value = "latitude", access = JsonProperty.Access.WRITE_ONLY) + private String latitude; + + /** + * The longitude of the location. + */ + @JsonProperty(value = "longitude", access = JsonProperty.Access.WRITE_ONLY) + private String longitude; + + /** + * Get the fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display name of the location. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the latitude of the location. + * + * @return the latitude value + */ + public String latitude() { + return this.latitude; + } + + /** + * Get the longitude of the location. + * + * @return the longitude value + */ + public String longitude() { + return this.longitude; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..3d03d139d2b7f --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..a4199715eb3a0 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..ac7b46c4d97d2 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..e87b4f4108b28 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl 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, SubscriptionClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Operations list" }) + @GET("providers/Microsoft.Resources/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..77d66fbd2a0e8 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java new file mode 100644 index 0000000000000..f7d8237cffae2 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + 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 PageImpl1 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 PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..cc1e7794a22f1 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.resources.v2018_06_01.Operations; +import com.microsoft.azure.management.resources.v2018_06_01.Subscriptions; +import com.microsoft.azure.management.resources.v2018_06_01.Tenants; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Subscriptions subscriptions; + private Tenants tenants; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials) { + return new ResourcesManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient) { + return new ResourcesManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage Tenants. + */ + public Tenants tenants() { + if (this.tenants == null) { + this.tenants = new TenantsImpl(this); + } + return this.tenants; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials) { + return ResourcesManager.authenticate(buildRestClient(credentials)); + } + } + private ResourcesManager(RestClient restClient) { + super( + restClient, + null, + new SubscriptionClientImpl(restClient)); + } +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java new file mode 100644 index 0000000000000..88310fefd5a29 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java @@ -0,0 +1,382 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.management.resources.v2018_06_01.ErrorResponseException; +import com.microsoft.azure.management.resources.v2018_06_01.ResourceName; +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 SubscriptionClientImpl class. + */ +public class SubscriptionClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private SubscriptionClientService 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; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SubscriptionClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SubscriptionClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SubscriptionClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * The TenantsInner object to access its operations. + */ + private TenantsInner tenants; + + /** + * Gets the TenantsInner object to access its operations. + * @return the TenantsInner object. + */ + public TenantsInner tenants() { + return this.tenants; + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SubscriptionClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.tenants = new TenantsInner(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, auto-generated)", super.userAgent(), "SubscriptionClient", "2018-06-01"); + } + + private void initializeService() { + service = restClient().retrofit().create(SubscriptionClientService.class); + } + + /** + * The interface defining all the services for SubscriptionClient to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.SubscriptionClient checkResourceName" }) + @POST("providers/Microsoft.Resources/checkResourceName") + Observable> checkResourceName(@Body ResourceName resourceNameDefinition, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @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 CheckResourceNameResultInner object if successful. + */ + public CheckResourceNameResultInner checkResourceName() { + return checkResourceNameWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkResourceNameAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkResourceNameWithServiceResponseAsync(), serviceCallback); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckResourceNameResultInner object + */ + public Observable checkResourceNameAsync() { + return checkResourceNameWithServiceResponseAsync().map(new Func1, CheckResourceNameResultInner>() { + @Override + public CheckResourceNameResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckResourceNameResultInner object + */ + public Observable> checkResourceNameWithServiceResponseAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + final ResourceName resourceNameDefinition = null; + return service.checkResourceName(resourceNameDefinition, this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkResourceNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @param resourceNameDefinition Resource object with values for resource name and resource type + * @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 CheckResourceNameResultInner object if successful. + */ + public CheckResourceNameResultInner checkResourceName(ResourceName resourceNameDefinition) { + return checkResourceNameWithServiceResponseAsync(resourceNameDefinition).toBlocking().single().body(); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @param resourceNameDefinition Resource object with values for resource name and resource type + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkResourceNameAsync(ResourceName resourceNameDefinition, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkResourceNameWithServiceResponseAsync(resourceNameDefinition), serviceCallback); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @param resourceNameDefinition Resource object with values for resource name and resource type + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckResourceNameResultInner object + */ + public Observable checkResourceNameAsync(ResourceName resourceNameDefinition) { + return checkResourceNameWithServiceResponseAsync(resourceNameDefinition).map(new Func1, CheckResourceNameResultInner>() { + @Override + public CheckResourceNameResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks resource name validity. + * A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word. + * + * @param resourceNameDefinition Resource object with values for resource name and resource type + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckResourceNameResultInner object + */ + public Observable> checkResourceNameWithServiceResponseAsync(ResourceName resourceNameDefinition) { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + Validator.validate(resourceNameDefinition); + return service.checkResourceName(resourceNameDefinition, this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkResourceNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkResourceNameDelegate(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/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java new file mode 100644 index 0000000000000..84f779849eca9 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Subscription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionPolicies; + +class SubscriptionImpl extends WrapperImpl implements Subscription { + private final ResourcesManager manager; + SubscriptionImpl(SubscriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String authorizationSource() { + return this.inner().authorizationSource(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public SubscriptionPolicies subscriptionPolicies() { + return this.inner().subscriptionPolicies(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java new file mode 100644 index 0000000000000..c19037428d67c --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionPolicies; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription information. + */ +public class SubscriptionInner { + /** + * The fully qualified ID for the subscription. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The subscription display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The subscription tenant ID. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The subscription state. Possible values are Enabled, Warned, PastDue, + * Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', + * 'PastDue', 'Disabled', 'Deleted'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private SubscriptionState state; + + /** + * The subscription policies. + */ + @JsonProperty(value = "subscriptionPolicies") + private SubscriptionPolicies subscriptionPolicies; + + /** + * The authorization source of the request. Valid values are one or more + * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For + * example, 'Legacy, RoleBased'. + */ + @JsonProperty(value = "authorizationSource") + private String authorizationSource; + + /** + * Get the fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscription display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the subscription tenant ID. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Get the subscription policies. + * + * @return the subscriptionPolicies value + */ + public SubscriptionPolicies subscriptionPolicies() { + return this.subscriptionPolicies; + } + + /** + * Set the subscription policies. + * + * @param subscriptionPolicies the subscriptionPolicies value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withSubscriptionPolicies(SubscriptionPolicies subscriptionPolicies) { + this.subscriptionPolicies = subscriptionPolicies; + return this; + } + + /** + * Get the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @return the authorizationSource value + */ + public String authorizationSource() { + return this.authorizationSource; + } + + /** + * Set the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @param authorizationSource the authorizationSource value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withAuthorizationSource(String authorizationSource) { + this.authorizationSource = authorizationSource; + return this; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java new file mode 100644 index 0000000000000..f6db9b50dca74 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Subscriptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.Subscription; +import java.util.List; +import com.microsoft.azure.management.resources.v2018_06_01.Location; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ResourcesManager manager; + + SubscriptionsImpl(ResourcesManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.getAsync(subscriptionId) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + SubscriptionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + private LocationImpl wrapLocationModel(LocationInner inner) { + return new LocationImpl(inner, manager()); + } + + @Override + public Observable listLocationsAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.listLocationsAsync(subscriptionId) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Location call(LocationInner inner) { + return wrapLocationModel(inner); + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java new file mode 100644 index 0000000000000..fc97957b2c483 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java @@ -0,0 +1,454 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions listLocations" }) + @GET("subscriptions/{subscriptionId}/locations") + Observable> listLocations(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions list" }) + @GET("subscriptions") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LocationInner> object if successful. + */ + public List listLocations(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listLocationsAsync(String subscriptionId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listLocationsWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable> listLocationsAsync(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable>> listLocationsWithServiceResponseAsync(String subscriptionId) { + 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.listLocations(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLocationsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLocationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionInner object if successful. + */ + public SubscriptionInner get(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable getAsync(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).map(new Func1, SubscriptionInner>() { + @Override + public SubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String subscriptionId) { + 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.get(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a 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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java new file mode 100644 index 0000000000000..a1343470ed7d5 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.TenantIdDescription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class TenantIdDescriptionImpl extends WrapperImpl implements TenantIdDescription { + private final ResourcesManager manager; + TenantIdDescriptionImpl(TenantIdDescriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String country() { + return this.inner().country(); + } + + @Override + public String countryCode() { + return this.inner().countryCode(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List domains() { + return this.inner().domains(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java new file mode 100644 index 0000000000000..99c5d6b6ac54f --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tenant Id information. + */ +public class TenantIdDescriptionInner { + /** + * The fully qualified ID of the tenant. For example, + * /tenants/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Country/region name of the address for the tenant. + */ + @JsonProperty(value = "country", access = JsonProperty.Access.WRITE_ONLY) + private String country; + + /** + * Country/region abbreviation for the tenant. + */ + @JsonProperty(value = "countryCode", access = JsonProperty.Access.WRITE_ONLY) + private String countryCode; + + /** + * The display name of the tenant. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The list of domains for the tenant. + */ + @JsonProperty(value = "domains", access = JsonProperty.Access.WRITE_ONLY) + private List domains; + + /** + * Get the fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get country/region name of the address for the tenant. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Get country/region abbreviation for the tenant. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Get the display name of the tenant. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the list of domains for the tenant. + * + * @return the domains value + */ + public List domains() { + return this.domains; + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java new file mode 100644 index 0000000000000..9c7e1ff89db87 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Tenants; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.TenantIdDescription; + +class TenantsImpl extends WrapperImpl implements Tenants { + private final ResourcesManager manager; + + TenantsImpl(ResourcesManager manager) { + super(manager.inner().tenants()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + TenantsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TenantIdDescription call(TenantIdDescriptionInner inner) { + return new TenantIdDescriptionImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java new file mode 100644 index 0000000000000..3d66cf9bb7404 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tenants. + */ +public class TenantsInner { + /** The Retrofit service to perform REST calls. */ + private TenantsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of TenantsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(TenantsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tenants to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Tenants list" }) + @GET("tenants") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Tenants listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @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<TenantIdDescriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @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<TenantIdDescriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java new file mode 100644 index 0000000000000..345300aba97fc --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2018_06_01.implementation; diff --git a/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java new file mode 100644 index 0000000000000..7a28dc3f0e5e6 --- /dev/null +++ b/sdk/resources/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2018_06_01;