diff --git a/src/SDKs/Reservations/AzSdk.RP.props b/src/SDKs/Reservations/AzSdk.RP.props index 2da5875be74b..832ce654ff3d 100644 --- a/src/SDKs/Reservations/AzSdk.RP.props +++ b/src/SDKs/Reservations/AzSdk.RP.props @@ -1,7 +1,7 @@ - Capacity_2018-06-01; + Capacity_2019-04-01; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/AzureReservationAPIClient.cs b/src/SDKs/Reservations/Management.Reservations/Generated/AzureReservationAPIClient.cs index f546107195f5..9e1eb1c0e28f 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/AzureReservationAPIClient.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/AzureReservationAPIClient.cs @@ -49,7 +49,7 @@ public partial class AzureReservationAPIClient : ServiceClient - /// Supported version. + /// Supported version for this document is 2019-04-01 /// public string ApiVersion { get; private set; } @@ -331,7 +331,7 @@ private void Initialize() Reservation = new ReservationOperations(this); Operation = new OperationOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-06-01"; + ApiVersion = "2019-04-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/IAzureReservationAPIClient.cs b/src/SDKs/Reservations/Management.Reservations/Generated/IAzureReservationAPIClient.cs index f5f3deafc61a..4d318e06981c 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/IAzureReservationAPIClient.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/IAzureReservationAPIClient.cs @@ -45,7 +45,7 @@ public partial interface IAzureReservationAPIClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Supported version. + /// Supported version for this document is 2019-04-01 /// string ApiVersion { get; } diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/IReservationOrderOperations.cs b/src/SDKs/Reservations/Management.Reservations/Generated/IReservationOrderOperations.cs index 248fb3af5df7..23e6bdaf0b20 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/IReservationOrderOperations.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/IReservationOrderOperations.cs @@ -23,6 +23,32 @@ namespace Microsoft.Azure.Management.Reservations /// public partial interface IReservationOrderOperations { + /// + /// Calculate price for a `ReservationOrder`. + /// + /// + /// Calculate price for placing a `ReservationOrder` + /// + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// 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> CalculateWithHttpMessagesAsync(PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all `ReservationOrder`s. /// @@ -47,6 +73,36 @@ public partial interface IReservationOrderOperations /// Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the + /// specificed URI + /// + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// 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> PurchaseWithHttpMessagesAsync(string reservationOrderId, PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Get a specific `ReservationOrder`. /// /// @@ -72,6 +128,36 @@ public partial interface IReservationOrderOperations /// Task> GetWithHttpMessagesAsync(string reservationOrderId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the + /// specificed URI + /// + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// 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> BeginPurchaseWithHttpMessagesAsync(string reservationOrderId, PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Get all `ReservationOrder`s. /// /// diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponse.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponse.cs new file mode 100644 index 000000000000..7f8ffdb26305 --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponse.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 CalculatePriceResponse + { + /// + /// Initializes a new instance of the CalculatePriceResponse class. + /// + public CalculatePriceResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CalculatePriceResponse class. + /// + public CalculatePriceResponse(CalculatePriceResponseProperties properties = default(CalculatePriceResponseProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CalculatePriceResponseProperties Properties { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponseProperties.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponseProperties.cs new file mode 100644 index 000000000000..b1d85159bb7b --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponseProperties.cs @@ -0,0 +1,102 @@ +// +// 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 CalculatePriceResponseProperties + { + /// + /// Initializes a new instance of the CalculatePriceResponseProperties + /// class. + /// + public CalculatePriceResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CalculatePriceResponseProperties + /// class. + /// + /// Currency and amount that + /// customer will be charged in customer's local currency. Tax is not + /// included. + /// True if billing is managed by + /// Microsoft Partner. Used only for CSP accounts. + /// GUID that represents reservation + /// order that can be placed after calculating price. + /// Title of SKU that is being + /// purchased. + /// Description of SKU that is being + /// purchased. + /// Amount that Microsoft uses for + /// record. Used during refund for calculating refund limit. Tax is not + /// included. + public CalculatePriceResponseProperties(CalculatePriceResponsePropertiesBillingCurrencyTotal billingCurrencyTotal = default(CalculatePriceResponsePropertiesBillingCurrencyTotal), bool? isBillingPartnerManaged = default(bool?), string reservationOrderId = default(string), string skuTitle = default(string), string skuDescription = default(string), CalculatePriceResponsePropertiesPricingCurrencyTotal pricingCurrencyTotal = default(CalculatePriceResponsePropertiesPricingCurrencyTotal)) + { + BillingCurrencyTotal = billingCurrencyTotal; + IsBillingPartnerManaged = isBillingPartnerManaged; + ReservationOrderId = reservationOrderId; + SkuTitle = skuTitle; + SkuDescription = skuDescription; + PricingCurrencyTotal = pricingCurrencyTotal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets currency and amount that customer will be charged in + /// customer's local currency. Tax is not included. + /// + [JsonProperty(PropertyName = "billingCurrencyTotal")] + public CalculatePriceResponsePropertiesBillingCurrencyTotal BillingCurrencyTotal { get; set; } + + /// + /// Gets or sets true if billing is managed by Microsoft Partner. Used + /// only for CSP accounts. + /// + [JsonProperty(PropertyName = "isBillingPartnerManaged")] + public bool? IsBillingPartnerManaged { get; set; } + + /// + /// Gets or sets GUID that represents reservation order that can be + /// placed after calculating price. + /// + [JsonProperty(PropertyName = "reservationOrderId")] + public string ReservationOrderId { get; set; } + + /// + /// Gets or sets title of SKU that is being purchased. + /// + [JsonProperty(PropertyName = "skuTitle")] + public string SkuTitle { get; set; } + + /// + /// Gets or sets description of SKU that is being purchased. + /// + [JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription { get; set; } + + /// + /// Gets or sets amount that Microsoft uses for record. Used during + /// refund for calculating refund limit. Tax is not included. + /// + [JsonProperty(PropertyName = "pricingCurrencyTotal")] + public CalculatePriceResponsePropertiesPricingCurrencyTotal PricingCurrencyTotal { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesBillingCurrencyTotal.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesBillingCurrencyTotal.cs new file mode 100644 index 000000000000..0f1bc21d536b --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesBillingCurrencyTotal.cs @@ -0,0 +1,58 @@ +// +// 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; + + /// + /// Currency and amount that customer will be charged in customer's local + /// currency. Tax is not included. + /// + public partial class CalculatePriceResponsePropertiesBillingCurrencyTotal + { + /// + /// Initializes a new instance of the + /// CalculatePriceResponsePropertiesBillingCurrencyTotal class. + /// + public CalculatePriceResponsePropertiesBillingCurrencyTotal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CalculatePriceResponsePropertiesBillingCurrencyTotal class. + /// + public CalculatePriceResponsePropertiesBillingCurrencyTotal(string currencyCode = default(string), double? amount = default(double?)) + { + CurrencyCode = currencyCode; + Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "currencyCode")] + public string CurrencyCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "amount")] + public double? Amount { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesPricingCurrencyTotal.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesPricingCurrencyTotal.cs new file mode 100644 index 000000000000..272e58574bf6 --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/CalculatePriceResponsePropertiesPricingCurrencyTotal.cs @@ -0,0 +1,58 @@ +// +// 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; + + /// + /// Amount that Microsoft uses for record. Used during refund for + /// calculating refund limit. Tax is not included. + /// + public partial class CalculatePriceResponsePropertiesPricingCurrencyTotal + { + /// + /// Initializes a new instance of the + /// CalculatePriceResponsePropertiesPricingCurrencyTotal class. + /// + public CalculatePriceResponsePropertiesPricingCurrencyTotal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CalculatePriceResponsePropertiesPricingCurrencyTotal class. + /// + public CalculatePriceResponsePropertiesPricingCurrencyTotal(string currencyCode = default(string), double? amount = default(double?)) + { + CurrencyCode = currencyCode; + Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "currencyCode")] + public string CurrencyCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "amount")] + public double? Amount { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/InstanceFlexibility.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/InstanceFlexibility.cs index f9406920a5ee..dd8fc9c44f37 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/Models/InstanceFlexibility.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/InstanceFlexibility.cs @@ -16,8 +16,7 @@ namespace Microsoft.Azure.Management.Reservations.Models /// public static class InstanceFlexibility { - public const string On = "On"; - public const string Off = "Off"; - public const string NotSupported = "NotSupported"; + public const string True = "True"; + public const string False = "False"; } } diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/Patch.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/Patch.cs index a8db09e51b4d..fb36b90394d8 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/Models/Patch.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/Patch.cs @@ -33,8 +33,8 @@ public Patch() /// /// Possible values include: 'Single', /// 'Shared' - /// Possible values include: 'On', - /// 'Off', 'NotSupported' + /// Possible values include: 'True', + /// 'False' /// Name of the Reservation public Patch(string appliedScopeType = default(string), IList appliedScopes = default(IList), string instanceFlexibility = default(string), string name = default(string)) { @@ -62,7 +62,7 @@ public Patch() public IList AppliedScopes { get; set; } /// - /// Gets or sets possible values include: 'On', 'Off', 'NotSupported' + /// Gets or sets possible values include: 'True', 'False' /// [JsonProperty(PropertyName = "properties.instanceFlexibility")] public string InstanceFlexibility { get; set; } diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequest.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequest.cs new file mode 100644 index 000000000000..ea8f3d3e65a6 --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequest.cs @@ -0,0 +1,124 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class PurchaseRequest + { + /// + /// Initializes a new instance of the PurchaseRequest class. + /// + public PurchaseRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PurchaseRequest class. + /// + /// The Azure Region where the reserved resource + /// lives. + /// Possible values include: + /// 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb' + /// Possible values include: 'P1Y', 'P3Y' + /// Friendly name of the Reservation + /// Possible values include: 'Single', + /// 'Shared' + /// Properties specific to + /// each reserved resource type. Not required if not + /// applicable. + public PurchaseRequest(SkuName sku = default(SkuName), string location = default(string), string reservedResourceType = default(string), string billingScopeId = default(string), string term = default(string), int? quantity = default(int?), string displayName = default(string), string appliedScopeType = default(string), IList appliedScopes = default(IList), PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties = default(PurchaseRequestPropertiesReservedResourceProperties)) + { + Sku = sku; + Location = location; + ReservedResourceType = reservedResourceType; + BillingScopeId = billingScopeId; + Term = term; + Quantity = quantity; + DisplayName = displayName; + AppliedScopeType = appliedScopeType; + AppliedScopes = appliedScopes; + ReservedResourceProperties = reservedResourceProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sku")] + public SkuName Sku { get; set; } + + /// + /// Gets or sets the Azure Region where the reserved resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets possible values include: 'VirtualMachines', + /// 'SqlDatabases', 'SuseLinux', 'CosmosDb' + /// + [JsonProperty(PropertyName = "properties.reservedResourceType")] + public string ReservedResourceType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.billingScopeId")] + public string BillingScopeId { get; set; } + + /// + /// Gets or sets possible values include: 'P1Y', 'P3Y' + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.quantity")] + public int? Quantity { get; set; } + + /// + /// Gets or sets friendly name of the Reservation + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets possible values include: 'Single', 'Shared' + /// + [JsonProperty(PropertyName = "properties.appliedScopeType")] + public string AppliedScopeType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.appliedScopes")] + public IList AppliedScopes { get; set; } + + /// + /// Gets or sets properties specific to each reserved resource type. + /// Not required if not applicable. + /// + [JsonProperty(PropertyName = "properties.reservedResourceProperties")] + public PurchaseRequestPropertiesReservedResourceProperties ReservedResourceProperties { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequestPropertiesReservedResourceProperties.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequestPropertiesReservedResourceProperties.cs new file mode 100644 index 000000000000..e4385db1a2a6 --- /dev/null +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/PurchaseRequestPropertiesReservedResourceProperties.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; + + /// + /// Properties specific to each reserved resource type. Not required if not + /// applicable. + /// + public partial class PurchaseRequestPropertiesReservedResourceProperties + { + /// + /// Initializes a new instance of the + /// PurchaseRequestPropertiesReservedResourceProperties class. + /// + public PurchaseRequestPropertiesReservedResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PurchaseRequestPropertiesReservedResourceProperties class. + /// + /// Possible values include: 'True', + /// 'False' + public PurchaseRequestPropertiesReservedResourceProperties(string instanceFlexibility = default(string)) + { + InstanceFlexibility = instanceFlexibility; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'True', 'False' + /// + [JsonProperty(PropertyName = "instanceFlexibility")] + public string InstanceFlexibility { get; set; } + + } +} diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationOrderResponse.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationOrderResponse.cs index a5cb1c9c63fe..494de3e7327f 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationOrderResponse.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationOrderResponse.cs @@ -42,8 +42,6 @@ public ReservationOrderResponse() /// reservation was created. /// This is the date when the Reservation will /// expire. - /// Total Quantity of the SKUs purchased - /// in the Reservation. /// Possible values include: 'P1Y', 'P3Y' /// Current state of the /// reservation. @@ -116,8 +114,6 @@ public ReservationOrderResponse() public System.DateTime? ExpiryDate { get; set; } /// - /// Gets or sets total Quantity of the SKUs purchased in the - /// Reservation. /// [JsonProperty(PropertyName = "properties.originalQuantity")] public int? OriginalQuantity { get; set; } diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationProperties.cs b/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationProperties.cs index 11f38fe62780..bb48539d5f54 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationProperties.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/Models/ReservationProperties.cs @@ -32,14 +32,12 @@ public ReservationProperties() /// /// Possible values include: /// 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb' - /// Possible values include: 'On', - /// 'Off', 'NotSupported' + /// Possible values include: 'True', + /// 'False' /// Friendly name for user to easily identify /// the reservation /// Possible values include: 'Single', /// 'Shared' - /// Quantity of the SKUs that are part of the - /// Reservation. /// Current state of the /// reservation. /// DateTime of the Reservation @@ -82,7 +80,7 @@ public ReservationProperties() public string ReservedResourceType { get; set; } /// - /// Gets or sets possible values include: 'On', 'Off', 'NotSupported' + /// Gets or sets possible values include: 'True', 'False' /// [JsonProperty(PropertyName = "instanceFlexibility")] public string InstanceFlexibility { get; set; } @@ -106,7 +104,6 @@ public ReservationProperties() public string AppliedScopeType { get; set; } /// - /// Gets or sets quantity of the SKUs that are part of the Reservation. /// [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperations.cs b/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperations.cs index 171ef7fad582..c33a520c6b1b 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperations.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperations.cs @@ -50,6 +50,192 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) /// public AzureReservationAPIClient Client { get; private set; } + /// + /// Calculate price for a `ReservationOrder`. + /// + /// + /// Calculate price for placing a `ReservationOrder` + /// + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// 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> CalculateWithHttpMessagesAsync(PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Calculate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/calculatePrice").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + /// /// Get all `ReservationOrder`s. /// @@ -222,6 +408,32 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) return _result; } + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PurchaseWithHttpMessagesAsync(string reservationOrderId, PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPurchaseWithHttpMessagesAsync(reservationOrderId, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Get a specific `ReservationOrder`. /// @@ -402,6 +614,219 @@ internal ReservationOrderOperations(AzureReservationAPIClient client) return _result; } + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// 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> BeginPurchaseWithHttpMessagesAsync(string reservationOrderId, PurchaseRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (reservationOrderId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("reservationOrderId", reservationOrderId); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPurchase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}").ToString(); + _url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + /// /// Get all `ReservationOrder`s. /// diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperationsExtensions.cs b/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperationsExtensions.cs index 5cf37f019442..6a2dd003e175 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperationsExtensions.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/ReservationOrderOperationsExtensions.cs @@ -21,6 +21,48 @@ namespace Microsoft.Azure.Management.Reservations /// public static partial class ReservationOrderOperationsExtensions { + /// + /// Calculate price for a `ReservationOrder`. + /// + /// + /// Calculate price for placing a `ReservationOrder` + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Information needed for calculate or purchase reservation + /// + public static CalculatePriceResponse Calculate(this IReservationOrderOperations operations, PurchaseRequest body) + { + return operations.CalculateAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Calculate price for a `ReservationOrder`. + /// + /// + /// Calculate price for placing a `ReservationOrder` + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// The cancellation token. + /// + public static async Task CalculateAsync(this IReservationOrderOperations operations, PurchaseRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CalculateWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get all `ReservationOrder`s. /// @@ -57,6 +99,54 @@ public static IPage List(this IReservationOrderOperati } } + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + public static ReservationOrderResponse Purchase(this IReservationOrderOperations operations, string reservationOrderId, PurchaseRequest body) + { + return operations.PurchaseAsync(reservationOrderId, body).GetAwaiter().GetResult(); + } + + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// The cancellation token. + /// + public static async Task PurchaseAsync(this IReservationOrderOperations operations, string reservationOrderId, PurchaseRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PurchaseWithHttpMessagesAsync(reservationOrderId, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get a specific `ReservationOrder`. /// @@ -97,6 +187,54 @@ public static ReservationOrderResponse Get(this IReservationOrderOperations oper } } + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + public static ReservationOrderResponse BeginPurchase(this IReservationOrderOperations operations, string reservationOrderId, PurchaseRequest body) + { + return operations.BeginPurchaseAsync(reservationOrderId, body).GetAwaiter().GetResult(); + } + + /// + /// Purchase `ReservationOrder` + /// + /// + /// Purchase `ReservationOrder` and create resource under the specificed URI + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Order Id of the reservation + /// + /// + /// Information needed for calculate or purchase reservation + /// + /// + /// The cancellation token. + /// + public static async Task BeginPurchaseAsync(this IReservationOrderOperations operations, string reservationOrderId, PurchaseRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPurchaseWithHttpMessagesAsync(reservationOrderId, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get all `ReservationOrder`s. /// diff --git a/src/SDKs/Reservations/Management.Reservations/Generated/SdkInfo_AzureReservationAPI.cs b/src/SDKs/Reservations/Management.Reservations/Generated/SdkInfo_AzureReservationAPI.cs index bdf6746ee0b7..0d3ec05fb76b 100644 --- a/src/SDKs/Reservations/Management.Reservations/Generated/SdkInfo_AzureReservationAPI.cs +++ b/src/SDKs/Reservations/Management.Reservations/Generated/SdkInfo_AzureReservationAPI.cs @@ -1,3 +1,4 @@ + // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is @@ -18,23 +19,13 @@ public static IEnumerable> ApiInfo_AzureReservatio { return new Tuple[] { - new Tuple("Capacity", "GetAppliedReservationList", "2018-06-01"), - new Tuple("Capacity", "GetCatalog", "2018-06-01"), - new Tuple("Capacity", "Operation", "2018-06-01"), - new Tuple("Capacity", "Reservation", "2018-06-01"), - new Tuple("Capacity", "ReservationOrder", "2018-06-01"), + new Tuple("Capacity", "GetAppliedReservationList", "2019-04-01"), + new Tuple("Capacity", "GetCatalog", "2019-04-01"), + new Tuple("Capacity", "Operation", "2019-04-01"), + new Tuple("Capacity", "Reservation", "2019-04-01"), + new Tuple("Capacity", "ReservationOrder", "2019-04-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "(empty)"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/reservations/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\AzureSDK\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "42f4b3eb96f88ab5d477785cf7a29bde8e0a1b87"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } }