From 9d3958d609c031ba9d2116b7579155b22bc92b4a Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 3 Aug 2020 01:54:50 +0000 Subject: [PATCH] Generated from a6c7b118c444cc7ba99e10c5f8541ab9930aed89 Update subscriptions.json --- .../src/Generated/ISubscriptionOperations.cs | 108 +++ .../src/Generated/Models/ErrorResponseBody.cs | 52 ++ .../Models/ErrorResponseBodyException.cs | 62 ++ .../src/Generated/Models/ProvisioningState.cs | 23 + .../Generated/Models/PutAliasListResult.cs | 62 ++ .../src/Generated/Models/PutAliasRequest.cs | 64 ++ .../Models/PutAliasRequestProperties.cs | 106 +++ .../src/Generated/Models/PutAliasResponse.cs | 78 ++ .../Models/PutAliasResponseProperties.cs | 62 ++ .../src/Generated/Models/WorkloadType.cs | 22 + .../Generated/SdkInfo_SubscriptionClient.cs | 11 - .../src/Generated/SubscriptionOperations.cs | 720 ++++++++++++++++++ .../SubscriptionOperationsExtensions.cs | 169 ++++ 13 files changed, 1528 insertions(+), 11 deletions(-) create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/WorkloadType.cs 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 6262a787e85b..be372fe3fca5 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs @@ -182,6 +182,90 @@ public partial interface ISubscriptionOperations /// Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Create Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// 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> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// 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> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Alias. + /// + /// + /// Alias Name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Alias Subscription. + /// + /// + /// 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> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates an Azure subscription /// /// @@ -270,5 +354,29 @@ 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)); + /// + /// Create Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// 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> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs new file mode 100644 index 000000000000..6675e261bc18 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs @@ -0,0 +1,52 @@ +// +// 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; + + /// + /// 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 ErrorResponseBody + { + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + public ErrorResponseBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + /// The details of the error. + public ErrorResponseBody(ErrorResponse error = default(ErrorResponse)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details of the error. + /// + [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 000000000000..4acfe243feb9 --- /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/ProvisioningState.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..b2f569f18ef6 --- /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 000000000000..043dfbff2ba3 --- /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/PutAliasRequest.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs new file mode 100644 index 000000000000..2c40b6041cc2 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// The parameters required to create a new subscription. + /// + public partial class PutAliasRequest + { + /// + /// Initializes a new instance of the PutAliasRequest class. + /// + public PutAliasRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PutAliasRequest class. + /// + /// Put alias request properties. + public PutAliasRequest(PutAliasRequestProperties properties = default(PutAliasRequestProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets put alias request properties. + /// + [JsonProperty(PropertyName = "properties")] + public PutAliasRequestProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + 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 000000000000..21efdcc1cc0b --- /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 workloadType, string billingScope, string subscriptionId = default(string)) + { + DisplayName = displayName; + WorkloadType = workloadType; + 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 = "workloadType")] + public string WorkloadType { 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 (WorkloadType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkloadType"); + } + 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 000000000000..4c0baaeb7dd2 --- /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 000000000000..180d517ee36e --- /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/WorkloadType.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/WorkloadType.cs new file mode 100644 index 000000000000..e93823620aa9 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/WorkloadType.cs @@ -0,0 +1,22 @@ +// +// 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 WorkloadType. + /// + public static class WorkloadType + { + public const string Production = "Production"; + public const string DevTest = "DevTest"; + } +} 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 5475c2a1f7e9..4db44e99807e 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 @@ -28,16 +28,5 @@ public static IEnumerable> ApiInfo_SubscriptionCli }.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/SubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs index 90f8202d5310..c307eef44742 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs @@ -669,6 +669,516 @@ internal SubscriptionOperations(SubscriptionClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Create Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateAliasWithHttpMessagesAsync(aliasName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// 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> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (aliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); + } + 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("aliasName", aliasName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Subscription/aliases/{aliasName}").ToString(); + _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName)); + 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) + { + 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(); + } + // 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete Alias. + /// + /// + /// Alias Name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (aliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); + } + 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("aliasName", aliasName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAlias", tracingParameters); + } + // 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) + { + _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("DELETE"); + _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 != 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(); + } + 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 = "2019-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Subscription/aliases").ToString(); + 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) + { + 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(); + } + // 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates an Azure subscription /// @@ -1315,5 +1825,215 @@ internal SubscriptionOperations(SubscriptionClient client) return _result; } + /// + /// Create Alias Subscription. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// 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> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (aliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + 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("aliasName", aliasName); + tracingParameters.Add("body", body); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Subscription/aliases/{aliasName}").ToString(); + _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName)); + 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("PUT"); + _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 != 201) + { + 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(); + } + // 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } 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 1011107cc48f..2bd98f651c92 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs @@ -277,6 +277,137 @@ public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptio } } + /// + /// Create Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// + public static PutAliasResponse CreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body) + { + return operations.CreateAliasAsync(aliasName, body).GetAwaiter().GetResult(); + } + + /// + /// Create Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + public static PutAliasResponse GetAlias(this ISubscriptionOperations operations, string aliasName) + { + return operations.GetAliasAsync(aliasName).GetAwaiter().GetResult(); + } + + /// + /// Get Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// The cancellation token. + /// + public static async Task GetAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + public static void DeleteAlias(this ISubscriptionOperations operations, string aliasName) + { + operations.DeleteAliasAsync(aliasName).GetAwaiter().GetResult(); + } + + /// + /// Delete Alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + public static PutAliasListResult ListAlias(this ISubscriptionOperations operations) + { + return operations.ListAliasAsync().GetAwaiter().GetResult(); + } + + /// + /// Get Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAliasAsync(this ISubscriptionOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAliasWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates an Azure subscription /// @@ -425,5 +556,43 @@ public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscr } } + /// + /// Create Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// + public static PutAliasResponse BeginCreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body) + { + return operations.BeginCreateAliasAsync(aliasName, body).GetAwaiter().GetResult(); + } + + /// + /// Create Alias Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Alias Name + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } }