Skip to content

Commit

Permalink
.NET SDK Resource Provider:'Reservations'
Browse files Browse the repository at this point in the history
REST Spec PR 'Azure/azure-rest-api-specs#5715'
REST Spec PR Author 'gautam714'
REST Spec PR Last commit
  • Loading branch information
adxsdknet committed Apr 19, 2019
1 parent 85309e7 commit e476c25
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public partial interface IReservationOperations
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='append'>
/// Supported value of this query is renewProperties
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -133,7 +136,7 @@ public partial interface IReservationOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<ReservationResponse>> GetWithHttpMessagesAsync(string reservationId, string reservationOrderId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<ReservationResponse>> GetWithHttpMessagesAsync(string reservationId, string reservationOrderId, string append = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Updates a `Reservation`.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ public Patch()
/// <param name="instanceFlexibility">Possible values include: 'On',
/// 'Off'</param>
/// <param name="name">Name of the Reservation</param>
public Patch(string appliedScopeType = default(string), IList<string> appliedScopes = default(IList<string>), string instanceFlexibility = default(string), string name = default(string))
public Patch(string appliedScopeType = default(string), IList<string> appliedScopes = default(IList<string>), bool? renew = default(bool?), PurchaseRequest renewProperties = default(PurchaseRequest), string instanceFlexibility = default(string), string name = default(string))
{
AppliedScopeType = appliedScopeType;
AppliedScopes = appliedScopes;
Renew = renew;
RenewProperties = renewProperties;
InstanceFlexibility = instanceFlexibility;
Name = name;
CustomInit();
Expand All @@ -61,6 +63,16 @@ public Patch()
[JsonProperty(PropertyName = "properties.appliedScopes")]
public IList<string> AppliedScopes { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "properties.renew")]
public bool? Renew { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "properties.renewProperties")]
public PurchaseRequest RenewProperties { get; set; }

/// <summary>
/// Gets or sets possible values include: 'On', 'Off'
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public PurchaseRequest()
/// <param name="reservedResourceProperties">Properties specific to
/// each reserved resource type. Not required if not
/// applicable.</param>
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<string> appliedScopes = default(IList<string>), PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties = default(PurchaseRequestPropertiesReservedResourceProperties))
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<string> appliedScopes = default(IList<string>), bool? renew = default(bool?), PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties = default(PurchaseRequestPropertiesReservedResourceProperties))
{
Sku = sku;
Location = location;
Expand All @@ -53,6 +53,7 @@ public PurchaseRequest()
DisplayName = displayName;
AppliedScopeType = appliedScopeType;
AppliedScopes = appliedScopes;
Renew = renew;
ReservedResourceProperties = reservedResourceProperties;
CustomInit();
}
Expand Down Expand Up @@ -113,6 +114,11 @@ public PurchaseRequest()
[JsonProperty(PropertyName = "properties.appliedScopes")]
public IList<string> AppliedScopes { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "properties.renew")]
public bool? Renew { get; set; }

