diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs index 458711a49ef84..04ad72e34bcff 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs @@ -74,11 +74,6 @@ public partial interface ISubscriptionClient : System.IDisposable /// ISubscriptionOperations Subscription { get; } - /// - /// Gets the ISubscriptionOperationOperations. - /// - ISubscriptionOperationOperations SubscriptionOperation { get; } - /// /// Gets the IOperations. /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs deleted file mode 100644 index 60e72a69facea..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SubscriptionOperationOperations operations. - /// - public partial interface ISubscriptionOperationOperations - { - /// - /// Get the status of the pending Microsoft.Subscription API - /// operations. - /// - /// - /// The operation ID, which can be found from the Location field in the - /// generate recommendation response header. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs index 6262a787e85bd..17f00e639df99 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs @@ -23,32 +23,6 @@ namespace Microsoft.Azure.Management.Subscription /// public partial interface ISubscriptionOperations { - /// - /// Creates an Azure subscription - /// - /// - /// The name of the enrollment account to which the subscription will - /// be billed. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to cancel a subscription /// @@ -119,22 +93,12 @@ public partial interface ISubscriptionOperations /// Task> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Create Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which - /// you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// The headers that will be added to request. @@ -142,7 +106,7 @@ public partial interface ISubscriptionOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -151,19 +115,12 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new CSP subscription. + /// Get Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the customer. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// The headers that will be added to request. @@ -171,7 +128,7 @@ public partial interface ISubscriptionOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -180,16 +137,12 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates an Azure subscription + /// Delete Alias. /// - /// - /// The name of the enrollment account to which the subscription will - /// be billed. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// The headers that will be added to request. @@ -197,41 +150,23 @@ public partial interface ISubscriptionOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Get Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which - /// you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. - /// - /// - /// The subscription creation parameters. - /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -240,19 +175,14 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new CSP subscription. + /// Create Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// The headers that will be added to request. @@ -260,7 +190,7 @@ public partial interface ISubscriptionOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -269,6 +199,6 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs similarity index 51% rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs index 9dc71957da15b..6675e261bc186 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs @@ -14,27 +14,26 @@ namespace Microsoft.Azure.Management.Subscription.Models using System.Linq; /// - /// The created subscription object. + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. /// - public partial class SubscriptionCreationResult + public partial class ErrorResponseBody { /// - /// Initializes a new instance of the SubscriptionCreationResult class. + /// Initializes a new instance of the ErrorResponseBody class. /// - public SubscriptionCreationResult() + public ErrorResponseBody() { CustomInit(); } /// - /// Initializes a new instance of the SubscriptionCreationResult class. + /// Initializes a new instance of the ErrorResponseBody class. /// - /// The link to the new subscription. - /// Use this link to check the status of subscription creation - /// operation. - public SubscriptionCreationResult(string subscriptionLink = default(string)) + /// The details of the error. + public ErrorResponseBody(ErrorResponse error = default(ErrorResponse)) { - SubscriptionLink = subscriptionLink; + Error = error; CustomInit(); } @@ -44,11 +43,10 @@ public SubscriptionCreationResult() partial void CustomInit(); /// - /// Gets or sets the link to the new subscription. Use this link to - /// check the status of subscription creation operation. + /// Gets or sets the details of the error. /// - [JsonProperty(PropertyName = "subscriptionLink")] - public string SubscriptionLink { get; set; } + [JsonProperty(PropertyName = "error")] + public ErrorResponse Error { get; set; } } } diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs new file mode 100644 index 0000000000000..4acfe243feb92 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponseBody + /// information. + /// + public partial class ErrorResponseBodyException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponseBody Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseBodyException class. + /// + public ErrorResponseBodyException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseBodyException class. + /// + /// The exception message. + public ErrorResponseBodyException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseBodyException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseBodyException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs deleted file mode 100644 index 18cc8a881237c..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The parameters required to create a new CSP subscription. - /// - public partial class ModernCspSubscriptionCreationParameters - { - /// - /// Initializes a new instance of the - /// ModernCspSubscriptionCreationParameters class. - /// - public ModernCspSubscriptionCreationParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ModernCspSubscriptionCreationParameters class. - /// - /// The friendly name of the - /// subscription. - /// 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. - /// Reseller ID, basically MPN Id. - public ModernCspSubscriptionCreationParameters(string displayName, string skuId, string resellerId = default(string)) - { - DisplayName = displayName; - SkuId = skuId; - ResellerId = resellerId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the friendly name of the subscription. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets 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(PropertyName = "skuId")] - public string SkuId { get; set; } - - /// - /// Gets or sets reseller ID, basically MPN Id. - /// - [JsonProperty(PropertyName = "resellerId")] - public string ResellerId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (SkuId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SkuId"); - } - } - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs deleted file mode 100644 index 01edbf8c386c9..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs +++ /dev/null @@ -1,134 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The parameters required to create a new subscription. - /// - public partial class ModernSubscriptionCreationParameters - { - /// - /// Initializes a new instance of the - /// ModernSubscriptionCreationParameters class. - /// - public ModernSubscriptionCreationParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ModernSubscriptionCreationParameters class. - /// - /// The friendly name of the - /// subscription. - /// 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. - /// If set, the cost center will show up on - /// the Azure usage and charges file. - /// If specified, the AD principal will get owner - /// access to the subscription, along with the user who is performing - /// the create subscription operation - /// The identifier of the management - /// group to which this subscription will be associated. - /// Additional, untyped parameters - /// to support custom subscription creation scenarios. - public ModernSubscriptionCreationParameters(string displayName, string skuId, string costCenter = default(string), AdPrincipal owner = default(AdPrincipal), string managementGroupId = default(string), IDictionary additionalParameters = default(IDictionary)) - { - DisplayName = displayName; - SkuId = skuId; - CostCenter = costCenter; - Owner = owner; - ManagementGroupId = managementGroupId; - AdditionalParameters = additionalParameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the friendly name of the subscription. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets 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(PropertyName = "skuId")] - public string SkuId { get; set; } - - /// - /// Gets or sets if set, the cost center will show up on the Azure - /// usage and charges file. - /// - [JsonProperty(PropertyName = "costCenter")] - public string CostCenter { get; set; } - - /// - /// Gets or sets if specified, the AD principal will get owner access - /// to the subscription, along with the user who is performing the - /// create subscription operation - /// - [JsonProperty(PropertyName = "owner")] - public AdPrincipal Owner { get; set; } - - /// - /// Gets or sets the identifier of the management group to which this - /// subscription will be associated. - /// - [JsonProperty(PropertyName = "managementGroupId")] - public string ManagementGroupId { get; set; } - - /// - /// Gets or sets additional, untyped parameters to support custom - /// subscription creation scenarios. - /// - [JsonProperty(PropertyName = "additionalParameters")] - public IDictionary AdditionalParameters { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (SkuId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SkuId"); - } - if (Owner != null) - { - Owner.Validate(); - } - } - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..b2f569f18ef67 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Accepted = "Accepted"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs new file mode 100644 index 0000000000000..043dfbff2ba38 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of aliases. + /// + public partial class PutAliasListResult + { + /// + /// Initializes a new instance of the PutAliasListResult class. + /// + public PutAliasListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PutAliasListResult class. + /// + /// The list of alias. + /// The link (url) to the next page of + /// results. + public PutAliasListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the list of alias. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets the link (url) to the next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs similarity index 58% rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs index 2912f4f6977b5..2c40b6041cc22 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs @@ -10,31 +10,29 @@ namespace Microsoft.Azure.Management.Subscription.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// Active Directory Principal who’ll get owner access on the new - /// subscription. + /// The parameters required to create a new subscription. /// - public partial class AdPrincipal + public partial class PutAliasRequest { /// - /// Initializes a new instance of the AdPrincipal class. + /// Initializes a new instance of the PutAliasRequest class. /// - public AdPrincipal() + public PutAliasRequest() { CustomInit(); } /// - /// Initializes a new instance of the AdPrincipal class. + /// Initializes a new instance of the PutAliasRequest class. /// - /// Object id of the Principal - public AdPrincipal(string objectId) + /// Put alias request properties. + public PutAliasRequest(PutAliasRequestProperties properties = default(PutAliasRequestProperties)) { - ObjectId = objectId; + Properties = properties; CustomInit(); } @@ -44,22 +42,22 @@ public AdPrincipal(string objectId) partial void CustomInit(); /// - /// Gets or sets object id of the Principal + /// Gets or sets put alias request properties. /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } + [JsonProperty(PropertyName = "properties")] + public PutAliasRequestProperties Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (ObjectId == null) + if (Properties != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); + Properties.Validate(); } } } diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs new file mode 100644 index 0000000000000..9e68dca5f3124 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Put subscription properties. + /// + public partial class PutAliasRequestProperties + { + /// + /// Initializes a new instance of the PutAliasRequestProperties class. + /// + public PutAliasRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PutAliasRequestProperties class. + /// + /// The friendly name of the + /// subscription. + /// The workload type of the subscription. It + /// can be either Production or DevTest. Possible values include: + /// 'Production', 'DevTest' + /// Determines whether subscription is + /// fieldLed, partnerLed or LegacyEA + /// This parameter can be used to create + /// alias for existing subscription Id + public PutAliasRequestProperties(string displayName, string workload, string billingScope, string subscriptionId = default(string)) + { + DisplayName = displayName; + Workload = workload; + BillingScope = billingScope; + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the friendly name of the subscription. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the workload type of the subscription. It can be + /// either Production or DevTest. Possible values include: + /// 'Production', 'DevTest' + /// + [JsonProperty(PropertyName = "workload")] + public string Workload { get; set; } + + /// + /// Gets or sets determines whether subscription is fieldLed, + /// partnerLed or LegacyEA + /// + [JsonProperty(PropertyName = "billingScope")] + public string BillingScope { get; set; } + + /// + /// Gets or sets this parameter can be used to create alias for + /// existing subscription Id + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Workload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Workload"); + } + if (BillingScope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BillingScope"); + } + } + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs new file mode 100644 index 0000000000000..4c0baaeb7dd2f --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subscription Information with the alias. + /// + public partial class PutAliasResponse : IResource + { + /// + /// Initializes a new instance of the PutAliasResponse class. + /// + public PutAliasResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PutAliasResponse class. + /// + /// Fully qualified ID for the alias resource. + /// Alias ID. + /// Resource type, + /// Microsoft.Subscription/aliases. + /// Put Alias response properties. + public PutAliasResponse(string id = default(string), string name = default(string), string type = default(string), PutAliasResponseProperties properties = default(PutAliasResponseProperties)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified ID for the alias resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets alias ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type, Microsoft.Subscription/aliases. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets put Alias response properties. + /// + [JsonProperty(PropertyName = "properties")] + public PutAliasResponseProperties Properties { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs new file mode 100644 index 0000000000000..180d517ee36e6 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Put subscription creation result properties. + /// + public partial class PutAliasResponseProperties + { + /// + /// Initializes a new instance of the PutAliasResponseProperties class. + /// + public PutAliasResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PutAliasResponseProperties class. + /// + /// Newly created subscription Id. + /// The provisioning state of the + /// resource. Possible values include: 'Accepted', 'Succeeded', + /// 'Failed' + public PutAliasResponseProperties(string subscriptionId = default(string), string provisioningState = default(string)) + { + SubscriptionId = subscriptionId; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets newly created subscription Id. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets or sets the provisioning state of the resource. Possible + /// values include: 'Accepted', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs deleted file mode 100644 index 0270e18a4e5bd..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for CreateCspSubscription operation. - /// - public partial class SubscriptionCreateCspSubscriptionHeaders - { - /// - /// Initializes a new instance of the - /// SubscriptionCreateCspSubscriptionHeaders class. - /// - public SubscriptionCreateCspSubscriptionHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SubscriptionCreateCspSubscriptionHeaders class. - /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - public SubscriptionCreateCspSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) - { - Location = location; - RetryAfter = retryAfter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs deleted file mode 100644 index a8230f26ada1e..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for CreateSubscription operation. - /// - public partial class SubscriptionCreateSubscriptionHeaders - { - /// - /// Initializes a new instance of the - /// SubscriptionCreateSubscriptionHeaders class. - /// - public SubscriptionCreateSubscriptionHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SubscriptionCreateSubscriptionHeaders class. - /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - public SubscriptionCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) - { - Location = location; - RetryAfter = retryAfter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs deleted file mode 100644 index 98a127191fdd1..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for CreateSubscriptionInEnrollmentAccount operation. - /// - public partial class SubscriptionCreateSubscriptionInEnrollmentAccountHeaders - { - /// - /// Initializes a new instance of the - /// SubscriptionCreateSubscriptionInEnrollmentAccountHeaders class. - /// - public SubscriptionCreateSubscriptionInEnrollmentAccountHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SubscriptionCreateSubscriptionInEnrollmentAccountHeaders class. - /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - public SubscriptionCreateSubscriptionInEnrollmentAccountHeaders(string location = default(string), string retryAfter = default(string)) - { - Location = location; - RetryAfter = retryAfter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter { get; set; } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs deleted file mode 100644 index 77e251905e919..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Subscription Creation Parameters required to create a new Azure - /// subscription. - /// - public partial class SubscriptionCreationParameters - { - /// - /// Initializes a new instance of the SubscriptionCreationParameters - /// class. - /// - public SubscriptionCreationParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SubscriptionCreationParameters - /// class. - /// - /// The display name of the - /// subscription. - /// The Management Group Id. - /// The list of principals that should be granted - /// Owner access on the subscription. Principals should be of type - /// User, Service Principal or Security Group. - /// 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' - /// Additional, untyped parameters - /// to support custom subscription creation scenarios. - public SubscriptionCreationParameters(string displayName = default(string), string managementGroupId = default(string), IList owners = default(IList), string offerType = default(string), IDictionary additionalParameters = default(IDictionary)) - { - DisplayName = displayName; - ManagementGroupId = managementGroupId; - Owners = owners; - OfferType = offerType; - AdditionalParameters = additionalParameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the display name of the subscription. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the Management Group Id. - /// - [JsonProperty(PropertyName = "managementGroupId")] - public string ManagementGroupId { get; set; } - - /// - /// Gets or sets 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(PropertyName = "owners")] - public IList Owners { get; set; } - - /// - /// Gets or sets 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(PropertyName = "offerType")] - public string OfferType { get; set; } - - /// - /// Gets or sets additional, untyped parameters to support custom - /// subscription creation scenarios. - /// - [JsonProperty(PropertyName = "additionalParameters")] - public IDictionary AdditionalParameters { get; set; } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs deleted file mode 100644 index 085c7c436cd7e..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for Get operation. - /// - public partial class SubscriptionOperationGetHeaders - { - /// - /// Initializes a new instance of the SubscriptionOperationGetHeaders - /// class. - /// - public SubscriptionOperationGetHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SubscriptionOperationGetHeaders - /// class. - /// - /// The URL where the status of the asynchronous - /// operation can be checked. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - public SubscriptionOperationGetHeaders(string location = default(string), int? retryAfter = default(int?)) - { - Location = location; - RetryAfter = retryAfter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the URL where the status of the asynchronous operation - /// can be checked. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs similarity index 71% rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs index 2bd823ee45177..f232ea9e3f531 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.Subscription.Models { /// - /// Defines values for OfferType. + /// Defines values for Workload. /// - public static class OfferType + public static class Workload { - public const string MSAZR0017P = "MS-AZR-0017P"; - public const string MSAZR0148P = "MS-AZR-0148P"; + public const string Production = "Production"; + public const string DevTest = "DevTest"; } } diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs index bd904a5a50b47..4bfea45641e4e 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(SubscriptionClient client) /// public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs index 5475c2a1f7e99..485de2ed79fe2 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs @@ -19,25 +19,12 @@ public static IEnumerable> ApiInfo_SubscriptionCli { return new Tuple[] { - new Tuple("Billing", "Subscription", "2019-10-01-preview"), - new Tuple("Subscription", "Operations", "2019-10-01-preview"), - new Tuple("Subscription", "Subscription", "2019-10-01-preview"), - new Tuple("Subscription", "SubscriptionOperation", "2019-10-01-preview"), + new Tuple("Subscription", "Operations", "2020-09-01"), + new Tuple("Subscription", "Subscription", "2020-09-01"), new Tuple("SubscriptionClient", "Subscriptions", "2016-06-01"), new Tuple("SubscriptionClient", "Tenants", "2016-06-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\github2\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "3e8fb815e2e4f149fbfcdaab64efc4d45dcc0690"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs index 60aa98563e27f..cef2770bd358a 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs @@ -79,11 +79,6 @@ public partial class SubscriptionClient : ServiceClient, ISu /// public virtual ISubscriptionOperations Subscription { get; private set; } - /// - /// Gets the ISubscriptionOperationOperations. - /// - public virtual ISubscriptionOperationOperations SubscriptionOperation { get; private set; } - /// /// Gets the IOperations. /// @@ -333,7 +328,6 @@ private void Initialize() Subscriptions = new SubscriptionsOperations(this); Tenants = new TenantsOperations(this); Subscription = new SubscriptionOperations(this); - SubscriptionOperation = new SubscriptionOperationOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs deleted file mode 100644 index e48ccc38acaee..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs +++ /dev/null @@ -1,248 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SubscriptionOperationOperations operations. - /// - internal partial class SubscriptionOperationOperations : IServiceOperations, ISubscriptionOperationOperations - { - /// - /// Initializes a new instance of the SubscriptionOperationOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SubscriptionOperationOperations(SubscriptionClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SubscriptionClient - /// - public SubscriptionClient Client { get; private set; } - - /// - /// Get the status of the pending Microsoft.Subscription API operations. - /// - /// - /// The operation ID, which can be found from the Location field in the - /// generate recommendation response header. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (operationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); - } - string apiVersion = "2019-10-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionOperations/{operationId}").ToString(); - _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs deleted file mode 100644 index fc4d21ab0cf19..0000000000000 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Subscription -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SubscriptionOperationOperations. - /// - public static partial class SubscriptionOperationOperationsExtensions - { - /// - /// Get the status of the pending Microsoft.Subscription API operations. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation ID, which can be found from the Location field in the - /// generate recommendation response header. - /// - public static SubscriptionCreationResult Get(this ISubscriptionOperationOperations operations, string operationId) - { - return operations.GetAsync(operationId).GetAwaiter().GetResult(); - } - - /// - /// Get the status of the pending Microsoft.Subscription API operations. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation ID, which can be found from the Location field in the - /// generate recommendation response header. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISubscriptionOperationOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs index 90f8202d53108..8a85680014a7d 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs @@ -50,29 +50,6 @@ internal SubscriptionOperations(SubscriptionClient client) /// public SubscriptionClient Client { get; private set; } - /// - /// Creates an Azure subscription - /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// The operation to cancel a subscription /// @@ -106,7 +83,7 @@ internal SubscriptionOperations(SubscriptionClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); } - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -288,7 +265,7 @@ internal SubscriptionOperations(SubscriptionClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -470,7 +447,7 @@ internal SubscriptionOperations(SubscriptionClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); } - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -613,48 +590,12 @@ internal SubscriptionOperations(SubscriptionClient client) } /// - /// The operation to create a new WebDirect or EA Azure subscription. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// The operation to create a new CSP subscription. + /// Create Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// The headers that will be added to request. @@ -662,22 +603,18 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// The cancellation token. /// - public async Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + AzureOperationResponse _response = await BeginCreateAliasWithHttpMessagesAsync(aliasName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Creates an Azure subscription + /// Get Alias Subscription. /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// Headers that will be added to request. @@ -685,7 +622,7 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -700,17 +637,13 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (enrollmentAccountName == null) + if (aliasName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "enrollmentAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -718,16 +651,15 @@ internal SubscriptionOperations(SubscriptionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("enrollmentAccountName", enrollmentAccountName); + tracingParameters.Add("aliasName", aliasName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscriptionInEnrollmentAccount", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAlias", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription").ToString(); - _url = _url.Replace("{enrollmentAccountName}", System.Uri.EscapeDataString(enrollmentAccountName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString(); + _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -740,7 +672,7 @@ internal SubscriptionOperations(SubscriptionClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -771,12 +703,6 @@ internal SubscriptionOperations(SubscriptionClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -797,13 +723,13 @@ internal SubscriptionOperations(SubscriptionClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -827,7 +753,7 @@ internal SubscriptionOperations(SubscriptionClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -840,7 +766,7 @@ internal SubscriptionOperations(SubscriptionClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -852,19 +778,6 @@ internal SubscriptionOperations(SubscriptionClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -873,22 +786,10 @@ internal SubscriptionOperations(SubscriptionClient client) } /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Delete Alias. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// Headers that will be added to request. @@ -896,12 +797,9 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -911,29 +809,157 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (billingAccountName == null) + if (aliasName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); } - if (billingProfileName == null) + string apiVersion = "2020-09-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("aliasName", aliasName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAlias", tracingParameters); } - if (invoiceSectionName == null) + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString(); + _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName)); + List _queryParameters = new List(); + if (apiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } - if (body == null) + if (_queryParameters.Count > 0) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } - if (body != null) + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { - body.Validate(); + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - string apiVersion = "2019-10-01-preview"; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get Alias Subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -941,20 +967,13 @@ internal SubscriptionOperations(SubscriptionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("billingProfileName", billingProfileName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAlias", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases").ToString(); List _queryParameters = new List(); if (apiVersion != null) { @@ -967,7 +986,7 @@ internal SubscriptionOperations(SubscriptionClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -998,12 +1017,6 @@ internal SubscriptionOperations(SubscriptionClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1024,13 +1037,13 @@ internal SubscriptionOperations(SubscriptionClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1054,7 +1067,7 @@ internal SubscriptionOperations(SubscriptionClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1067,7 +1080,7 @@ internal SubscriptionOperations(SubscriptionClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1079,19 +1092,6 @@ internal SubscriptionOperations(SubscriptionClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1100,17 +1100,12 @@ internal SubscriptionOperations(SubscriptionClient client) } /// - /// The operation to create a new CSP subscription. + /// Create Alias Subscription. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// Headers that will be added to request. @@ -1118,7 +1113,7 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1133,15 +1128,11 @@ internal SubscriptionOperations(SubscriptionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (customerName == null) + if (aliasName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); } if (body == null) { @@ -1151,7 +1142,7 @@ internal SubscriptionOperations(SubscriptionClient client) { body.Validate(); } - string apiVersion = "2019-10-01-preview"; + string apiVersion = "2020-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1159,18 +1150,16 @@ internal SubscriptionOperations(SubscriptionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("customerName", customerName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("aliasName", aliasName); tracingParameters.Add("body", body); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateCspSubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateAlias", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString(); + _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -1183,7 +1172,7 @@ internal SubscriptionOperations(SubscriptionClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1240,13 +1229,13 @@ internal SubscriptionOperations(SubscriptionClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1270,7 +1259,7 @@ internal SubscriptionOperations(SubscriptionClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1283,7 +1272,7 @@ internal SubscriptionOperations(SubscriptionClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1295,18 +1284,23 @@ internal SubscriptionOperations(SubscriptionClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) + // Deserialize Response + if ((int)_statusCode == 201) { - _httpRequest.Dispose(); - if (_httpResponse != null) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - _httpResponse.Dispose(); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs index 1011107cc48fa..987eceeeef01e 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs @@ -21,48 +21,6 @@ namespace Microsoft.Azure.Management.Subscription /// public static partial class SubscriptionOperationsExtensions { - /// - /// Creates an Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body) - { - return operations.CreateSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body).GetAwaiter().GetResult(); - } - - /// - /// Creates an Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The cancellation token. - /// - public static async Task CreateSubscriptionInEnrollmentAccountAsync(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// The operation to cancel a subscription /// @@ -172,254 +130,169 @@ public static EnabledSubscriptionId Enable(this ISubscriptionOperations operatio } /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Create Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// - public static SubscriptionCreationResult CreateSubscription(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + public static PutAliasResponse CreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body) { - return operations.CreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.CreateAliasAsync(aliasName, body).GetAwaiter().GetResult(); } /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Create Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// The cancellation token. /// - public static async Task CreateSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// The operation to create a new CSP subscription. + /// Get Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + public static PutAliasResponse GetAlias(this ISubscriptionOperations operations, string aliasName) { - return operations.CreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + return operations.GetAliasAsync(aliasName).GetAwaiter().GetResult(); } /// - /// The operation to create a new CSP subscription. + /// Get Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// The cancellation token. /// - public static async Task CreateCspSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates an Azure subscription + /// Delete Alias. /// /// /// The operations group for this extension method. /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// - public static SubscriptionCreationResult BeginCreateSubscriptionInEnrollmentAccount(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body) + public static void DeleteAlias(this ISubscriptionOperations operations, string aliasName) { - return operations.BeginCreateSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body).GetAwaiter().GetResult(); + operations.DeleteAliasAsync(aliasName).GetAwaiter().GetResult(); } /// - /// Creates an Azure subscription + /// Delete Alias. /// /// /// The operations group for this extension method. /// - /// - /// The name of the enrollment account to which the subscription will be - /// billed. - /// - /// - /// The subscription creation parameters. + /// + /// Alias Name /// /// /// The cancellation token. /// - public static async Task BeginCreateSubscriptionInEnrollmentAccountAsync(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Get Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + public static PutAliasListResult ListAlias(this ISubscriptionOperations operations) { - return operations.BeginCreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.ListAliasAsync().GetAwaiter().GetResult(); } /// - /// The operation to create a new WebDirect or EA Azure subscription. + /// Get Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the billing profile in the billing account for which you want - /// to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// /// /// The cancellation token. /// - public static async Task BeginCreateSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAliasAsync(this ISubscriptionOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAliasWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// The operation to create a new CSP subscription. + /// Create Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// - public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + public static PutAliasResponse BeginCreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body) { - return operations.BeginCreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + return operations.BeginCreateAliasAsync(aliasName, body).GetAwaiter().GetResult(); } /// - /// The operation to create a new CSP subscription. + /// Create Alias Subscription. /// /// /// The operations group for this extension method. /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the customer. + /// + /// Alias Name /// /// - /// The subscription creation parameters. /// /// /// The cancellation token. /// - public static async Task BeginCreateCspSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }