diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs index a4b1ac267d9a..9ba656d99d64 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs @@ -24,12 +24,16 @@ namespace Microsoft.Azure.Management.Subscription public partial interface ISubscriptionFactoryOperations { /// - /// The operation to create a new Azure subscription + /// 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. @@ -52,7 +56,36 @@ public partial interface ISubscriptionFactoryOperations /// /// Thrown when a required parameter is null /// - Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP 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. + /// + /// + /// 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> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates an Azure subscription /// @@ -80,12 +113,16 @@ public partial interface ISubscriptionFactoryOperations /// Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new Azure subscription + /// 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. @@ -108,7 +145,36 @@ public partial interface ISubscriptionFactoryOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP 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. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates an Azure subscription /// 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 new file mode 100644 index 000000000000..1186b398cec0 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs @@ -0,0 +1,103 @@ +// +// 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. + /// Service provider ID, basically MPN + /// Id. + public ModernCspSubscriptionCreationParameters(string displayName, string skuId, string resellerId = default(string), string serviceProviderId = default(string)) + { + DisplayName = displayName; + SkuId = skuId; + ResellerId = resellerId; + ServiceProviderId = serviceProviderId; + 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; } + + /// + /// Gets or sets service provider ID, basically MPN Id. + /// + [JsonProperty(PropertyName = "serviceProviderId")] + public string ServiceProviderId { 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/SubscriptionFactoryCreateCspSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateCspSubscriptionHeaders.cs new file mode 100644 index 000000000000..e7e1fab684d0 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateCspSubscriptionHeaders.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// 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 SubscriptionFactoryCreateCspSubscriptionHeaders + { + /// + /// Initializes a new instance of the + /// SubscriptionFactoryCreateCspSubscriptionHeaders class. + /// + public SubscriptionFactoryCreateCspSubscriptionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubscriptionFactoryCreateCspSubscriptionHeaders 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 SubscriptionFactoryCreateCspSubscriptionHeaders(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/SdkInfo_SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs index d9fde8d12ae0..a6fc1cbcbbd2 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 @@ -30,16 +30,5 @@ public static IEnumerable> ApiInfo_SubscriptionCli }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - 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=latest --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 = "ae48ce6edc05501e9b78d93d6e36862599cdedb5"; - 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/SubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs index 3f038282e47c..94c624eba720 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs @@ -51,12 +51,16 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) public SubscriptionClient Client { get; private set; } /// - /// The operation to create a new Azure subscription + /// 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. @@ -70,10 +74,36 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) /// /// The cancellation token. /// - public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + 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, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); + 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. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters 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); } @@ -101,12 +131,16 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) } /// - /// The operation to create a new Azure subscription + /// 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. @@ -135,12 +169,16 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -162,6 +200,7 @@ internal SubscriptionFactoryOperations(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); @@ -170,8 +209,9 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); + 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)); List _queryParameters = new List(); if (apiVersion != null) @@ -317,6 +357,222 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) return _result; } + /// + /// The operation to create a new CSP 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. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateCspSubscription", 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)); + 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("POST"); + _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; + 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) + { + 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 ErrorResponseException(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); + 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(); + } + // 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; + } + /// /// Creates an Azure subscription /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs index edd23ced2cf6..faca35080672 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Subscription public static partial class SubscriptionFactoryOperationsExtensions { /// - /// The operation to create a new Azure subscription + /// The operation to create a new WebDirect or EA Azure subscription. /// /// /// The operations group for this extension method. @@ -31,6 +31,10 @@ public static partial class SubscriptionFactoryOperationsExtensions /// 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. @@ -38,13 +42,13 @@ public static partial class SubscriptionFactoryOperationsExtensions /// /// The subscription creation parameters. /// - public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) { - return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.CreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); } /// - /// The operation to create a new Azure subscription + /// The operation to create a new WebDirect or EA Azure subscription. /// /// /// The operations group for this extension method. @@ -53,6 +57,10 @@ public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFa /// 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. @@ -63,9 +71,57 @@ public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFa /// /// The cancellation token. /// - public static async Task CreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP 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. + /// + public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.CreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP 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. + /// + /// + /// The cancellation token. + /// + public static async Task CreateCspSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -114,7 +170,7 @@ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(t } /// - /// The operation to create a new Azure subscription + /// The operation to create a new WebDirect or EA Azure subscription. /// /// /// The operations group for this extension method. @@ -123,6 +179,10 @@ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(t /// 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. @@ -130,13 +190,13 @@ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(t /// /// The subscription creation parameters. /// - public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) { - return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.BeginCreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); } /// - /// The operation to create a new Azure subscription + /// The operation to create a new WebDirect or EA Azure subscription. /// /// /// The operations group for this extension method. @@ -145,6 +205,10 @@ public static SubscriptionCreationResult BeginCreateSubscription(this ISubscript /// 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. @@ -155,9 +219,57 @@ public static SubscriptionCreationResult BeginCreateSubscription(this ISubscript /// /// The cancellation token. /// - public static async Task BeginCreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP 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. + /// + public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.BeginCreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateCspSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }