From fe451556adf5050633fc9ec0d8ebcf42b7a57378 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Thu, 17 Oct 2019 18:02:53 +0000 Subject: [PATCH] Generated from 1175f21020d781bcd32041246ab560177fe3edcf Updating swagger spec to fix billing plans schema in catalogs response. --- .../reservations/mgmt/reservations/models.go | 1 - .../mgmt/2019-04-01/reservations/models.go | 57 ++----------------- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/profiles/preview/preview/reservations/mgmt/reservations/models.go b/profiles/preview/preview/reservations/mgmt/reservations/models.go index 93e8b2bf8b0f..8a48e611bb76 100644 --- a/profiles/preview/preview/reservations/mgmt/reservations/models.go +++ b/profiles/preview/preview/reservations/mgmt/reservations/models.go @@ -162,7 +162,6 @@ 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 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 6e01aed5501e..b457c00410a3 100644 --- a/services/preview/reservations/mgmt/2019-04-01/reservations/models.go +++ b/services/preview/reservations/mgmt/2019-04-01/reservations/models.go @@ -415,7 +415,7 @@ type Catalog struct { // 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"` + BillingPlans map[string][]ReservationBillingPlan `json:"billingPlans"` // Terms - READ-ONLY; Available reservation terms for this resource Terms *[]ReservationTerm `json:"terms,omitempty"` // Locations - READ-ONLY @@ -426,62 +426,15 @@ 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) { +// MarshalJSON is the custom marshaler for Catalog. +func (c Catalog) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if cPi.Name != "" { - objectMap["name"] = cPi.Name - } - for k, v := range cPi.AdditionalProperties { - objectMap[k] = v + if c.BillingPlans != nil { + objectMap["billingPlans"] = c.BillingPlans } 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"`