/// <summary>
/// Gets or sets properties specific to each reserved resource type.
/// Not required if not applicable.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Reservations.Models
{
using Newtonsoft.Json;
using System.Linq;

public partial class RenewPropertiesResponse
{
/// <summary>
/// Initializes a new instance of the RenewPropertiesResponse class.
/// </summary>
public RenewPropertiesResponse()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the RenewPropertiesResponse class.
/// </summary>
/// <param name="lockedPriceTotal">Locked currency &amp; amount for new
/// reservation purchase at the time of renewal. Price is locked 30
/// days before expiry date time if renew is true.</param>
/// <param name="links">Contains prev and next reservation Ids' because
/// of renewal.</param>
public RenewPropertiesResponse(PurchaseRequest purchaseProperties = default(PurchaseRequest), RenewPropertiesResponseLockedPriceTotal lockedPriceTotal = default(RenewPropertiesResponseLockedPriceTotal), RenewPropertiesResponseLinks links = default(RenewPropertiesResponseLinks))
{
PurchaseProperties = purchaseProperties;
LockedPriceTotal = lockedPriceTotal;
Links = links;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "purchaseProperties")]
public PurchaseRequest PurchaseProperties { get; set; }

/// <summary>
/// Gets or sets locked currency &amp;amp; amount for new reservation
/// purchase at the time of renewal. Price is locked 30 days before
/// expiry date time if renew is true.
/// </summary>
[JsonProperty(PropertyName = "lockedPriceTotal")]
public RenewPropertiesResponseLockedPriceTotal LockedPriceTotal { get; set; }

/// <summary>
/// Gets or sets contains prev and next reservation Ids' because of
/// renewal.
/// </summary>
[JsonProperty(PropertyName = "links")]
public RenewPropertiesResponseLinks Links { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Reservations.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Contains prev and next reservation Ids' because of renewal.
/// </summary>
public partial class RenewPropertiesResponseLinks
{
/// <summary>
/// Initializes a new instance of the RenewPropertiesResponseLinks
/// class.
/// </summary>
public RenewPropertiesResponseLinks()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the RenewPropertiesResponseLinks
/// class.
/// </summary>
/// <param name="renewSource">Reservation Id of the reservation from
/// which this reservation is renewed. Format of the resource Id is
/// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.</param>
/// <param name="renewDestination">Reservation Id of the reservation
/// which is purchased because of renew. Format of the resource Id is
/// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.</param>
public RenewPropertiesResponseLinks(string renewSource = default(string), string renewDestination = default(string))
{
RenewSource = renewSource;
RenewDestination = renewDestination;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets reservation Id of the reservation from which this
/// reservation is renewed. Format of the resource Id is
/// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
/// </summary>
[JsonProperty(PropertyName = "renewSource")]
public string RenewSource { get; set; }

/// <summary>
/// Gets or sets reservation Id of the reservation which is purchased
/// because of renew. Format of the resource Id is
/// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
/// </summary>
[JsonProperty(PropertyName = "renewDestination")]
public string RenewDestination { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Reservations.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Locked currency &amp; amount for new reservation purchase at the time
/// of renewal. Price is locked 30 days before expiry date time if renew is
/// true.
/// </summary>
public partial class RenewPropertiesResponseLockedPriceTotal
{
/// <summary>
/// Initializes a new instance of the
/// RenewPropertiesResponseLockedPriceTotal class.
/// </summary>
public RenewPropertiesResponseLockedPriceTotal()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the
/// RenewPropertiesResponseLockedPriceTotal class.
/// </summary>
public RenewPropertiesResponseLockedPriceTotal(string currencyCode = default(string), string amount = default(string))
{
CurrencyCode = currencyCode;
Amount = amount;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "currencyCode")]
public string CurrencyCode { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "amount")]
public string Amount { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ReservationProperties()
/// expire.</param>
/// <param name="skuDescription">Description of the SKU in
/// english.</param>
public ReservationProperties(string reservedResourceType = default(string), string instanceFlexibility = default(string), string displayName = default(string), IList<string> appliedScopes = default(IList<string>), string appliedScopeType = default(string), int? quantity = default(int?), string provisioningState = default(string), System.DateTime? effectiveDateTime = default(System.DateTime?), System.DateTime? lastUpdatedDateTime = default(System.DateTime?), System.DateTime? expiryDate = default(System.DateTime?), string skuDescription = default(string), ExtendedStatusInfo extendedStatusInfo = default(ExtendedStatusInfo), ReservationSplitProperties splitProperties = default(ReservationSplitProperties), ReservationMergeProperties mergeProperties = default(ReservationMergeProperties))
public ReservationProperties(string reservedResourceType = default(string), string instanceFlexibility = default(string), string displayName = default(string), IList<string> appliedScopes = default(IList<string>), string appliedScopeType = default(string), int? quantity = default(int?), string provisioningState = default(string), System.DateTime? effectiveDateTime = default(System.DateTime?), System.DateTime? lastUpdatedDateTime = default(System.DateTime?), System.DateTime? expiryDate = default(System.DateTime?), string skuDescription = default(string), ExtendedStatusInfo extendedStatusInfo = default(ExtendedStatusInfo), ReservationSplitProperties splitProperties = default(ReservationSplitProperties), ReservationMergeProperties mergeProperties = default(ReservationMergeProperties), bool? renew = default(bool?), RenewPropertiesResponse renewProperties = default(RenewPropertiesResponse))
{
ReservedResourceType = reservedResourceType;
InstanceFlexibility = instanceFlexibility;
Expand All @@ -64,6 +64,8 @@ public ReservationProperties()
ExtendedStatusInfo = extendedStatusInfo;
SplitProperties = splitProperties;
MergeProperties = mergeProperties;
Renew = renew;
RenewProperties = renewProperties;
CustomInit();
}

Expand Down Expand Up @@ -155,5 +157,15 @@ public ReservationProperties()
[JsonProperty(PropertyName = "mergeProperties")]
public ReservationMergeProperties MergeProperties { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "renew")]
public bool? Renew { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "renewProperties")]
public RenewPropertiesResponse RenewProperties { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ internal ReservationOperations(AzureReservationAPIClient client)
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='append'>
/// Supported value of this query is renewProperties
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -315,7 +318,7 @@ internal ReservationOperations(AzureReservationAPIClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<ReservationResponse>> GetWithHttpMessagesAsync(string reservationId, string reservationOrderId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<ReservationResponse>> GetWithHttpMessagesAsync(string reservationId, string reservationOrderId, string append = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationId == null)
{
Expand All @@ -338,6 +341,7 @@ internal ReservationOperations(AzureReservationAPIClient client)
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationId", reservationId);
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("append", append);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
Expand All @@ -351,6 +355,10 @@ internal ReservationOperations(AzureReservationAPIClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (append != null)
{
_queryParameters.Add(string.Format("append={0}", System.Uri.EscapeDataString(append)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,12 @@ public static IPage<ReservationResponse> List(this IReservationOperations operat
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
public static ReservationResponse Get(this IReservationOperations operations, string reservationId, string reservationOrderId)
/// <param name='append'>
/// Supported value of this query is renewProperties
/// </param>
public static ReservationResponse Get(this IReservationOperations operations, string reservationId, string reservationOrderId, string append = default(string))
{
return operations.GetAsync(reservationId, reservationOrderId).GetAwaiter().GetResult();
return operations.GetAsync(reservationId, reservationOrderId, append).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -194,12 +197,15 @@ public static ReservationResponse Get(this IReservationOperations operations, st
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='append'>
/// Supported value of this query is renewProperties
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ReservationResponse> GetAsync(this IReservationOperations operations, string reservationId, string reservationOrderId, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<ReservationResponse> GetAsync(this IReservationOperations operations, string reservationId, string reservationOrderId, string append = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(reservationId, reservationOrderId, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.GetWithHttpMessagesAsync(reservationId, reservationOrderId, append, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down

0 comments on commit e476c25

Please sign in to comment.