From dab1f49829dec458b334a4c5705f3ff4d91e2881 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Thu, 19 Sep 2019 10:46:00 +0800 Subject: [PATCH] [AutoPR reservations/resource-manager] [Hub Generated] Review request for Microsoft.Capacity to add version preview/2019-04-01 (#5766) * Generated from f19a2e5b7f384018b74b21b7b8b8782d95b456f9 fixed x-ms-enum value * Generated from 2f56008117d578bec6cc8b8c832926f45a0fe52e fixed catalog definition * Generated from cac978330e8c7b9583812a735cfeac97fb267056 reverted breaking operation id change --- .../reservations/mgmt/reservations/models.go | 26 +++ .../mgmt/2019-04-01/reservations/client.go | 3 +- .../mgmt/2019-04-01/reservations/models.go | 155 ++++++++++++++++-- .../mgmt/2019-04-01/reservations/order.go | 10 +- .../reservationsapi/interfaces.go | 2 +- 5 files changed, 181 insertions(+), 15 deletions(-) diff --git a/profiles/preview/preview/reservations/mgmt/reservations/models.go b/profiles/preview/preview/reservations/mgmt/reservations/models.go index 56e317240017..93e8b2bf8b0f 100644 --- a/profiles/preview/preview/reservations/mgmt/reservations/models.go +++ b/profiles/preview/preview/reservations/mgmt/reservations/models.go @@ -103,6 +103,22 @@ const ( On InstanceFlexibility = original.On ) +type PaymentStatus = original.PaymentStatus + +const ( + Cancelled PaymentStatus = original.Cancelled + Failed PaymentStatus = original.Failed + Scheduled PaymentStatus = original.Scheduled + Succeeded PaymentStatus = original.Succeeded +) + +type ReservationBillingPlan = original.ReservationBillingPlan + +const ( + Monthly ReservationBillingPlan = original.Monthly + Upfront ReservationBillingPlan = original.Upfront +) + type ReservationTerm = original.ReservationTerm const ( @@ -146,6 +162,7 @@ type CalculatePriceResponseProperties = original.CalculatePriceResponsePropertie type CalculatePriceResponsePropertiesBillingCurrencyTotal = original.CalculatePriceResponsePropertiesBillingCurrencyTotal type CalculatePriceResponsePropertiesPricingCurrencyTotal = original.CalculatePriceResponsePropertiesPricingCurrencyTotal type Catalog = original.Catalog +type CatalogBillingPlansItem = original.CatalogBillingPlansItem type Client = original.Client type Error = original.Error type ExtendedErrorInfo = original.ExtendedErrorInfo @@ -164,6 +181,7 @@ type OperationList = original.OperationList type OperationListIterator = original.OperationListIterator type OperationListPage = original.OperationListPage type OperationResponse = original.OperationResponse +type OrderBillingPlanInformation = original.OrderBillingPlanInformation type OrderClient = original.OrderClient type OrderList = original.OrderList type OrderListIterator = original.OrderListIterator @@ -174,6 +192,8 @@ type OrderResponse = original.OrderResponse type Patch = original.Patch type PatchProperties = original.PatchProperties type PatchPropertiesRenewProperties = original.PatchPropertiesRenewProperties +type PaymentDetail = original.PaymentDetail +type Price = original.Price type Properties = original.Properties type PropertiesType = original.PropertiesType type PurchaseRequest = original.PurchaseRequest @@ -247,6 +267,12 @@ func PossibleErrorResponseCodeValues() []ErrorResponseCode { func PossibleInstanceFlexibilityValues() []InstanceFlexibility { return original.PossibleInstanceFlexibilityValues() } +func PossiblePaymentStatusValues() []PaymentStatus { + return original.PossiblePaymentStatusValues() +} +func PossibleReservationBillingPlanValues() []ReservationBillingPlan { + return original.PossibleReservationBillingPlanValues() +} func PossibleReservationTermValues() []ReservationTerm { return original.PossibleReservationTermValues() } diff --git a/services/preview/reservations/mgmt/2019-04-01/reservations/client.go b/services/preview/reservations/mgmt/2019-04-01/reservations/client.go index dcb86a49a12b..27662ed4f1de 100644 --- a/services/preview/reservations/mgmt/2019-04-01/reservations/client.go +++ b/services/preview/reservations/mgmt/2019-04-01/reservations/client.go @@ -52,7 +52,8 @@ func NewWithBaseURI(baseURI string) BaseClient { } } -// GetAppliedReservationList get applicable `Reservation`s that are applied to this subscription. +// GetAppliedReservationList get applicable `Reservation`s that are applied to this subscription or a resource group +// under this subscription. // Parameters: // subscriptionID - id of the subscription func (client BaseClient) GetAppliedReservationList(ctx context.Context, subscriptionID string) (result AppliedReservations, err error) { diff --git a/services/preview/reservations/mgmt/2019-04-01/reservations/models.go b/services/preview/reservations/mgmt/2019-04-01/reservations/models.go index 6cc43ecb16d1..6e01aed5501e 100644 --- a/services/preview/reservations/mgmt/2019-04-01/reservations/models.go +++ b/services/preview/reservations/mgmt/2019-04-01/reservations/models.go @@ -182,6 +182,40 @@ func PossibleInstanceFlexibilityValues() []InstanceFlexibility { return []InstanceFlexibility{Off, On} } +// PaymentStatus enumerates the values for payment status. +type PaymentStatus string + +const ( + // Cancelled ... + Cancelled PaymentStatus = "Cancelled" + // Failed ... + Failed PaymentStatus = "Failed" + // Scheduled ... + Scheduled PaymentStatus = "Scheduled" + // Succeeded ... + Succeeded PaymentStatus = "Succeeded" +) + +// PossiblePaymentStatusValues returns an array of possible values for the PaymentStatus const type. +func PossiblePaymentStatusValues() []PaymentStatus { + return []PaymentStatus{Cancelled, Failed, Scheduled, Succeeded} +} + +// ReservationBillingPlan enumerates the values for reservation billing plan. +type ReservationBillingPlan string + +const ( + // Monthly ... + Monthly ReservationBillingPlan = "Monthly" + // Upfront ... + Upfront ReservationBillingPlan = "Upfront" +) + +// PossibleReservationBillingPlanValues returns an array of possible values for the ReservationBillingPlan const type. +func PossibleReservationBillingPlanValues() []ReservationBillingPlan { + return []ReservationBillingPlan{Monthly, Upfront} +} + // ReservationTerm enumerates the values for reservation term. type ReservationTerm string @@ -357,6 +391,7 @@ type CalculatePriceResponseProperties struct { SkuDescription *string `json:"skuDescription,omitempty"` // PricingCurrencyTotal - Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. PricingCurrencyTotal *CalculatePriceResponsePropertiesPricingCurrencyTotal `json:"pricingCurrencyTotal,omitempty"` + PaymentSchedule *[]PaymentDetail `json:"paymentSchedule,omitempty"` } // CalculatePriceResponsePropertiesBillingCurrencyTotal currency and amount that customer will be charged @@ -379,6 +414,8 @@ type Catalog struct { ResourceType *string `json:"resourceType,omitempty"` // Name - READ-ONLY; The name of SKU Name *string `json:"name,omitempty"` + // BillingPlans - The billing plan options available for this SKU. + BillingPlans *[]CatalogBillingPlansItem `json:"billingPlans,omitempty"` // Terms - READ-ONLY; Available reservation terms for this resource Terms *[]ReservationTerm `json:"terms,omitempty"` // Locations - READ-ONLY @@ -389,6 +426,62 @@ type Catalog struct { Restrictions *[]SkuRestriction `json:"restrictions,omitempty"` } +// CatalogBillingPlansItem ... +type CatalogBillingPlansItem struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string][]ReservationBillingPlan `json:""` + // Name - The term for the billing SKU is available for. Possible values include: 'P1Y', 'P3Y' + Name ReservationTerm `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for CatalogBillingPlansItem. +func (cPi CatalogBillingPlansItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cPi.Name != "" { + objectMap["name"] = cPi.Name + } + for k, v := range cPi.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CatalogBillingPlansItem struct. +func (cPi *CatalogBillingPlansItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties []ReservationBillingPlan + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if cPi.AdditionalProperties == nil { + cPi.AdditionalProperties = make(map[string][]ReservationBillingPlan) + } + cPi.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name ReservationTerm + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cPi.Name = name + } + } + } + + return nil +} + // Error ... type Error struct { Error *ExtendedErrorInfo `json:"error,omitempty"` @@ -778,6 +871,17 @@ type OperationResponse struct { Origin *string `json:"origin,omitempty"` } +// OrderBillingPlanInformation information describing the type of billing plan for this reservation. +type OrderBillingPlanInformation struct { + // PricingCurrencyTotal - Amount of money to be paid for the Order. Tax is not included. + PricingCurrencyTotal *Price `json:"pricingCurrencyTotal,omitempty"` + // StartDate - Date when the billing plan has started. + StartDate *date.Date `json:"startDate,omitempty"` + // NextPaymentDueDate - For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. + NextPaymentDueDate *date.Date `json:"nextPaymentDueDate,omitempty"` + Transactions *[]PaymentDetail `json:"transactions,omitempty"` +} + // OrderList ... type OrderList struct { autorest.Response `json:"-"` @@ -937,8 +1041,11 @@ type OrderProperties struct { // Term - Possible values include: 'P1Y', 'P3Y' Term ReservationTerm `json:"term,omitempty"` // ProvisioningState - Current state of the reservation. - ProvisioningState *string `json:"provisioningState,omitempty"` - ReservationsProperty *[]Response `json:"reservations,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + // BillingPlan - Possible values include: 'Upfront', 'Monthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + PlanInformation *OrderBillingPlanInformation `json:"planInformation,omitempty"` + ReservationsProperty *[]Response `json:"reservations,omitempty"` } // OrderPurchaseFuture an abstraction for monitoring and retrieving the results of a long-running @@ -1111,6 +1218,30 @@ type PatchPropertiesRenewProperties struct { PurchaseProperties *PurchaseRequest `json:"purchaseProperties,omitempty"` } +// PaymentDetail information about payment related to a reservation order. +type PaymentDetail struct { + // DueDate - Date when the payment needs to be done. + DueDate *date.Date `json:"dueDate,omitempty"` + // PaymentDate - Date when the transaction is completed. Is null when it is scheduled. + PaymentDate *date.Date `json:"paymentDate,omitempty"` + // PricingCurrencyTotal - Amount in pricing currency. Tax not included. + PricingCurrencyTotal *Price `json:"pricingCurrencyTotal,omitempty"` + // BillingCurrencyTotal - Amount charged in Billing currency. Tax not included. Is null for future payments + BillingCurrencyTotal *Price `json:"billingCurrencyTotal,omitempty"` + // BillingAccount - Shows the Account that is charged for this payment. + BillingAccount *string `json:"billingAccount,omitempty"` + // Status - Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' + Status PaymentStatus `json:"status,omitempty"` + ExtendedStatusInfo *ExtendedStatusInfo `json:"extendedStatusInfo,omitempty"` +} + +// Price ... +type Price struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + Amount *float64 `json:"amount,omitempty"` +} + // Properties ... type Properties struct { autorest.Response `json:"-"` @@ -1138,12 +1269,14 @@ type PropertiesType struct { // ExpiryDate - This is the date when the Reservation will expire. ExpiryDate *date.Date `json:"expiryDate,omitempty"` // SkuDescription - Description of the SKU in english. - SkuDescription *string `json:"skuDescription,omitempty"` - ExtendedStatusInfo *ExtendedStatusInfo `json:"extendedStatusInfo,omitempty"` - SplitProperties *SplitPropertiesType `json:"splitProperties,omitempty"` - MergeProperties *MergePropertiesType `json:"mergeProperties,omitempty"` - BillingScopeID *string `json:"billingScopeId,omitempty"` - Renew *bool `json:"renew,omitempty"` + SkuDescription *string `json:"skuDescription,omitempty"` + ExtendedStatusInfo *ExtendedStatusInfo `json:"extendedStatusInfo,omitempty"` + // BillingPlan - Possible values include: 'Upfront', 'Monthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + SplitProperties *SplitPropertiesType `json:"splitProperties,omitempty"` + MergeProperties *MergePropertiesType `json:"mergeProperties,omitempty"` + BillingScopeID *string `json:"billingScopeId,omitempty"` + Renew *bool `json:"renew,omitempty"` // 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}. RenewSource *string `json:"renewSource,omitempty"` // 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}. @@ -1224,8 +1357,10 @@ type PurchaseRequestProperties struct { ReservedResourceType ReservedResourceType `json:"reservedResourceType,omitempty"` BillingScopeID *string `json:"billingScopeId,omitempty"` // Term - Possible values include: 'P1Y', 'P3Y' - Term ReservationTerm `json:"term,omitempty"` - Quantity *int32 `json:"quantity,omitempty"` + Term ReservationTerm `json:"term,omitempty"` + // BillingPlan - Possible values include: 'Upfront', 'Monthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` // DisplayName - Friendly name of the Reservation DisplayName *string `json:"displayName,omitempty"` // AppliedScopeType - Possible values include: 'Single', 'Shared' diff --git a/services/preview/reservations/mgmt/2019-04-01/reservations/order.go b/services/preview/reservations/mgmt/2019-04-01/reservations/order.go index 912230259b4b..fae3f04b0d82 100644 --- a/services/preview/reservations/mgmt/2019-04-01/reservations/order.go +++ b/services/preview/reservations/mgmt/2019-04-01/reservations/order.go @@ -115,7 +115,8 @@ func (client OrderClient) CalculateResponder(resp *http.Response) (result Calcul // Get get the details of the `ReservationOrder`. // Parameters: // reservationOrderID - order Id of the reservation -func (client OrderClient) Get(ctx context.Context, reservationOrderID string) (result OrderResponse, err error) { +// expand - may be used to expand the planInformation. +func (client OrderClient) Get(ctx context.Context, reservationOrderID string, expand string) (result OrderResponse, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.Get") defer func() { @@ -126,7 +127,7 @@ func (client OrderClient) Get(ctx context.Context, reservationOrderID string) (r tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, reservationOrderID) + req, err := client.GetPreparer(ctx, reservationOrderID, expand) if err != nil { err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Get", nil, "Failure preparing request") return @@ -148,7 +149,7 @@ func (client OrderClient) Get(ctx context.Context, reservationOrderID string) (r } // GetPreparer prepares the Get request. -func (client OrderClient) GetPreparer(ctx context.Context, reservationOrderID string) (*http.Request, error) { +func (client OrderClient) GetPreparer(ctx context.Context, reservationOrderID string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "reservationOrderId": autorest.Encode("path", reservationOrderID), } @@ -157,6 +158,9 @@ func (client OrderClient) GetPreparer(ctx context.Context, reservationOrderID st queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } preparer := autorest.CreatePreparer( autorest.AsGet(), diff --git a/services/preview/reservations/mgmt/2019-04-01/reservations/reservationsapi/interfaces.go b/services/preview/reservations/mgmt/2019-04-01/reservations/reservationsapi/interfaces.go index 70e8f000f936..35f3341eaf2d 100644 --- a/services/preview/reservations/mgmt/2019-04-01/reservations/reservationsapi/interfaces.go +++ b/services/preview/reservations/mgmt/2019-04-01/reservations/reservationsapi/interfaces.go @@ -46,7 +46,7 @@ var _ ClientAPI = (*reservations.Client)(nil) // OrderClientAPI contains the set of methods on the OrderClient type. type OrderClientAPI interface { Calculate(ctx context.Context, body reservations.PurchaseRequest) (result reservations.CalculatePriceResponse, err error) - Get(ctx context.Context, reservationOrderID string) (result reservations.OrderResponse, err error) + Get(ctx context.Context, reservationOrderID string, expand string) (result reservations.OrderResponse, err error) List(ctx context.Context) (result reservations.OrderListPage, err error) Purchase(ctx context.Context, reservationOrderID string, body reservations.PurchaseRequest) (result reservations.OrderPurchaseFuture, err error) }