diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs index 77283e252e56d..df4ad3a48e6c2 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs @@ -93,6 +93,16 @@ public partial class AzureReservationAPIClient : ServiceClient public virtual IOperationOperations Operation { get; private set; } + /// + /// Gets the ICalculateExchangeOperations. + /// + public virtual ICalculateExchangeOperations CalculateExchange { get; private set; } + + /// + /// Gets the IExchangeOperations. + /// + public virtual IExchangeOperations Exchange { get; private set; } + /// /// Initializes a new instance of the AzureReservationAPIClient class. /// @@ -340,6 +350,8 @@ private void Initialize() Reservation = new ReservationOperations(this); ReservationOrder = new ReservationOrderOperations(this); Operation = new OperationOperations(this); + CalculateExchange = new CalculateExchangeOperations(this); + Exchange = new ExchangeOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -419,7 +431,7 @@ private void Initialize() { throw new ValidationException(ValidationRules.CannotBeNull, "reservedResourceType"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -608,7 +620,7 @@ private void Initialize() { throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperations.cs new file mode 100644 index 0000000000000..e5429056a2441 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperations.cs @@ -0,0 +1,276 @@ +// +// 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.Reservations +{ + 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; + + /// + /// CalculateExchangeOperations operations. + /// + internal partial class CalculateExchangeOperations : IServiceOperations, ICalculateExchangeOperations + { + /// + /// Initializes a new instance of the CalculateExchangeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CalculateExchangeOperations(AzureReservationAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureReservationAPIClient + /// + public AzureReservationAPIClient Client { get; private set; } + + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PostWithHttpMessagesAsync(CalculateExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPostWithHttpMessagesAsync(body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// 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> BeginPostWithHttpMessagesAsync(CalculateExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + string apiVersion = "2020-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("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPost", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/calculateExchange").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("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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperationsExtensions.cs new file mode 100644 index 0000000000000..0e2d6b25828e2 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/CalculateExchangeOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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.Reservations +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CalculateExchangeOperations. + /// + public static partial class CalculateExchangeOperationsExtensions + { + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + public static CalculateExchangeOperationResultResponse Post(this ICalculateExchangeOperations operations, CalculateExchangeRequest body) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this ICalculateExchangeOperations operations, CalculateExchangeRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + public static CalculateExchangeOperationResultResponse BeginPost(this ICalculateExchangeOperations operations, CalculateExchangeRequest body) + { + return operations.BeginPostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no policy + /// errors. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPostAsync(this ICalculateExchangeOperations operations, CalculateExchangeRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperations.cs new file mode 100644 index 0000000000000..f95e0de221f20 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperations.cs @@ -0,0 +1,276 @@ +// +// 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.Reservations +{ + 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; + + /// + /// ExchangeOperations operations. + /// + internal partial class ExchangeOperations : IServiceOperations, IExchangeOperations + { + /// + /// Initializes a new instance of the ExchangeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExchangeOperations(AzureReservationAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureReservationAPIClient + /// + public AzureReservationAPIClient Client { get; private set; } + + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PostWithHttpMessagesAsync(ExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPostWithHttpMessagesAsync(body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + /// + /// 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> BeginPostWithHttpMessagesAsync(ExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + string apiVersion = "2020-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("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPost", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/exchange").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("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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperationsExtensions.cs new file mode 100644 index 0000000000000..0523af8fa8a4a --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ExchangeOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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.Reservations +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExchangeOperations. + /// + public static partial class ExchangeOperationsExtensions + { + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + public static ExchangeOperationResultResponse Post(this IExchangeOperations operations, ExchangeRequest body) + { + return operations.PostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IExchangeOperations operations, ExchangeRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + public static ExchangeOperationResultResponse BeginPost(this IExchangeOperations operations, ExchangeRequest body) + { + return operations.BeginPostAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Request containing the refunds and purchases that need to be executed. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPostAsync(this IExchangeOperations operations, ExchangeRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs index fcbde0e335164..fe2113e1be2f1 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs @@ -92,6 +92,16 @@ public partial interface IAzureReservationAPIClient : System.IDisposable /// IOperationOperations Operation { get; } + /// + /// Gets the ICalculateExchangeOperations. + /// + ICalculateExchangeOperations CalculateExchange { get; } + + /// + /// Gets the IExchangeOperations. + /// + IExchangeOperations Exchange { get; } + /// /// Get the regions and skus that are available for RI purchase for the /// specified Azure subscription. diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ICalculateExchangeOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ICalculateExchangeOperations.cs new file mode 100644 index 0000000000000..8f433410cf21f --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ICalculateExchangeOperations.cs @@ -0,0 +1,81 @@ +// +// 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.Reservations +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CalculateExchangeOperations operations. + /// + public partial interface ICalculateExchangeOperations + { + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no + /// policy errors. + /// + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// 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> PostWithHttpMessagesAsync(CalculateExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Calculates the refund amounts and price of the new purchases. + /// + /// + /// Calculates price for exchanging `Reservations` if there are no + /// policy errors. + /// + /// + /// + /// Request containing purchases and refunds that need to be executed. + /// + /// + /// 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> BeginPostWithHttpMessagesAsync(CalculateExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IExchangeOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IExchangeOperations.cs new file mode 100644 index 0000000000000..bcc9bef6dfe0f --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IExchangeOperations.cs @@ -0,0 +1,83 @@ +// +// 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.Reservations +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExchangeOperations operations. + /// + public partial interface IExchangeOperations + { + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// Request containing the refunds and purchases that need to be + /// executed. + /// + /// + /// 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> PostWithHttpMessagesAsync(ExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Exchange Reservation(s) + /// + /// + /// Returns one or more `Reservations` in exchange for one or more + /// `Reservation` purchases. + /// + /// + /// + /// Request containing the refunds and purchases that need to be + /// executed. + /// + /// + /// 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> BeginPostWithHttpMessagesAsync(ExchangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOperations.cs index 79296694a9d0a..24d8d91abf121 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOperations.cs @@ -53,7 +53,7 @@ public partial interface IReservationOperations /// /// Thrown when a required parameter is null /// - Task> AvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, SubscriptionScopeProperties body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Split the `Reservation`. /// @@ -257,7 +257,7 @@ public partial interface IReservationOperations /// /// Thrown when a required parameter is null /// - Task> BeginAvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, SubscriptionScopeProperties body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginAvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Split the `Reservation`. /// diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOrderOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOrderOperations.cs index 7afbb6a9be58a..667cc7045fd9b 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOrderOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IReservationOrderOperations.cs @@ -129,6 +129,35 @@ public partial interface IReservationOrderOperations /// Task> GetWithHttpMessagesAsync(string reservationOrderId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Change directory of `ReservationOrder`. + /// + /// + /// Change directory (tenant) of `ReservationOrder` and all + /// `Reservation` under it to specified tenant id + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed to change directory of reservation order + /// + /// + /// 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> ChangeDirectoryWithHttpMessagesAsync(string reservationOrderId, ChangeDirectoryRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Purchase `ReservationOrder` /// /// diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeProperties.cs new file mode 100644 index 0000000000000..b37249689ec1d --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeProperties.cs @@ -0,0 +1,46 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AvailableScopeProperties + { + /// + /// Initializes a new instance of the AvailableScopeProperties class. + /// + public AvailableScopeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableScopeProperties class. + /// + public AvailableScopeProperties(SubscriptionScopeProperties properties = default(SubscriptionScopeProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public SubscriptionScopeProperties Properties { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequest.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequest.cs new file mode 100644 index 0000000000000..f10ea022f293e --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequest.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Available scope + /// + public partial class AvailableScopeRequest + { + /// + /// Initializes a new instance of the AvailableScopeRequest class. + /// + public AvailableScopeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableScopeRequest class. + /// + public AvailableScopeRequest(AvailableScopeRequestProperties properties = default(AvailableScopeRequestProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public AvailableScopeRequestProperties Properties { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequestProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequestProperties.cs new file mode 100644 index 0000000000000..814167627b7cb --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AvailableScopeRequestProperties.cs @@ -0,0 +1,53 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Available scope request properties + /// + public partial class AvailableScopeRequestProperties + { + /// + /// Initializes a new instance of the AvailableScopeRequestProperties + /// class. + /// + public AvailableScopeRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableScopeRequestProperties + /// class. + /// + public AvailableScopeRequestProperties(IList scopes = default(IList)) + { + Scopes = scopes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "scopes")] + public IList Scopes { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/BillingInformation.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/BillingInformation.cs new file mode 100644 index 0000000000000..48577d5f5843c --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/BillingInformation.cs @@ -0,0 +1,61 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// billing information + /// + public partial class BillingInformation + { + /// + /// Initializes a new instance of the BillingInformation class. + /// + public BillingInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingInformation class. + /// + public BillingInformation(Price billingCurrencyTotalPaidAmount = default(Price), Price billingCurrencyProratedAmount = default(Price), Price billingCurrencyRemainingCommitmentAmount = default(Price)) + { + BillingCurrencyTotalPaidAmount = billingCurrencyTotalPaidAmount; + BillingCurrencyProratedAmount = billingCurrencyProratedAmount; + BillingCurrencyRemainingCommitmentAmount = billingCurrencyRemainingCommitmentAmount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "billingCurrencyTotalPaidAmount")] + public Price BillingCurrencyTotalPaidAmount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingCurrencyProratedAmount")] + public Price BillingCurrencyProratedAmount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingCurrencyRemainingCommitmentAmount")] + public Price BillingCurrencyRemainingCommitmentAmount { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultResponse.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultResponse.cs new file mode 100644 index 0000000000000..00f336116372b --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultResponse.cs @@ -0,0 +1,87 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// CalculateExchange operation result + /// + public partial class CalculateExchangeOperationResultResponse + { + /// + /// Initializes a new instance of the + /// CalculateExchangeOperationResultResponse class. + /// + public CalculateExchangeOperationResultResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CalculateExchangeOperationResultResponse class. + /// + /// It should match what is used to GET the operation + /// result. + /// It must match the last segment of the id field, + /// and will typically be a GUID / system generated value. + /// Status of the operation. Possible values + /// include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' + public CalculateExchangeOperationResultResponse(string id = default(string), string name = default(string), string status = default(string), CalculateExchangeResponseProperties properties = default(CalculateExchangeResponseProperties), OperationResultError error = default(OperationResultError)) + { + Id = id; + Name = name; + Status = status; + Properties = properties; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets it should match what is used to GET the operation + /// result. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets it must match the last segment of the id field, and + /// will typically be a GUID / system generated value. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets status of the operation. Possible values include: + /// 'Succeeded', 'Failed', 'Cancelled', 'Pending' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CalculateExchangeResponseProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "error")] + public OperationResultError Error { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultStatus.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultStatus.cs new file mode 100644 index 0000000000000..e2d7977c5ac1c --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeOperationResultStatus.cs @@ -0,0 +1,24 @@ +// +// 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.Reservations.Models +{ + + /// + /// Defines values for CalculateExchangeOperationResultStatus. + /// + public static class CalculateExchangeOperationResultStatus + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Cancelled = "Cancelled"; + public const string Pending = "Pending"; + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangePostHeaders.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangePostHeaders.cs new file mode 100644 index 0000000000000..b9975534687b4 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangePostHeaders.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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Post operation. + /// + public partial class CalculateExchangePostHeaders + { + /// + /// Initializes a new instance of the CalculateExchangePostHeaders + /// class. + /// + public CalculateExchangePostHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CalculateExchangePostHeaders + /// class. + /// + /// URL to query for the status of the + /// operation. + /// Clients should wait for the Retry-After + /// interval before polling again + public CalculateExchangePostHeaders(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 URL to query for the status of the operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets clients should wait for the Retry-After interval + /// before polling again + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequest.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequest.cs new file mode 100644 index 0000000000000..ec07e70785ccf --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequest.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Calculate exchange request + /// + public partial class CalculateExchangeRequest + { + /// + /// Initializes a new instance of the CalculateExchangeRequest class. + /// + public CalculateExchangeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CalculateExchangeRequest class. + /// + public CalculateExchangeRequest(CalculateExchangeRequestProperties properties = default(CalculateExchangeRequestProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CalculateExchangeRequestProperties Properties { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequestProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequestProperties.cs new file mode 100644 index 0000000000000..255803f1611ca --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeRequestProperties.cs @@ -0,0 +1,67 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Calculate exchange request properties + /// + public partial class CalculateExchangeRequestProperties + { + /// + /// Initializes a new instance of the + /// CalculateExchangeRequestProperties class. + /// + public CalculateExchangeRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CalculateExchangeRequestProperties class. + /// + /// List of reservations that are + /// being purchased in this exchange. + /// List of reservations that are + /// being returned in this exchange. + public CalculateExchangeRequestProperties(IList reservationsToPurchase = default(IList), IList reservationsToExchange = default(IList)) + { + ReservationsToPurchase = reservationsToPurchase; + ReservationsToExchange = reservationsToExchange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of reservations that are being purchased in this + /// exchange. + /// + [JsonProperty(PropertyName = "reservationsToPurchase")] + public IList ReservationsToPurchase { get; set; } + + /// + /// Gets or sets list of reservations that are being returned in this + /// exchange. + /// + [JsonProperty(PropertyName = "reservationsToExchange")] + public IList ReservationsToExchange { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeResponseProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeResponseProperties.cs new file mode 100644 index 0000000000000..d007e5e816f12 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/CalculateExchangeResponseProperties.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// CalculateExchange response properties + /// + public partial class CalculateExchangeResponseProperties + { + /// + /// Initializes a new instance of the + /// CalculateExchangeResponseProperties class. + /// + public CalculateExchangeResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CalculateExchangeResponseProperties class. + /// + /// Exchange session identifier + /// Details of the reservations + /// being purchased + /// Details of the reservations + /// being returned + public CalculateExchangeResponseProperties(string sessionId = default(string), Price netPayable = default(Price), Price refundsTotal = default(Price), Price purchasesTotal = default(Price), IList reservationsToPurchase = default(IList), IList reservationsToExchange = default(IList), ExchangePolicyErrors policyResult = default(ExchangePolicyErrors)) + { + SessionId = sessionId; + NetPayable = netPayable; + RefundsTotal = refundsTotal; + PurchasesTotal = purchasesTotal; + ReservationsToPurchase = reservationsToPurchase; + ReservationsToExchange = reservationsToExchange; + PolicyResult = policyResult; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets exchange session identifier + /// + [JsonProperty(PropertyName = "sessionId")] + public string SessionId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "netPayable")] + public Price NetPayable { get; set; } + + /// + /// + [JsonProperty(PropertyName = "refundsTotal")] + public Price RefundsTotal { get; set; } + + /// + /// + [JsonProperty(PropertyName = "purchasesTotal")] + public Price PurchasesTotal { get; set; } + + /// + /// Gets or sets details of the reservations being purchased + /// + [JsonProperty(PropertyName = "reservationsToPurchase")] + public IList ReservationsToPurchase { get; set; } + + /// + /// Gets or sets details of the reservations being returned + /// + [JsonProperty(PropertyName = "reservationsToExchange")] + public IList ReservationsToExchange { get; set; } + + /// + /// + [JsonProperty(PropertyName = "policyResult")] + public ExchangePolicyErrors PolicyResult { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryRequest.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryRequest.cs new file mode 100644 index 0000000000000..a7af0592bcf0a --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryRequest.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ChangeDirectoryRequest + { + /// + /// Initializes a new instance of the ChangeDirectoryRequest class. + /// + public ChangeDirectoryRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ChangeDirectoryRequest class. + /// + /// Tenant id GUID that reservation + /// order is to be transferred to + public ChangeDirectoryRequest(string destinationTenantId = default(string)) + { + DestinationTenantId = destinationTenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tenant id GUID that reservation order is to be + /// transferred to + /// + [JsonProperty(PropertyName = "destinationTenantId")] + public string DestinationTenantId { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResponse.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResponse.cs new file mode 100644 index 0000000000000..2ee490ffbafaf --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResponse.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Change directory response + /// + public partial class ChangeDirectoryResponse + { + /// + /// Initializes a new instance of the ChangeDirectoryResponse class. + /// + public ChangeDirectoryResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ChangeDirectoryResponse class. + /// + public ChangeDirectoryResponse(ChangeDirectoryResult reservationOrder = default(ChangeDirectoryResult), IList reservations = default(IList)) + { + ReservationOrder = reservationOrder; + Reservations = reservations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "reservationOrder")] + public ChangeDirectoryResult ReservationOrder { get; set; } + + /// + /// + [JsonProperty(PropertyName = "reservations")] + public IList Reservations { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResult.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResult.cs new file mode 100644 index 0000000000000..6753ed64b5b17 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ChangeDirectoryResult.cs @@ -0,0 +1,80 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Change directory result for reservation order or reservation + /// + public partial class ChangeDirectoryResult + { + /// + /// Initializes a new instance of the ChangeDirectoryResult class. + /// + public ChangeDirectoryResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ChangeDirectoryResult class. + /// + /// Identifier of the reservation order or + /// reservation + /// Name of the reservation order or + /// reservation + /// True if change directory operation + /// succeeded on this reservation order or reservation + /// Error reason if operation failed. Null + /// otherwise + public ChangeDirectoryResult(string id = default(string), string name = default(string), bool? isSucceeded = default(bool?), string error = default(string)) + { + Id = id; + Name = name; + IsSucceeded = isSucceeded; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identifier of the reservation order or reservation + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets name of the reservation order or reservation + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets true if change directory operation succeeded on this + /// reservation order or reservation + /// + [JsonProperty(PropertyName = "isSucceeded")] + public bool? IsSucceeded { get; set; } + + /// + /// Gets or sets error reason if operation failed. Null otherwise + /// + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultResponse.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultResponse.cs new file mode 100644 index 0000000000000..acdfd569fce38 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultResponse.cs @@ -0,0 +1,89 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Exchange operation result + /// + public partial class ExchangeOperationResultResponse + { + /// + /// Initializes a new instance of the ExchangeOperationResultResponse + /// class. + /// + public ExchangeOperationResultResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangeOperationResultResponse + /// class. + /// + /// It should match what is used to GET the operation + /// result. + /// It must match the last segment of the id field, + /// and will typically be a GUID / system generated value. + /// Status of the operation. Possible values + /// include: 'Succeeded', 'Failed', 'Cancelled', 'PendingRefunds', + /// 'PendingPurchases' + public ExchangeOperationResultResponse(string id = default(string), string name = default(string), string status = default(string), ExchangeResponseProperties properties = default(ExchangeResponseProperties), OperationResultError error = default(OperationResultError)) + { + Id = id; + Name = name; + Status = status; + Properties = properties; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets it should match what is used to GET the operation + /// result. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets it must match the last segment of the id field, and + /// will typically be a GUID / system generated value. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets status of the operation. Possible values include: + /// 'Succeeded', 'Failed', 'Cancelled', 'PendingRefunds', + /// 'PendingPurchases' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public ExchangeResponseProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "error")] + public OperationResultError Error { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultStatus.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultStatus.cs new file mode 100644 index 0000000000000..a3224e6a340c7 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeOperationResultStatus.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + + /// + /// Defines values for ExchangeOperationResultStatus. + /// + public static class ExchangeOperationResultStatus + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Cancelled = "Cancelled"; + public const string PendingRefunds = "PendingRefunds"; + public const string PendingPurchases = "PendingPurchases"; + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyError.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyError.cs new file mode 100644 index 0000000000000..5e032613b0ac5 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyError.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// error details + /// + public partial class ExchangePolicyError + { + /// + /// Initializes a new instance of the ExchangePolicyError class. + /// + public ExchangePolicyError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangePolicyError class. + /// + public ExchangePolicyError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyErrors.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyErrors.cs new file mode 100644 index 0000000000000..793d66cf53c9b --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePolicyErrors.cs @@ -0,0 +1,53 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Exchange policy errors + /// + public partial class ExchangePolicyErrors + { + /// + /// Initializes a new instance of the ExchangePolicyErrors class. + /// + public ExchangePolicyErrors() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangePolicyErrors class. + /// + /// Exchange Policy errors + public ExchangePolicyErrors(IList policyErrors = default(IList)) + { + PolicyErrors = policyErrors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets exchange Policy errors + /// + [JsonProperty(PropertyName = "policyErrors")] + public IList PolicyErrors { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePostHeaders.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePostHeaders.cs new file mode 100644 index 0000000000000..8673a9fa523df --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangePostHeaders.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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Post operation. + /// + public partial class ExchangePostHeaders + { + /// + /// Initializes a new instance of the ExchangePostHeaders class. + /// + public ExchangePostHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangePostHeaders class. + /// + /// URL to query for the status of the + /// operation. + /// Clients should wait for the Retry-After + /// interval before polling again + public ExchangePostHeaders(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 URL to query for the status of the operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets clients should wait for the Retry-After interval + /// before polling again + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequest.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequest.cs new file mode 100644 index 0000000000000..89a54aac6c765 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequest.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Exchange request + /// + public partial class ExchangeRequest + { + /// + /// Initializes a new instance of the ExchangeRequest class. + /// + public ExchangeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangeRequest class. + /// + public ExchangeRequest(ExchangeRequestProperties properties = default(ExchangeRequestProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public ExchangeRequestProperties Properties { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequestProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequestProperties.cs new file mode 100644 index 0000000000000..4b28c2744e8e5 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeRequestProperties.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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Exchange request properties + /// + public partial class ExchangeRequestProperties + { + /// + /// Initializes a new instance of the ExchangeRequestProperties class. + /// + public ExchangeRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangeRequestProperties class. + /// + /// SessionId that was returned by + /// CalculateExchange API. + public ExchangeRequestProperties(string sessionId = default(string)) + { + SessionId = sessionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sessionId that was returned by CalculateExchange API. + /// + [JsonProperty(PropertyName = "sessionId")] + public string SessionId { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeResponseProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeResponseProperties.cs new file mode 100644 index 0000000000000..fa0908885d42e --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ExchangeResponseProperties.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Exchange response properties + /// + public partial class ExchangeResponseProperties + { + /// + /// Initializes a new instance of the ExchangeResponseProperties class. + /// + public ExchangeResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExchangeResponseProperties class. + /// + /// Exchange session identifier + /// Details of the reservations + /// being purchased + /// Details of the reservations + /// being returned + public ExchangeResponseProperties(string sessionId = default(string), Price netPayable = default(Price), Price refundsTotal = default(Price), Price purchasesTotal = default(Price), IList reservationsToPurchase = default(IList), IList reservationsToExchange = default(IList), ExchangePolicyErrors policyResult = default(ExchangePolicyErrors)) + { + SessionId = sessionId; + NetPayable = netPayable; + RefundsTotal = refundsTotal; + PurchasesTotal = purchasesTotal; + ReservationsToPurchase = reservationsToPurchase; + ReservationsToExchange = reservationsToExchange; + PolicyResult = policyResult; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets exchange session identifier + /// + [JsonProperty(PropertyName = "sessionId")] + public string SessionId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "netPayable")] + public Price NetPayable { get; set; } + + /// + /// + [JsonProperty(PropertyName = "refundsTotal")] + public Price RefundsTotal { get; set; } + + /// + /// + [JsonProperty(PropertyName = "purchasesTotal")] + public Price PurchasesTotal { get; set; } + + /// + /// Gets or sets details of the reservations being purchased + /// + [JsonProperty(PropertyName = "reservationsToPurchase")] + public IList ReservationsToPurchase { get; set; } + + /// + /// Gets or sets details of the reservations being returned + /// + [JsonProperty(PropertyName = "reservationsToExchange")] + public IList ReservationsToExchange { get; set; } + + /// + /// + [JsonProperty(PropertyName = "policyResult")] + public ExchangePolicyErrors PolicyResult { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationResultError.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationResultError.cs new file mode 100644 index 0000000000000..4875b8b9393fa --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationResultError.cs @@ -0,0 +1,68 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Required if status == failed or status == canceled. + /// + public partial class OperationResultError + { + /// + /// Initializes a new instance of the OperationResultError class. + /// + public OperationResultError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResultError class. + /// + /// Required if status == failed or status == + /// cancelled. If status == failed, provide an invariant error code + /// used for error troubleshooting, aggregation, and analysis. + /// Required if status == failed. Localized. If + /// status == failed, provide an actionable error message indicating + /// what error occurred, and what the user can do to address the + /// issue. + public OperationResultError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required if status == failed or status == cancelled. + /// If status == failed, provide an invariant error code used for error + /// troubleshooting, aggregation, and analysis. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets required if status == failed. Localized. If status == + /// failed, provide an actionable error message indicating what error + /// occurred, and what the user can do to address the issue. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationStatus.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationStatus.cs new file mode 100644 index 0000000000000..06842966f5b8c --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OperationStatus.cs @@ -0,0 +1,24 @@ +// +// 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.Reservations.Models +{ + + /// + /// Defines values for OperationStatus. + /// + public static class OperationStatus + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Cancelled = "Cancelled"; + public const string Pending = "Pending"; + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/PurchaseRequest.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/PurchaseRequest.cs index c45f7bead93c2..c9a8481ebc086 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/PurchaseRequest.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/PurchaseRequest.cs @@ -35,8 +35,11 @@ public PurchaseRequest() /// lives. /// Possible values include: /// 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', - /// 'RedHat', 'SqlDataWarehouse', 'VMwareCloudSimple', - /// 'RedHatOsa' + /// 'RedHat', 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', + /// 'Databricks', 'AppService', 'ManagedDisk', 'BlockBlob', + /// 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', + /// 'PostgreSql', 'DedicatedHost', 'SapHana', + /// 'SqlAzureHybridBenefit' /// Possible values include: 'P1Y', 'P3Y' /// Possible values include: 'Upfront', /// 'Monthly' @@ -82,7 +85,10 @@ public PurchaseRequest() /// /// Gets or sets possible values include: 'VirtualMachines', /// 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - /// 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa' + /// 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', + /// 'AppService', 'ManagedDisk', 'BlockBlob', 'RedisCache', + /// 'AzureDataExplorer', 'MySql', 'MariaDb', 'PostgreSql', + /// 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' /// [JsonProperty(PropertyName = "properties.reservedResourceType")] public string ReservedResourceType { get; set; } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationProperties.cs index 688e0f7ed4f96..42278e254ee51 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationProperties.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationProperties.cs @@ -32,8 +32,11 @@ public ReservationProperties() /// /// Possible values include: /// 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', - /// 'RedHat', 'SqlDataWarehouse', 'VMwareCloudSimple', - /// 'RedHatOsa' + /// 'RedHat', 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', + /// 'Databricks', 'AppService', 'ManagedDisk', 'BlockBlob', + /// 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', + /// 'PostgreSql', 'DedicatedHost', 'SapHana', + /// 'SqlAzureHybridBenefit' /// Possible values include: 'On', /// 'Off' /// Friendly name for user to easily identify @@ -93,7 +96,10 @@ public ReservationProperties() /// /// Gets or sets possible values include: 'VirtualMachines', /// 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - /// 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa' + /// 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', + /// 'AppService', 'ManagedDisk', 'BlockBlob', 'RedisCache', + /// 'AzureDataExplorer', 'MySql', 'MariaDb', 'PostgreSql', + /// 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' /// [JsonProperty(PropertyName = "reservedResourceType")] public string ReservedResourceType { get; set; } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToExchange.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToExchange.cs new file mode 100644 index 0000000000000..6374f49914d83 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToExchange.cs @@ -0,0 +1,72 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reservation refund details + /// + public partial class ReservationToExchange + { + /// + /// Initializes a new instance of the ReservationToExchange class. + /// + public ReservationToExchange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReservationToExchange class. + /// + /// Fully qualified id of the Reservation + /// being returned. + /// Quantity to be returned + public ReservationToExchange(string reservationId = default(string), int? quantity = default(int?), Price billingRefundAmount = default(Price), BillingInformation billingInformation = default(BillingInformation)) + { + ReservationId = reservationId; + Quantity = quantity; + BillingRefundAmount = billingRefundAmount; + BillingInformation = billingInformation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified id of the Reservation being returned. + /// + [JsonProperty(PropertyName = "reservationId")] + public string ReservationId { get; set; } + + /// + /// Gets or sets quantity to be returned + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingRefundAmount")] + public Price BillingRefundAmount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingInformation")] + public BillingInformation BillingInformation { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseCalculateExchange.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseCalculateExchange.cs new file mode 100644 index 0000000000000..0f2aa6355354c --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseCalculateExchange.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reservation purchase details + /// + public partial class ReservationToPurchaseCalculateExchange + { + /// + /// Initializes a new instance of the + /// ReservationToPurchaseCalculateExchange class. + /// + public ReservationToPurchaseCalculateExchange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationToPurchaseCalculateExchange class. + /// + public ReservationToPurchaseCalculateExchange(Price billingCurrencyTotal = default(Price)) + { + BillingCurrencyTotal = billingCurrencyTotal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "billingCurrencyTotal")] + public Price BillingCurrencyTotal { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseExchange.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseExchange.cs new file mode 100644 index 0000000000000..ab646881c371d --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToPurchaseExchange.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reservation purchase details + /// + public partial class ReservationToPurchaseExchange + { + /// + /// Initializes a new instance of the ReservationToPurchaseExchange + /// class. + /// + public ReservationToPurchaseExchange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReservationToPurchaseExchange + /// class. + /// + /// Fully qualified id of the + /// ReservationOrder being purchased + /// Possible values include: 'Succeeded', + /// 'Failed', 'Cancelled', 'Pending' + public ReservationToPurchaseExchange(string reservationOrderId = default(string), Price billingCurrencyTotal = default(Price), string status = default(string)) + { + ReservationOrderId = reservationOrderId; + BillingCurrencyTotal = billingCurrencyTotal; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified id of the ReservationOrder being + /// purchased + /// + [JsonProperty(PropertyName = "reservationOrderId")] + public string ReservationOrderId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingCurrencyTotal")] + public Price BillingCurrencyTotal { get; set; } + + /// + /// Gets or sets possible values include: 'Succeeded', 'Failed', + /// 'Cancelled', 'Pending' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturn.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturn.cs new file mode 100644 index 0000000000000..e8d6ad962b122 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturn.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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reservation to return + /// + public partial class ReservationToReturn + { + /// + /// Initializes a new instance of the ReservationToReturn class. + /// + public ReservationToReturn() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReservationToReturn class. + /// + /// Fully qualified identifier of the + /// Reservation being returned + /// Quantity to be returned. Must be greater + /// than zero. + public ReservationToReturn(string reservationId = default(string), int? quantity = default(int?)) + { + ReservationId = reservationId; + Quantity = quantity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified identifier of the Reservation being + /// returned + /// + [JsonProperty(PropertyName = "reservationId")] + public string ReservationId { get; set; } + + /// + /// Gets or sets quantity to be returned. Must be greater than zero. + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturnForExchange.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturnForExchange.cs new file mode 100644 index 0000000000000..95ba4dd520cc2 --- /dev/null +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservationToReturnForExchange.cs @@ -0,0 +1,84 @@ +// +// 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.Reservations.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reservation refund details + /// + public partial class ReservationToReturnForExchange + { + /// + /// Initializes a new instance of the ReservationToReturnForExchange + /// class. + /// + public ReservationToReturnForExchange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReservationToReturnForExchange + /// class. + /// + /// Fully qualified id of the Reservation + /// being returned. + /// Quantity to be returned + /// Possible values include: 'Succeeded', + /// 'Failed', 'Cancelled', 'Pending' + public ReservationToReturnForExchange(string reservationId = default(string), int? quantity = default(int?), Price billingRefundAmount = default(Price), BillingInformation billingInformation = default(BillingInformation), string status = default(string)) + { + ReservationId = reservationId; + Quantity = quantity; + BillingRefundAmount = billingRefundAmount; + BillingInformation = billingInformation; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified id of the Reservation being returned. + /// + [JsonProperty(PropertyName = "reservationId")] + public string ReservationId { get; set; } + + /// + /// Gets or sets quantity to be returned + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingRefundAmount")] + public Price BillingRefundAmount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "billingInformation")] + public BillingInformation BillingInformation { get; set; } + + /// + /// Gets or sets possible values include: 'Succeeded', 'Failed', + /// 'Cancelled', 'Pending' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservedResourceType.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservedResourceType.cs index 16d4b25593355..ed8328941b955 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservedResourceType.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ReservedResourceType.cs @@ -24,5 +24,17 @@ public static class ReservedResourceType public const string SqlDataWarehouse = "SqlDataWarehouse"; public const string VMwareCloudSimple = "VMwareCloudSimple"; public const string RedHatOsa = "RedHatOsa"; + public const string Databricks = "Databricks"; + public const string AppService = "AppService"; + public const string ManagedDisk = "ManagedDisk"; + public const string BlockBlob = "BlockBlob"; + public const string RedisCache = "RedisCache"; + public const string AzureDataExplorer = "AzureDataExplorer"; + public const string MySql = "MySql"; + public const string MariaDb = "MariaDb"; + public const string PostgreSql = "PostgreSql"; + public const string DedicatedHost = "DedicatedHost"; + public const string SapHana = "SapHana"; + public const string SqlAzureHybridBenefit = "SqlAzureHybridBenefit"; } } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ScopeProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ScopeProperties.cs index fcac9c80f39ed..8a3e30749277e 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ScopeProperties.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/ScopeProperties.cs @@ -11,7 +11,6 @@ namespace Microsoft.Azure.Management.Reservations.Models { using Newtonsoft.Json; - using System.Collections.Generic; using System.Linq; public partial class ScopeProperties @@ -29,10 +28,7 @@ public ScopeProperties() /// public ScopeProperties(string scope = default(string), bool? valid = default(bool?)) { - Scope = new List - { - scope - }; + Scope = scope; Valid = valid; CustomInit(); } @@ -44,8 +40,8 @@ public ScopeProperties() /// /// - [JsonProperty(PropertyName = "scopes")] - public List Scope { get; set; } + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } /// /// diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/SubscriptionScopeProperties.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/SubscriptionScopeProperties.cs index f7c1e46b3a426..2799a57eba0d6 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/SubscriptionScopeProperties.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/SubscriptionScopeProperties.cs @@ -30,7 +30,7 @@ public SubscriptionScopeProperties() /// Initializes a new instance of the SubscriptionScopeProperties /// class. /// - public SubscriptionScopeProperties(ScopeProperties scopes = default(ScopeProperties)) + public SubscriptionScopeProperties(IList scopes = default(IList)) { Scopes = scopes; CustomInit(); @@ -43,8 +43,8 @@ public SubscriptionScopeProperties() /// /// - [JsonProperty(PropertyName = "properties")] - public ScopeProperties Scopes { get; set; } + [JsonProperty(PropertyName = "scopes")] + public IList Scopes { get; set; } } } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/OperationOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/OperationOperations.cs index da28dd104bef9..de05d3b1fa966 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/OperationOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/OperationOperations.cs @@ -73,7 +73,7 @@ internal OperationOperations(AzureReservationAPIClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperations.cs index 1d8bb8a640fe2..49fbc47c5e669 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperations.cs @@ -71,10 +71,10 @@ internal ReservationOperations(AzureReservationAPIClient client) /// /// The cancellation token. /// - public async Task> AvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, SubscriptionScopeProperties body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginAvailableScopesWithHttpMessagesAsync(reservationOrderId, reservationId, body, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginAvailableScopesWithHttpMessagesAsync(reservationOrderId, reservationId, body, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -166,7 +166,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +354,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -574,7 +574,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -754,7 +754,7 @@ internal ReservationOperations(AzureReservationAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginAvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, SubscriptionScopeProperties body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginAvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (reservationOrderId == null) { @@ -768,7 +768,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -887,7 +887,7 @@ internal ReservationOperations(AzureReservationAPIClient 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")) @@ -900,7 +900,7 @@ internal ReservationOperations(AzureReservationAPIClient 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) { @@ -963,7 +963,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1156,7 +1156,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1355,7 +1355,7 @@ internal ReservationOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperationsExtensions.cs index 61135f6bf6230..db5eb86880488 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperationsExtensions.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperationsExtensions.cs @@ -41,7 +41,7 @@ public static partial class ReservationOperationsExtensions /// /// /// - public static Properties AvailableScopes(this IReservationOperations operations, string reservationOrderId, string reservationId, SubscriptionScopeProperties body) + public static AvailableScopeProperties AvailableScopes(this IReservationOperations operations, string reservationOrderId, string reservationId, AvailableScopeRequest body) { return operations.AvailableScopesAsync(reservationOrderId, reservationId, body).GetAwaiter().GetResult(); } @@ -67,7 +67,7 @@ public static Properties AvailableScopes(this IReservationOperations operations, /// /// The cancellation token. /// - public static async Task AvailableScopesAsync(this IReservationOperations operations, string reservationOrderId, string reservationId, SubscriptionScopeProperties body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AvailableScopesAsync(this IReservationOperations operations, string reservationOrderId, string reservationId, AvailableScopeRequest body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AvailableScopesWithHttpMessagesAsync(reservationOrderId, reservationId, body, null, cancellationToken).ConfigureAwait(false)) { @@ -379,7 +379,7 @@ public static IPage ListRevisions(this IReservationOperatio /// /// /// - public static Properties BeginAvailableScopes(this IReservationOperations operations, string reservationOrderId, string reservationId, SubscriptionScopeProperties body) + public static AvailableScopeProperties BeginAvailableScopes(this IReservationOperations operations, string reservationOrderId, string reservationId, AvailableScopeRequest body) { return operations.BeginAvailableScopesAsync(reservationOrderId, reservationId, body).GetAwaiter().GetResult(); } @@ -405,7 +405,7 @@ public static Properties BeginAvailableScopes(this IReservationOperations operat /// /// The cancellation token. /// - public static async Task BeginAvailableScopesAsync(this IReservationOperations operations, string reservationOrderId, string reservationId, SubscriptionScopeProperties body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginAvailableScopesAsync(this IReservationOperations operations, string reservationOrderId, string reservationId, AvailableScopeRequest body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginAvailableScopesWithHttpMessagesAsync(reservationOrderId, reservationId, body, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperations.cs index 18a326d48f7fb..dfa843f261608 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperations.cs @@ -86,7 +86,7 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -257,7 +257,7 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -461,7 +461,7 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -608,6 +608,199 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) return _result; } + /// + /// Change directory of `ReservationOrder`. + /// + /// + /// Change directory (tenant) of `ReservationOrder` and all `Reservation` under + /// it to specified tenant id + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed to change directory of reservation order + /// + /// + /// 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> ChangeDirectoryWithHttpMessagesAsync(string reservationOrderId, ChangeDirectoryRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (reservationOrderId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + string apiVersion = "2020-11-15-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("reservationOrderId", reservationOrderId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ChangeDirectory", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory").ToString(); + _url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId)); + 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) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + /// /// Purchase `ReservationOrder` /// @@ -651,7 +844,7 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperationsExtensions.cs index 1129492036810..854ec433bfcec 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperationsExtensions.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOrderOperationsExtensions.cs @@ -189,6 +189,54 @@ public static ReservationOrderResponse Purchase(this IReservationOrderOperations } } + /// + /// Change directory of `ReservationOrder`. + /// + /// + /// Change directory (tenant) of `ReservationOrder` and all `Reservation` under + /// it to specified tenant id + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed to change directory of reservation order + /// + public static ChangeDirectoryResponse ChangeDirectory(this IReservationOrderOperations operations, string reservationOrderId, ChangeDirectoryRequest body) + { + return operations.ChangeDirectoryAsync(reservationOrderId, body).GetAwaiter().GetResult(); + } + + /// + /// Change directory of `ReservationOrder`. + /// + /// + /// Change directory (tenant) of `ReservationOrder` and all `Reservation` under + /// it to specified tenant id + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed to change directory of reservation order + /// + /// + /// The cancellation token. + /// + public static async Task ChangeDirectoryAsync(this IReservationOrderOperations operations, string reservationOrderId, ChangeDirectoryRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ChangeDirectoryWithHttpMessagesAsync(reservationOrderId, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Purchase `ReservationOrder` /// diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs index 481a259e1a4e3..9015b2622a0a3 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs @@ -20,13 +20,16 @@ public static IEnumerable> ApiInfo_AzureReservatio return new Tuple[] { new Tuple("Capacity", "AutoQuotaIncrease", "2019-07-19-preview"), - new Tuple("Capacity", "GetAppliedReservationList", "2019-04-01"), - new Tuple("Capacity", "GetCatalog", "2019-04-01"), - new Tuple("Capacity", "Operation", "2019-04-01"), + new Tuple("Capacity", "CalculateExchange", "2020-10-01-preview"), + new Tuple("Capacity", "Exchange", "2020-10-01-preview"), + new Tuple("Capacity", "GetAppliedReservationList", "2020-10-01-preview"), + new Tuple("Capacity", "GetCatalog", "2020-10-01-preview"), + new Tuple("Capacity", "Operation", "2020-10-01-preview"), new Tuple("Capacity", "Quota", "2019-07-19-preview"), new Tuple("Capacity", "QuotaRequestStatus", "2019-07-19-preview"), - new Tuple("Capacity", "Reservation", "2019-04-01"), - new Tuple("Capacity", "ReservationOrder", "2019-04-01"), + new Tuple("Capacity", "Reservation", "2020-10-01-preview"), + new Tuple("Capacity", "ReservationOrder", "2020-10-01-preview"), + new Tuple("Capacity", "ReservationOrder", "2020-11-15-preview"), }.AsEnumerable(); } }