diff --git a/eng/mgmt/api-specs.json b/eng/mgmt/api-specs.json index 8a7ec28d1fc0..e75afdddce60 100644 --- a/eng/mgmt/api-specs.json +++ b/eng/mgmt/api-specs.json @@ -327,6 +327,10 @@ "\"moduleName\"": "\"StreamAnalytics\"" } }, + "subscription/resource-manager": { + "source": "specification/subscription/resource-manager/readme.md", + "args": "--multiapi --fluent" + }, "support/resource-manager": { "source": "specification/support/resource-manager/readme.md", "args": "--multiapi --fluent" diff --git a/sdk/subscription/ci.mgmt.yml b/sdk/subscription/ci.mgmt.yml new file mode 100644 index 000000000000..c27318bf32a7 --- /dev/null +++ b/sdk/subscription/ci.mgmt.yml @@ -0,0 +1,32 @@ +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + +trigger: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ + +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-management.yml + parameters: + ServiceDirectory: subscription diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/pom.xml b/sdk/subscription/mgmt-v2019_10_01_preview/pom.xml new file mode 100644 index 000000000000..bba480236916 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.subscription.v2019_10_01_preview + + com.microsoft.azure + azure-arm-parent + 1.3.0 + ../../../pom.management.xml + + azure-mgmt-billing + 1.0.0-beta + jar + Microsoft Azure SDK for Billing Management + This package contains Microsoft Billing 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/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/AdPrincipal.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/AdPrincipal.java new file mode 100644 index 000000000000..338b0c684bd1 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/AdPrincipal.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Active Directory Principal who’ll get owner access on the new subscription. + */ +public class AdPrincipal { + /** + * Object id of the Principal. + */ + @JsonProperty(value = "objectId", required = true) + private String objectId; + + /** + * Get object id of the Principal. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set object id of the Principal. + * + * @param objectId the objectId value to set + * @return the AdPrincipal object itself. + */ + public AdPrincipal withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/CanceledSubscriptionId.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/CanceledSubscriptionId.java new file mode 100644 index 000000000000..3b2cacfb6e3c --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/CanceledSubscriptionId.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.CanceledSubscriptionIdInner; + +/** + * Type representing CanceledSubscriptionId. + */ +public interface CanceledSubscriptionId extends HasInner, HasManager { + /** + * @return the value value. + */ + String value(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/EnabledSubscriptionId.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/EnabledSubscriptionId.java new file mode 100644 index 000000000000..3160923843e9 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/EnabledSubscriptionId.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.EnabledSubscriptionIdInner; + +/** + * Type representing EnabledSubscriptionId. + */ +public interface EnabledSubscriptionId extends HasInner, HasManager { + /** + * @return the value value. + */ + String value(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponse.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponse.java new file mode 100644 index 000000000000..d72d936ee314 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponse.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponseException.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponseException.java new file mode 100644 index 000000000000..dbc5484a13f0 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernCspSubscriptionCreationParameters.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernCspSubscriptionCreationParameters.java new file mode 100644 index 000000000000..c618ea1618ee --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernCspSubscriptionCreationParameters.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters required to create a new CSP subscription. + */ +public class ModernCspSubscriptionCreationParameters { + /** + * The friendly name of the subscription. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * The SKU ID of the Azure plan. Azure plan determines the pricing and + * service-level agreement of the subscription. Use 001 for Microsoft + * Azure Plan and 002 for Microsoft Azure Plan for DevTest. + */ + @JsonProperty(value = "skuId", required = true) + private String skuId; + + /** + * Reseller ID, basically MPN Id. + */ + @JsonProperty(value = "resellerId") + private String resellerId; + + /** + * Get the friendly name of the subscription. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the subscription. + * + * @param displayName the displayName value to set + * @return the ModernCspSubscriptionCreationParameters object itself. + */ + public ModernCspSubscriptionCreationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. + * + * @param skuId the skuId value to set + * @return the ModernCspSubscriptionCreationParameters object itself. + */ + public ModernCspSubscriptionCreationParameters withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get reseller ID, basically MPN Id. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Set reseller ID, basically MPN Id. + * + * @param resellerId the resellerId value to set + * @return the ModernCspSubscriptionCreationParameters object itself. + */ + public ModernCspSubscriptionCreationParameters withResellerId(String resellerId) { + this.resellerId = resellerId; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernSubscriptionCreationParameters.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernSubscriptionCreationParameters.java new file mode 100644 index 000000000000..26d2ac1b0f90 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/ModernSubscriptionCreationParameters.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters required to create a new subscription. + */ +public class ModernSubscriptionCreationParameters { + /** + * The friendly name of the subscription. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * The SKU ID of the Azure plan. Azure plan determines the pricing and + * service-level agreement of the subscription. Use 001 for Microsoft + * Azure Plan and 002 for Microsoft Azure Plan for DevTest. + */ + @JsonProperty(value = "skuId", required = true) + private String skuId; + + /** + * If set, the cost center will show up on the Azure usage and charges + * file. + */ + @JsonProperty(value = "costCenter") + private String costCenter; + + /** + * If specified, the AD principal will get owner access to the + * subscription, along with the user who is performing the create + * subscription operation. + */ + @JsonProperty(value = "owner") + private AdPrincipal owner; + + /** + * The identifier of the management group to which this subscription will + * be associated. + */ + @JsonProperty(value = "managementGroupId") + private String managementGroupId; + + /** + * Additional, untyped parameters to support custom subscription creation + * scenarios. + */ + @JsonProperty(value = "additionalParameters") + private Map additionalParameters; + + /** + * Get the friendly name of the subscription. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the friendly name of the subscription. + * + * @param displayName the displayName value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. + * + * @param skuId the skuId value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get if set, the cost center will show up on the Azure usage and charges file. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set if set, the cost center will show up on the Azure usage and charges file. + * + * @param costCenter the costCenter value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get if specified, the AD principal will get owner access to the subscription, along with the user who is performing the create subscription operation. + * + * @return the owner value + */ + public AdPrincipal owner() { + return this.owner; + } + + /** + * Set if specified, the AD principal will get owner access to the subscription, along with the user who is performing the create subscription operation. + * + * @param owner the owner value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withOwner(AdPrincipal owner) { + this.owner = owner; + return this; + } + + /** + * Get the identifier of the management group to which this subscription will be associated. + * + * @return the managementGroupId value + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the identifier of the management group to which this subscription will be associated. + * + * @param managementGroupId the managementGroupId value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get additional, untyped parameters to support custom subscription creation scenarios. + * + * @return the additionalParameters value + */ + public Map additionalParameters() { + return this.additionalParameters; + } + + /** + * Set additional, untyped parameters to support custom subscription creation scenarios. + * + * @param additionalParameters the additionalParameters value to set + * @return the ModernSubscriptionCreationParameters object itself. + */ + public ModernSubscriptionCreationParameters withAdditionalParameters(Map additionalParameters) { + this.additionalParameters = additionalParameters; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OfferType.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OfferType.java new file mode 100644 index 000000000000..9caaa7f46a2e --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OfferType.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.subscription.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OfferType. + */ +public final class OfferType extends ExpandableStringEnum { + /** Static value MS-AZR-0017P for OfferType. */ + public static final OfferType MS_AZR_0017P = fromString("MS-AZR-0017P"); + + /** Static value MS-AZR-0148P for OfferType. */ + public static final OfferType MS_AZR_0148P = fromString("MS-AZR-0148P"); + + /** + * Creates or finds a OfferType from its string representation. + * @param name a name to look for + * @return the corresponding OfferType + */ + @JsonCreator + public static OfferType fromString(String name) { + return fromString(name, OfferType.class); + } + + /** + * @return known OfferType values + */ + public static Collection values() { + return values(OfferType.class); + } +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationDisplay.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationDisplay.java new file mode 100644 index 000000000000..8af062a00a1d --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationDisplay.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Subscription. + */ + @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; + + /** + * Get service provider: Microsoft.Subscription. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Subscription. + * + * @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; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationListResult.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationListResult.java new file mode 100644 index 000000000000..b88ffee9defb --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/OperationListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.OperationListResultInner; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.OperationInner; +import java.util.List; + +/** + * Type representing OperationListResult. + */ +public interface OperationListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Operations.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Operations.java new file mode 100644 index 000000000000..965fab462f95 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Subscription API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/RenamedSubscriptionId.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/RenamedSubscriptionId.java new file mode 100644 index 000000000000..c48b097aad73 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/RenamedSubscriptionId.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.RenamedSubscriptionIdInner; + +/** + * Type representing RenamedSubscriptionId. + */ +public interface RenamedSubscriptionId extends HasInner, HasManager { + /** + * @return the value value. + */ + String value(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateCspSubscriptionHeaders.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateCspSubscriptionHeaders.java new file mode 100644 index 000000000000..54ec991ca488 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateCspSubscriptionHeaders.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateCspSubscription operation. + */ +public class SubscriptionCreateCspSubscriptionHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the SubscriptionCreateCspSubscriptionHeaders object itself. + */ + public SubscriptionCreateCspSubscriptionHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the SubscriptionCreateCspSubscriptionHeaders object itself. + */ + public SubscriptionCreateCspSubscriptionHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionHeaders.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionHeaders.java new file mode 100644 index 000000000000..f66254412edb --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionHeaders.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateSubscription operation. + */ +public class SubscriptionCreateSubscriptionHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the SubscriptionCreateSubscriptionHeaders object itself. + */ + public SubscriptionCreateSubscriptionHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the SubscriptionCreateSubscriptionHeaders object itself. + */ + public SubscriptionCreateSubscriptionHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.java new file mode 100644 index 000000000000..e28a31406b9b --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateSubscriptionInEnrollmentAccount operation. + */ +public class SubscriptionCreateSubscriptionInEnrollmentAccountHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the SubscriptionCreateSubscriptionInEnrollmentAccountHeaders object itself. + */ + public SubscriptionCreateSubscriptionInEnrollmentAccountHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the SubscriptionCreateSubscriptionInEnrollmentAccountHeaders object itself. + */ + public SubscriptionCreateSubscriptionInEnrollmentAccountHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationParameters.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationParameters.java new file mode 100644 index 000000000000..ddbb0ebab561 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationParameters.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription Creation Parameters required to create a new Azure + * subscription. + */ +public class SubscriptionCreationParameters { + /** + * The display name of the subscription. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The Management Group Id. + */ + @JsonProperty(value = "managementGroupId") + private String managementGroupId; + + /** + * The list of principals that should be granted Owner access on the + * subscription. Principals should be of type User, Service Principal or + * Security Group. + */ + @JsonProperty(value = "owners") + private List owners; + + /** + * The offer type of the subscription. For example, MS-AZR-0017P + * (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are + * available. Only valid when creating a subscription in a enrollment + * account scope. Possible values include: 'MS-AZR-0017P', 'MS-AZR-0148P'. + */ + @JsonProperty(value = "offerType") + private OfferType offerType; + + /** + * Additional, untyped parameters to support custom subscription creation + * scenarios. + */ + @JsonProperty(value = "additionalParameters") + private Map additionalParameters; + + /** + * Get the display name of the subscription. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the subscription. + * + * @param displayName the displayName value to set + * @return the SubscriptionCreationParameters object itself. + */ + public SubscriptionCreationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the Management Group Id. + * + * @return the managementGroupId value + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the Management Group Id. + * + * @param managementGroupId the managementGroupId value to set + * @return the SubscriptionCreationParameters object itself. + */ + public SubscriptionCreationParameters withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the list of principals that should be granted Owner access on the subscription. Principals should be of type User, Service Principal or Security Group. + * + * @return the owners value + */ + public List owners() { + return this.owners; + } + + /** + * Set the list of principals that should be granted Owner access on the subscription. Principals should be of type User, Service Principal or Security Group. + * + * @param owners the owners value to set + * @return the SubscriptionCreationParameters object itself. + */ + public SubscriptionCreationParameters withOwners(List owners) { + this.owners = owners; + return this; + } + + /** + * Get the offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available. Only valid when creating a subscription in a enrollment account scope. Possible values include: 'MS-AZR-0017P', 'MS-AZR-0148P'. + * + * @return the offerType value + */ + public OfferType offerType() { + return this.offerType; + } + + /** + * Set the offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available. Only valid when creating a subscription in a enrollment account scope. Possible values include: 'MS-AZR-0017P', 'MS-AZR-0148P'. + * + * @param offerType the offerType value to set + * @return the SubscriptionCreationParameters object itself. + */ + public SubscriptionCreationParameters withOfferType(OfferType offerType) { + this.offerType = offerType; + return this; + } + + /** + * Get additional, untyped parameters to support custom subscription creation scenarios. + * + * @return the additionalParameters value + */ + public Map additionalParameters() { + return this.additionalParameters; + } + + /** + * Set additional, untyped parameters to support custom subscription creation scenarios. + * + * @param additionalParameters the additionalParameters value to set + * @return the SubscriptionCreationParameters object itself. + */ + public SubscriptionCreationParameters withAdditionalParameters(Map additionalParameters) { + this.additionalParameters = additionalParameters; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationResult.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationResult.java new file mode 100644 index 000000000000..99003c2d22f5 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionCreationResult.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.SubscriptionCreationResultInner; + +/** + * Type representing SubscriptionCreationResult. + */ +public interface SubscriptionCreationResult extends HasInner, HasManager { + /** + * @return the subscriptionLink value. + */ + String subscriptionLink(); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionName.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionName.java new file mode 100644 index 000000000000..ec61398b4666 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionName.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The new name of the subscription. + */ +public class SubscriptionName { + /** + * New subscription name. + */ + @JsonProperty(value = "subscriptionName") + private String subscriptionName; + + /** + * Get new subscription name. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Set new subscription name. + * + * @param subscriptionName the subscriptionName value to set + * @return the SubscriptionName object itself. + */ + public SubscriptionName withSubscriptionName(String subscriptionName) { + this.subscriptionName = subscriptionName; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperationGetHeaders.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperationGetHeaders.java new file mode 100644 index 000000000000..7e19cbe9b2c2 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperationGetHeaders.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.subscription.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class SubscriptionOperationGetHeaders { + /** + * The URL where the status of the asynchronous operation can be checked. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the URL where the status of the asynchronous operation can be checked. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL where the status of the asynchronous operation can be checked. + * + * @param location the location value to set + * @return the SubscriptionOperationGetHeaders object itself. + */ + public SubscriptionOperationGetHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the SubscriptionOperationGetHeaders object itself. + */ + public SubscriptionOperationGetHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperations.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperations.java new file mode 100644 index 000000000000..be556bf376f0 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/SubscriptionOperations.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation.SubscriptionOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SubscriptionOperations. + */ +public interface SubscriptionOperations extends HasInner { + /** + * Get the status of the pending Microsoft.Subscription API operations. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String operationId); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Subscriptions.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Subscriptions.java new file mode 100644 index 000000000000..bf9dc5f32bed --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/Subscriptions.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview; + +import rx.Observable; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions { + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body); + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body); + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body); + + /** + * The operation to cancel a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable cancelAsync(String subscriptionId); + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable renameAsync(String subscriptionId); + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable enableAsync(String subscriptionId); + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/BillingManager.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/BillingManager.java new file mode 100644 index 000000000000..57a84aacb8bc --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/BillingManager.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.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.Subscriptions; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionOperations; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Billing resource management. + */ +public final class BillingManager extends ManagerCore { + private Subscriptions subscriptions; + private SubscriptionOperations subscriptionOperations; + private Operations operations; + /** + * Get a Configurable instance that can be used to create BillingManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new BillingManager.ConfigurableImpl(); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param credentials the credentials to use + * @return the BillingManager + */ + public static BillingManager authenticate(AzureTokenCredentials credentials) { + return new BillingManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the BillingManager + */ + public static BillingManager authenticate(RestClient restClient) { + return new BillingManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of BillingManager that exposes Billing management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Billing management API entry points that work across subscriptions + */ + BillingManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @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 SubscriptionOperations. + */ + public SubscriptionOperations subscriptionOperations() { + if (this.subscriptionOperations == null) { + this.subscriptionOperations = new SubscriptionOperationsImpl(this); + } + return this.subscriptionOperations; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public BillingManager authenticate(AzureTokenCredentials credentials) { + return BillingManager.authenticate(buildRestClient(credentials)); + } + } + private BillingManager(RestClient restClient) { + super( + restClient, + null, + new SubscriptionClientImpl(restClient)); + } +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdImpl.java new file mode 100644 index 000000000000..882cbf0c955f --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.CanceledSubscriptionId; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class CanceledSubscriptionIdImpl extends WrapperImpl implements CanceledSubscriptionId { + private final BillingManager manager; + CanceledSubscriptionIdImpl(CanceledSubscriptionIdInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String value() { + return this.inner().value(); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdInner.java new file mode 100644 index 000000000000..e25b459165d8 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/CanceledSubscriptionIdInner.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ID of the canceled subscription. + */ +public class CanceledSubscriptionIdInner { + /** + * The ID of the canceled subscription. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the ID of the canceled subscription. + * + * @return the value value + */ + public String value() { + return this.value; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdImpl.java new file mode 100644 index 000000000000..5f20630a7f4d --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.EnabledSubscriptionId; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class EnabledSubscriptionIdImpl extends WrapperImpl implements EnabledSubscriptionId { + private final BillingManager manager; + EnabledSubscriptionIdImpl(EnabledSubscriptionIdInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String value() { + return this.inner().value(); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdInner.java new file mode 100644 index 000000000000..385402832aa8 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdInner.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ID of the subscriptions that is being enabled. + */ +public class EnabledSubscriptionIdInner { + /** + * The ID of the subscriptions that is being enabled. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the ID of the subscriptions that is being enabled. + * + * @return the value value + */ + public String value() { + return this.value; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/IdParsingUtils.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ebf951acf814 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..74cb7be32c9c --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/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.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API 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/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultImpl.java new file mode 100644 index 000000000000..45d8ad597c8b --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultImpl.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.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.OperationListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class OperationListResultImpl extends WrapperImpl implements OperationListResult { + private final BillingManager manager; + OperationListResultImpl(OperationListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultInner.java new file mode 100644 index 000000000000..67ab4a6a167f --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationListResultInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the request to list operations. It contains a list of operations + * and a URL link to get the next set of results. + */ +public class OperationListResultInner { + /** + * List of operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get list of operations. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of operations. + * + * @param value the value value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get uRL to get the next set of operation list results if there are any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set uRL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..2d03ea68fd96 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.OperationListResult; + +class OperationsImpl extends WrapperImpl implements Operations { + private final BillingManager manager; + + OperationsImpl(BillingManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .map(new Func1() { + @Override + public OperationListResult call(OperationListResultInner inner) { + return new OperationListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..265b72eb5bff --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/OperationsInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.subscription.v2019_10_01_preview.Operations list" }) + @GET("providers/Microsoft.Subscription/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Subscription API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationListResultInner object if successful. + */ + public OperationListResultInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists all of the available Microsoft.Subscription 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 ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all of the available Microsoft.Subscription API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationListResultInner>() { + @Override + public OperationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Subscription API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable> listWithServiceResponseAsync() { + 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 clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdImpl.java new file mode 100644 index 000000000000..14eabc0865e2 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.RenamedSubscriptionId; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class RenamedSubscriptionIdImpl extends WrapperImpl implements RenamedSubscriptionId { + private final BillingManager manager; + RenamedSubscriptionIdImpl(RenamedSubscriptionIdInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String value() { + return this.inner().value(); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdInner.java new file mode 100644 index 000000000000..1a21ce6000ea --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/RenamedSubscriptionIdInner.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ID of the subscriptions that is being renamed. + */ +public class RenamedSubscriptionIdInner { + /** + * The ID of the subscriptions that is being renamed. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the ID of the subscriptions that is being renamed. + * + * @return the value value + */ + public String value() { + return this.value; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionClientImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionClientImpl.java new file mode 100644 index 000000000000..f51e001615f3 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionClientImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SubscriptionClientImpl class. + */ +public class SubscriptionClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. Current version is 2019-10-01-preview. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. Current version is 2019-10-01-preview. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public 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 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 SubscriptionOperationsInner object to access its operations. + */ + private SubscriptionOperationsInner subscriptionOperations; + + /** + * Gets the SubscriptionOperationsInner object to access its operations. + * @return the SubscriptionOperationsInner object. + */ + public SubscriptionOperationsInner subscriptionOperations() { + return this.subscriptionOperations; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of 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 = "2019-10-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.subscriptionOperations = new SubscriptionOperationsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "SubscriptionClient", "2019-10-01-preview"); + } +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultImpl.java new file mode 100644 index 000000000000..a2f58b1f7541 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreationResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SubscriptionCreationResultImpl extends WrapperImpl implements SubscriptionCreationResult { + private final BillingManager manager; + SubscriptionCreationResultImpl(SubscriptionCreationResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String subscriptionLink() { + return this.inner().subscriptionLink(); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultInner.java new file mode 100644 index 000000000000..95e25ac76410 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionCreationResultInner.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.subscription.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The created subscription object. + */ +public class SubscriptionCreationResultInner { + /** + * The link to the new subscription. Use this link to check the status of + * subscription creation operation. + */ + @JsonProperty(value = "subscriptionLink") + private String subscriptionLink; + + /** + * Get the link to the new subscription. Use this link to check the status of subscription creation operation. + * + * @return the subscriptionLink value + */ + public String subscriptionLink() { + return this.subscriptionLink; + } + + /** + * Set the link to the new subscription. Use this link to check the status of subscription creation operation. + * + * @param subscriptionLink the subscriptionLink value to set + * @return the SubscriptionCreationResultInner object itself. + */ + public SubscriptionCreationResultInner withSubscriptionLink(String subscriptionLink) { + this.subscriptionLink = subscriptionLink; + return this; + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsImpl.java new file mode 100644 index 000000000000..9af1a0402d82 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionOperations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreationResult; + +class SubscriptionOperationsImpl extends WrapperImpl implements SubscriptionOperations { + private final BillingManager manager; + + SubscriptionOperationsImpl(BillingManager manager) { + super(manager.inner().subscriptionOperations()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String operationId) { + SubscriptionOperationsInner client = this.inner(); + return client.getAsync(operationId) + .map(new Func1() { + @Override + public SubscriptionCreationResult call(SubscriptionCreationResultInner inner) { + return new SubscriptionCreationResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsInner.java new file mode 100644 index 000000000000..19e52c0e0bb8 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionOperationsInner.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionOperationGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SubscriptionOperations. + */ +public class SubscriptionOperationsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionOperationsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of SubscriptionOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionOperationsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(SubscriptionOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionOperations get" }) + @GET("providers/Microsoft.Subscription/subscriptionOperations/{operationId}") + Observable> get(@Path("operationId") String operationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the status of the pending Microsoft.Subscription API operations. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @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 SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner get(String operationId) { + return getWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Get the status of the pending Microsoft.Subscription API operations. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @param serviceCallback 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 operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Get the status of the pending Microsoft.Subscription API operations. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable getAsync(String operationId) { + return getWithServiceResponseAsync(operationId).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the status of the pending Microsoft.Subscription API operations. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable> getWithServiceResponseAsync(String operationId) { + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, SubscriptionOperationGetHeaders.class); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsImpl.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsImpl.java new file mode 100644 index 000000000000..269eb759b1ad --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.Subscriptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreationResult; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ModernSubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ModernCspSubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.CanceledSubscriptionId; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.RenamedSubscriptionId; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.EnabledSubscriptionId; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final BillingManager manager; + + SubscriptionsImpl(BillingManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body) { + SubscriptionsInner client = this.inner(); + return client.createSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body) + .map(new Func1() { + @Override + public SubscriptionCreationResult call(SubscriptionCreationResultInner inner) { + return new SubscriptionCreationResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable createSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + SubscriptionsInner client = this.inner(); + return client.createSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body) + .map(new Func1() { + @Override + public SubscriptionCreationResult call(SubscriptionCreationResultInner inner) { + return new SubscriptionCreationResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable createCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + SubscriptionsInner client = this.inner(); + return client.createCspSubscriptionAsync(billingAccountName, customerName, body) + .map(new Func1() { + @Override + public SubscriptionCreationResult call(SubscriptionCreationResultInner inner) { + return new SubscriptionCreationResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable cancelAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.cancelAsync(subscriptionId) + .map(new Func1() { + @Override + public CanceledSubscriptionId call(CanceledSubscriptionIdInner inner) { + return new CanceledSubscriptionIdImpl(inner, manager()); + } + }); + } + + @Override + public Observable renameAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.renameAsync(subscriptionId) + .map(new Func1() { + @Override + public RenamedSubscriptionId call(RenamedSubscriptionIdInner inner) { + return new RenamedSubscriptionIdImpl(inner, manager()); + } + }); + } + + @Override + public Observable enableAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.enableAsync(subscriptionId) + .map(new Func1() { + @Override + public EnabledSubscriptionId call(EnabledSubscriptionIdInner inner) { + return new EnabledSubscriptionIdImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsInner.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsInner.java new file mode 100644 index 000000000000..b56326140b26 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/SubscriptionsInner.java @@ -0,0 +1,906 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ModernCspSubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.ModernSubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreateCspSubscriptionHeaders; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreateSubscriptionHeaders; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreateSubscriptionInEnrollmentAccountHeaders; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionCreationParameters; +import com.microsoft.azure.management.subscription.v2019_10_01_preview.SubscriptionName; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.subscription.v2019_10_01_preview.Subscriptions createSubscriptionInEnrollmentAccount" }) + @POST("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription") + Observable> createSubscriptionInEnrollmentAccount(@Path("enrollmentAccountName") String enrollmentAccountName, @Query("api-version") String apiVersion, @Body SubscriptionCreationParameters body, @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.subscription.v2019_10_01_preview.Subscriptions beginCreateSubscriptionInEnrollmentAccount" }) + @POST("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription") + Observable> beginCreateSubscriptionInEnrollmentAccount(@Path("enrollmentAccountName") String enrollmentAccountName, @Query("api-version") String apiVersion, @Body SubscriptionCreationParameters body, @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.subscription.v2019_10_01_preview.Subscriptions cancel" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel") + Observable> cancel(@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.subscription.v2019_10_01_preview.Subscriptions rename" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename") + Observable> rename(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SubscriptionName body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.subscription.v2019_10_01_preview.Subscriptions enable" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable") + Observable> enable(@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.subscription.v2019_10_01_preview.Subscriptions createSubscription" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription") + Observable> createSubscription(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body ModernSubscriptionCreationParameters body, @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.subscription.v2019_10_01_preview.Subscriptions beginCreateSubscription" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription") + Observable> beginCreateSubscription(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body ModernSubscriptionCreationParameters body, @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.subscription.v2019_10_01_preview.Subscriptions createCspSubscription" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription") + Observable> createCspSubscription(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Body ModernCspSubscriptionCreationParameters body, @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.subscription.v2019_10_01_preview.Subscriptions beginCreateCspSubscription" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription") + Observable> beginCreateCspSubscription(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Body ModernCspSubscriptionCreationParameters body, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner createSubscriptionInEnrollmentAccount(String enrollmentAccountName, SubscriptionCreationParameters body) { + return createSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body).toBlocking().last().body(); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body), serviceCallback); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body) { + return createSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createSubscriptionInEnrollmentAccountWithServiceResponseAsync(String enrollmentAccountName, SubscriptionCreationParameters body) { + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createSubscriptionInEnrollmentAccount(enrollmentAccountName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.class); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner beginCreateSubscriptionInEnrollmentAccount(String enrollmentAccountName, SubscriptionCreationParameters body) { + return beginCreateSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body).toBlocking().single().body(); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body), serviceCallback); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable beginCreateSubscriptionInEnrollmentAccountAsync(String enrollmentAccountName, SubscriptionCreationParameters body) { + return beginCreateSubscriptionInEnrollmentAccountWithServiceResponseAsync(enrollmentAccountName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an Azure subscription. + * + * @param enrollmentAccountName The name of the enrollment account to which the subscription will be billed. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable> beginCreateSubscriptionInEnrollmentAccountWithServiceResponseAsync(String enrollmentAccountName, SubscriptionCreationParameters body) { + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateSubscriptionInEnrollmentAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateSubscriptionInEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.class); + } + + /** + * The operation to cancel a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CanceledSubscriptionIdInner object if successful. + */ + public CanceledSubscriptionIdInner cancel(String subscriptionId) { + return cancelWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * The operation to cancel a subscription. + * + * @param subscriptionId Subscription Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture cancelAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * The operation to cancel a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CanceledSubscriptionIdInner object + */ + public Observable cancelAsync(String subscriptionId) { + return cancelWithServiceResponseAsync(subscriptionId).map(new Func1, CanceledSubscriptionIdInner>() { + @Override + public CanceledSubscriptionIdInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to cancel a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CanceledSubscriptionIdInner object + */ + public Observable> cancelWithServiceResponseAsync(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.cancel(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RenamedSubscriptionIdInner object if successful. + */ + public RenamedSubscriptionIdInner rename(String subscriptionId) { + return renameWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture renameAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RenamedSubscriptionIdInner object + */ + public Observable renameAsync(String subscriptionId) { + return renameWithServiceResponseAsync(subscriptionId).map(new Func1, RenamedSubscriptionIdInner>() { + @Override + public RenamedSubscriptionIdInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RenamedSubscriptionIdInner object + */ + public Observable> renameWithServiceResponseAsync(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."); + } + final String subscriptionName = null; + SubscriptionName body = new SubscriptionName(); + body.withSubscriptionName(null); + return service.rename(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @param subscriptionName New subscription name + * @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 RenamedSubscriptionIdInner object if successful. + */ + public RenamedSubscriptionIdInner rename(String subscriptionId, String subscriptionName) { + return renameWithServiceResponseAsync(subscriptionId, subscriptionName).toBlocking().single().body(); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @param subscriptionName New subscription name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture renameAsync(String subscriptionId, String subscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(subscriptionId, subscriptionName), serviceCallback); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @param subscriptionName New subscription name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RenamedSubscriptionIdInner object + */ + public Observable renameAsync(String subscriptionId, String subscriptionName) { + return renameWithServiceResponseAsync(subscriptionId, subscriptionName).map(new Func1, RenamedSubscriptionIdInner>() { + @Override + public RenamedSubscriptionIdInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to rename a subscription. + * + * @param subscriptionId Subscription Id. + * @param subscriptionName New subscription name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RenamedSubscriptionIdInner object + */ + public Observable> renameWithServiceResponseAsync(String subscriptionId, String subscriptionName) { + 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."); + } + SubscriptionName body = new SubscriptionName(); + body.withSubscriptionName(subscriptionName); + return service.rename(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse renameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EnabledSubscriptionIdInner object if successful. + */ + public EnabledSubscriptionIdInner enable(String subscriptionId) { + return enableWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnabledSubscriptionIdInner object + */ + public Observable enableAsync(String subscriptionId) { + return enableWithServiceResponseAsync(subscriptionId).map(new Func1, EnabledSubscriptionIdInner>() { + @Override + public EnabledSubscriptionIdInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnabledSubscriptionIdInner object + */ + public Observable> enableWithServiceResponseAsync(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.enable(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner createSubscription(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + return createSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body).toBlocking().last().body(); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body), serviceCallback); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + return createSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createSubscriptionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createSubscription(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), SubscriptionCreateSubscriptionHeaders.class); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner beginCreateSubscription(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + return beginCreateSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body).toBlocking().single().body(); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body), serviceCallback); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable beginCreateSubscriptionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + return beginCreateSubscriptionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you want to create the subscription. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable> beginCreateSubscriptionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, ModernSubscriptionCreationParameters body) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateSubscription(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SubscriptionCreateSubscriptionHeaders.class); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner createCspSubscription(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + return createCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body).toBlocking().last().body(); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body), serviceCallback); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + return createCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createCspSubscriptionWithServiceResponseAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + Observable> observable = service.createCspSubscription(billingAccountName, customerName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), SubscriptionCreateCspSubscriptionHeaders.class); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionCreationResultInner object if successful. + */ + public SubscriptionCreationResultInner beginCreateCspSubscription(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + return beginCreateCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body).toBlocking().single().body(); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body), serviceCallback); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable beginCreateCspSubscriptionAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + return beginCreateCspSubscriptionWithServiceResponseAsync(billingAccountName, customerName, body).map(new Func1, SubscriptionCreationResultInner>() { + @Override + public SubscriptionCreationResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a new CSP subscription. + * + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionCreationResultInner object + */ + public Observable> beginCreateCspSubscriptionWithServiceResponseAsync(String billingAccountName, String customerName, ModernCspSubscriptionCreationParameters body) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.beginCreateCspSubscription(billingAccountName, customerName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateCspSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateCspSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SubscriptionCreateCspSubscriptionHeaders.class); + } + +} diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/package-info.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..d43727c40600 --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/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. + * The subscription client. + */ +package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation; diff --git a/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/package-info.java b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/package-info.java new file mode 100644 index 000000000000..c7ca24ae402f --- /dev/null +++ b/sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/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. + * The subscription client. + */ +package com.microsoft.azure.management.subscription.v2019_10_01_preview; diff --git a/sdk/subscription/pom.mgmt.xml b/sdk/subscription/pom.mgmt.xml new file mode 100644 index 000000000000..14c12542d765 --- /dev/null +++ b/sdk/subscription/pom.mgmt.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-subscription-management + pom + 1.0.0 + + mgmt-v2019_10_01_preview + +