From db3a812d6b772021ef9ae9c317d9c80624c0b9ac Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 6 Aug 2020 02:00:50 +0000 Subject: [PATCH] Generated from 4f9ba8537982d22652748cb6b386c8c0cc64ee61 fix space-tab inconsistency --- .../mgmt/2018-06-01/reservations/client.go | 2 - .../mgmt/2018-06-01/reservations/enums.go | 236 ++++++++++++ .../mgmt/2018-06-01/reservations/models.go | 341 ++++++------------ .../mgmt/2018-06-01/reservations/operation.go | 4 +- .../mgmt/2018-06-01/reservations/order.go | 5 +- .../2018-06-01/reservations/reservation.go | 12 +- .../mgmt/2018-06-01/reservations/version.go | 2 +- 7 files changed, 355 insertions(+), 247 deletions(-) create mode 100644 services/preview/reservations/mgmt/2018-06-01/reservations/enums.go diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/client.go b/services/preview/reservations/mgmt/2018-06-01/reservations/client.go index 6fcd983f9e0e..4cc317b5b2a8 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/client.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/client.go @@ -118,7 +118,6 @@ func (client BaseClient) GetAppliedReservationListSender(req *http.Request) (*ht func (client BaseClient) GetAppliedReservationListResponder(resp *http.Response) (result AppliedReservations, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -198,7 +197,6 @@ func (client BaseClient) GetCatalogSender(req *http.Request) (*http.Response, er func (client BaseClient) GetCatalogResponder(resp *http.Response) (result ListCatalog, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/enums.go b/services/preview/reservations/mgmt/2018-06-01/reservations/enums.go new file mode 100644 index 000000000000..ced6bf38f4c5 --- /dev/null +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/enums.go @@ -0,0 +1,236 @@ +package reservations + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AppliedScopeType enumerates the values for applied scope type. +type AppliedScopeType string + +const ( + // Shared ... + Shared AppliedScopeType = "Shared" + // Single ... + Single AppliedScopeType = "Single" +) + +// PossibleAppliedScopeTypeValues returns an array of possible values for the AppliedScopeType const type. +func PossibleAppliedScopeTypeValues() []AppliedScopeType { + return []AppliedScopeType{Shared, Single} +} + +// ErrorResponseCode enumerates the values for error response code. +type ErrorResponseCode string + +const ( + // ActivateQuoteFailed ... + ActivateQuoteFailed ErrorResponseCode = "ActivateQuoteFailed" + // AppliedScopesNotAssociatedWithCommerceAccount ... + AppliedScopesNotAssociatedWithCommerceAccount ErrorResponseCode = "AppliedScopesNotAssociatedWithCommerceAccount" + // AuthorizationFailed ... + AuthorizationFailed ErrorResponseCode = "AuthorizationFailed" + // BadRequest ... + BadRequest ErrorResponseCode = "BadRequest" + // BillingCustomerInputError ... + BillingCustomerInputError ErrorResponseCode = "BillingCustomerInputError" + // BillingError ... + BillingError ErrorResponseCode = "BillingError" + // BillingPaymentInstrumentHardError ... + BillingPaymentInstrumentHardError ErrorResponseCode = "BillingPaymentInstrumentHardError" + // BillingPaymentInstrumentSoftError ... + BillingPaymentInstrumentSoftError ErrorResponseCode = "BillingPaymentInstrumentSoftError" + // BillingScopeIDCannotBeChanged ... + BillingScopeIDCannotBeChanged ErrorResponseCode = "BillingScopeIdCannotBeChanged" + // BillingTransientError ... + BillingTransientError ErrorResponseCode = "BillingTransientError" + // CalculatePriceFailed ... + CalculatePriceFailed ErrorResponseCode = "CalculatePriceFailed" + // CapacityUpdateScopesFailed ... + CapacityUpdateScopesFailed ErrorResponseCode = "CapacityUpdateScopesFailed" + // ClientCertificateThumbprintNotSet ... + ClientCertificateThumbprintNotSet ErrorResponseCode = "ClientCertificateThumbprintNotSet" + // CreateQuoteFailed ... + CreateQuoteFailed ErrorResponseCode = "CreateQuoteFailed" + // Forbidden ... + Forbidden ErrorResponseCode = "Forbidden" + // FulfillmentConfigurationError ... + FulfillmentConfigurationError ErrorResponseCode = "FulfillmentConfigurationError" + // FulfillmentError ... + FulfillmentError ErrorResponseCode = "FulfillmentError" + // FulfillmentOutOfStockError ... + FulfillmentOutOfStockError ErrorResponseCode = "FulfillmentOutOfStockError" + // FulfillmentTransientError ... + FulfillmentTransientError ErrorResponseCode = "FulfillmentTransientError" + // HTTPMethodNotSupported ... + HTTPMethodNotSupported ErrorResponseCode = "HttpMethodNotSupported" + // InternalServerError ... + InternalServerError ErrorResponseCode = "InternalServerError" + // InvalidAccessToken ... + InvalidAccessToken ErrorResponseCode = "InvalidAccessToken" + // InvalidFulfillmentRequestParameters ... + InvalidFulfillmentRequestParameters ErrorResponseCode = "InvalidFulfillmentRequestParameters" + // InvalidHealthCheckType ... + InvalidHealthCheckType ErrorResponseCode = "InvalidHealthCheckType" + // InvalidLocationID ... + InvalidLocationID ErrorResponseCode = "InvalidLocationId" + // InvalidRefundQuantity ... + InvalidRefundQuantity ErrorResponseCode = "InvalidRefundQuantity" + // InvalidRequestContent ... + InvalidRequestContent ErrorResponseCode = "InvalidRequestContent" + // InvalidRequestURI ... + InvalidRequestURI ErrorResponseCode = "InvalidRequestUri" + // InvalidReservationID ... + InvalidReservationID ErrorResponseCode = "InvalidReservationId" + // InvalidReservationOrderID ... + InvalidReservationOrderID ErrorResponseCode = "InvalidReservationOrderId" + // InvalidSingleAppliedScopesCount ... + InvalidSingleAppliedScopesCount ErrorResponseCode = "InvalidSingleAppliedScopesCount" + // InvalidSubscriptionID ... + InvalidSubscriptionID ErrorResponseCode = "InvalidSubscriptionId" + // InvalidTenantID ... + InvalidTenantID ErrorResponseCode = "InvalidTenantId" + // MissingAppliedScopesForSingle ... + MissingAppliedScopesForSingle ErrorResponseCode = "MissingAppliedScopesForSingle" + // MissingTenantID ... + MissingTenantID ErrorResponseCode = "MissingTenantId" + // NonsupportedAccountID ... + NonsupportedAccountID ErrorResponseCode = "NonsupportedAccountId" + // NotSpecified ... + NotSpecified ErrorResponseCode = "NotSpecified" + // NotSupportedCountry ... + NotSupportedCountry ErrorResponseCode = "NotSupportedCountry" + // NoValidReservationsToReRate ... + NoValidReservationsToReRate ErrorResponseCode = "NoValidReservationsToReRate" + // OperationCannotBePerformedInCurrentState ... + OperationCannotBePerformedInCurrentState ErrorResponseCode = "OperationCannotBePerformedInCurrentState" + // OperationFailed ... + OperationFailed ErrorResponseCode = "OperationFailed" + // PatchValuesSameAsExisting ... + PatchValuesSameAsExisting ErrorResponseCode = "PatchValuesSameAsExisting" + // PaymentInstrumentNotFound ... + PaymentInstrumentNotFound ErrorResponseCode = "PaymentInstrumentNotFound" + // PurchaseError ... + PurchaseError ErrorResponseCode = "PurchaseError" + // ReRateOnlyAllowedForEA ... + ReRateOnlyAllowedForEA ErrorResponseCode = "ReRateOnlyAllowedForEA" + // ReservationIDNotInReservationOrder ... + ReservationIDNotInReservationOrder ErrorResponseCode = "ReservationIdNotInReservationOrder" + // ReservationOrderCreationFailed ... + ReservationOrderCreationFailed ErrorResponseCode = "ReservationOrderCreationFailed" + // ReservationOrderIDAlreadyExists ... + ReservationOrderIDAlreadyExists ErrorResponseCode = "ReservationOrderIdAlreadyExists" + // ReservationOrderNotEnabled ... + ReservationOrderNotEnabled ErrorResponseCode = "ReservationOrderNotEnabled" + // ReservationOrderNotFound ... + ReservationOrderNotFound ErrorResponseCode = "ReservationOrderNotFound" + // RiskCheckFailed ... + RiskCheckFailed ErrorResponseCode = "RiskCheckFailed" + // RoleAssignmentCreationFailed ... + RoleAssignmentCreationFailed ErrorResponseCode = "RoleAssignmentCreationFailed" + // ServerTimeout ... + ServerTimeout ErrorResponseCode = "ServerTimeout" + // UnauthenticatedRequestsThrottled ... + UnauthenticatedRequestsThrottled ErrorResponseCode = "UnauthenticatedRequestsThrottled" + // UnsupportedReservationTerm ... + UnsupportedReservationTerm ErrorResponseCode = "UnsupportedReservationTerm" +) + +// PossibleErrorResponseCodeValues returns an array of possible values for the ErrorResponseCode const type. +func PossibleErrorResponseCodeValues() []ErrorResponseCode { + return []ErrorResponseCode{ActivateQuoteFailed, AppliedScopesNotAssociatedWithCommerceAccount, AuthorizationFailed, BadRequest, BillingCustomerInputError, BillingError, BillingPaymentInstrumentHardError, BillingPaymentInstrumentSoftError, BillingScopeIDCannotBeChanged, BillingTransientError, CalculatePriceFailed, CapacityUpdateScopesFailed, ClientCertificateThumbprintNotSet, CreateQuoteFailed, Forbidden, FulfillmentConfigurationError, FulfillmentError, FulfillmentOutOfStockError, FulfillmentTransientError, HTTPMethodNotSupported, InternalServerError, InvalidAccessToken, InvalidFulfillmentRequestParameters, InvalidHealthCheckType, InvalidLocationID, InvalidRefundQuantity, InvalidRequestContent, InvalidRequestURI, InvalidReservationID, InvalidReservationOrderID, InvalidSingleAppliedScopesCount, InvalidSubscriptionID, InvalidTenantID, MissingAppliedScopesForSingle, MissingTenantID, NonsupportedAccountID, NotSpecified, NotSupportedCountry, NoValidReservationsToReRate, OperationCannotBePerformedInCurrentState, OperationFailed, PatchValuesSameAsExisting, PaymentInstrumentNotFound, PurchaseError, ReRateOnlyAllowedForEA, ReservationIDNotInReservationOrder, ReservationOrderCreationFailed, ReservationOrderIDAlreadyExists, ReservationOrderNotEnabled, ReservationOrderNotFound, RiskCheckFailed, RoleAssignmentCreationFailed, ServerTimeout, UnauthenticatedRequestsThrottled, UnsupportedReservationTerm} +} + +// InstanceFlexibility enumerates the values for instance flexibility. +type InstanceFlexibility string + +const ( + // NotSupported ... + NotSupported InstanceFlexibility = "NotSupported" + // Off ... + Off InstanceFlexibility = "Off" + // On ... + On InstanceFlexibility = "On" +) + +// PossibleInstanceFlexibilityValues returns an array of possible values for the InstanceFlexibility const type. +func PossibleInstanceFlexibilityValues() []InstanceFlexibility { + return []InstanceFlexibility{NotSupported, Off, On} +} + +// ReservationTerm enumerates the values for reservation term. +type ReservationTerm string + +const ( + // P1Y ... + P1Y ReservationTerm = "P1Y" + // P3Y ... + P3Y ReservationTerm = "P3Y" +) + +// PossibleReservationTermValues returns an array of possible values for the ReservationTerm const type. +func PossibleReservationTermValues() []ReservationTerm { + return []ReservationTerm{P1Y, P3Y} +} + +// ReservedResourceType enumerates the values for reserved resource type. +type ReservedResourceType string + +const ( + // CosmosDb ... + CosmosDb ReservedResourceType = "CosmosDb" + // RedHat ... + RedHat ReservedResourceType = "RedHat" + // SQLDatabases ... + SQLDatabases ReservedResourceType = "SqlDatabases" + // SuseLinux ... + SuseLinux ReservedResourceType = "SuseLinux" + // VirtualMachines ... + VirtualMachines ReservedResourceType = "VirtualMachines" +) + +// PossibleReservedResourceTypeValues returns an array of possible values for the ReservedResourceType const type. +func PossibleReservedResourceTypeValues() []ReservedResourceType { + return []ReservedResourceType{CosmosDb, RedHat, SQLDatabases, SuseLinux, VirtualMachines} +} + +// StatusCode enumerates the values for status code. +type StatusCode string + +const ( + // StatusCodeActive ... + StatusCodeActive StatusCode = "Active" + // StatusCodeExpired ... + StatusCodeExpired StatusCode = "Expired" + // StatusCodeMerged ... + StatusCodeMerged StatusCode = "Merged" + // StatusCodeNone ... + StatusCodeNone StatusCode = "None" + // StatusCodePaymentInstrumentError ... + StatusCodePaymentInstrumentError StatusCode = "PaymentInstrumentError" + // StatusCodePending ... + StatusCodePending StatusCode = "Pending" + // StatusCodePurchaseError ... + StatusCodePurchaseError StatusCode = "PurchaseError" + // StatusCodeSplit ... + StatusCodeSplit StatusCode = "Split" + // StatusCodeSucceeded ... + StatusCodeSucceeded StatusCode = "Succeeded" +) + +// PossibleStatusCodeValues returns an array of possible values for the StatusCode const type. +func PossibleStatusCodeValues() []StatusCode { + return []StatusCode{StatusCodeActive, StatusCodeExpired, StatusCodeMerged, StatusCodeNone, StatusCodePaymentInstrumentError, StatusCodePending, StatusCodePurchaseError, StatusCodeSplit, StatusCodeSucceeded} +} diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/models.go b/services/preview/reservations/mgmt/2018-06-01/reservations/models.go index a5a4870586c3..6a110097f546 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/models.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/models.go @@ -31,224 +31,6 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/reservations/mgmt/2018-06-01/reservations" -// AppliedScopeType enumerates the values for applied scope type. -type AppliedScopeType string - -const ( - // Shared ... - Shared AppliedScopeType = "Shared" - // Single ... - Single AppliedScopeType = "Single" -) - -// PossibleAppliedScopeTypeValues returns an array of possible values for the AppliedScopeType const type. -func PossibleAppliedScopeTypeValues() []AppliedScopeType { - return []AppliedScopeType{Shared, Single} -} - -// ErrorResponseCode enumerates the values for error response code. -type ErrorResponseCode string - -const ( - // ActivateQuoteFailed ... - ActivateQuoteFailed ErrorResponseCode = "ActivateQuoteFailed" - // AppliedScopesNotAssociatedWithCommerceAccount ... - AppliedScopesNotAssociatedWithCommerceAccount ErrorResponseCode = "AppliedScopesNotAssociatedWithCommerceAccount" - // AuthorizationFailed ... - AuthorizationFailed ErrorResponseCode = "AuthorizationFailed" - // BadRequest ... - BadRequest ErrorResponseCode = "BadRequest" - // BillingCustomerInputError ... - BillingCustomerInputError ErrorResponseCode = "BillingCustomerInputError" - // BillingError ... - BillingError ErrorResponseCode = "BillingError" - // BillingPaymentInstrumentHardError ... - BillingPaymentInstrumentHardError ErrorResponseCode = "BillingPaymentInstrumentHardError" - // BillingPaymentInstrumentSoftError ... - BillingPaymentInstrumentSoftError ErrorResponseCode = "BillingPaymentInstrumentSoftError" - // BillingScopeIDCannotBeChanged ... - BillingScopeIDCannotBeChanged ErrorResponseCode = "BillingScopeIdCannotBeChanged" - // BillingTransientError ... - BillingTransientError ErrorResponseCode = "BillingTransientError" - // CalculatePriceFailed ... - CalculatePriceFailed ErrorResponseCode = "CalculatePriceFailed" - // CapacityUpdateScopesFailed ... - CapacityUpdateScopesFailed ErrorResponseCode = "CapacityUpdateScopesFailed" - // ClientCertificateThumbprintNotSet ... - ClientCertificateThumbprintNotSet ErrorResponseCode = "ClientCertificateThumbprintNotSet" - // CreateQuoteFailed ... - CreateQuoteFailed ErrorResponseCode = "CreateQuoteFailed" - // Forbidden ... - Forbidden ErrorResponseCode = "Forbidden" - // FulfillmentConfigurationError ... - FulfillmentConfigurationError ErrorResponseCode = "FulfillmentConfigurationError" - // FulfillmentError ... - FulfillmentError ErrorResponseCode = "FulfillmentError" - // FulfillmentOutOfStockError ... - FulfillmentOutOfStockError ErrorResponseCode = "FulfillmentOutOfStockError" - // FulfillmentTransientError ... - FulfillmentTransientError ErrorResponseCode = "FulfillmentTransientError" - // HTTPMethodNotSupported ... - HTTPMethodNotSupported ErrorResponseCode = "HttpMethodNotSupported" - // InternalServerError ... - InternalServerError ErrorResponseCode = "InternalServerError" - // InvalidAccessToken ... - InvalidAccessToken ErrorResponseCode = "InvalidAccessToken" - // InvalidFulfillmentRequestParameters ... - InvalidFulfillmentRequestParameters ErrorResponseCode = "InvalidFulfillmentRequestParameters" - // InvalidHealthCheckType ... - InvalidHealthCheckType ErrorResponseCode = "InvalidHealthCheckType" - // InvalidLocationID ... - InvalidLocationID ErrorResponseCode = "InvalidLocationId" - // InvalidRefundQuantity ... - InvalidRefundQuantity ErrorResponseCode = "InvalidRefundQuantity" - // InvalidRequestContent ... - InvalidRequestContent ErrorResponseCode = "InvalidRequestContent" - // InvalidRequestURI ... - InvalidRequestURI ErrorResponseCode = "InvalidRequestUri" - // InvalidReservationID ... - InvalidReservationID ErrorResponseCode = "InvalidReservationId" - // InvalidReservationOrderID ... - InvalidReservationOrderID ErrorResponseCode = "InvalidReservationOrderId" - // InvalidSingleAppliedScopesCount ... - InvalidSingleAppliedScopesCount ErrorResponseCode = "InvalidSingleAppliedScopesCount" - // InvalidSubscriptionID ... - InvalidSubscriptionID ErrorResponseCode = "InvalidSubscriptionId" - // InvalidTenantID ... - InvalidTenantID ErrorResponseCode = "InvalidTenantId" - // MissingAppliedScopesForSingle ... - MissingAppliedScopesForSingle ErrorResponseCode = "MissingAppliedScopesForSingle" - // MissingTenantID ... - MissingTenantID ErrorResponseCode = "MissingTenantId" - // NonsupportedAccountID ... - NonsupportedAccountID ErrorResponseCode = "NonsupportedAccountId" - // NotSpecified ... - NotSpecified ErrorResponseCode = "NotSpecified" - // NotSupportedCountry ... - NotSupportedCountry ErrorResponseCode = "NotSupportedCountry" - // NoValidReservationsToReRate ... - NoValidReservationsToReRate ErrorResponseCode = "NoValidReservationsToReRate" - // OperationCannotBePerformedInCurrentState ... - OperationCannotBePerformedInCurrentState ErrorResponseCode = "OperationCannotBePerformedInCurrentState" - // OperationFailed ... - OperationFailed ErrorResponseCode = "OperationFailed" - // PatchValuesSameAsExisting ... - PatchValuesSameAsExisting ErrorResponseCode = "PatchValuesSameAsExisting" - // PaymentInstrumentNotFound ... - PaymentInstrumentNotFound ErrorResponseCode = "PaymentInstrumentNotFound" - // PurchaseError ... - PurchaseError ErrorResponseCode = "PurchaseError" - // ReRateOnlyAllowedForEA ... - ReRateOnlyAllowedForEA ErrorResponseCode = "ReRateOnlyAllowedForEA" - // ReservationIDNotInReservationOrder ... - ReservationIDNotInReservationOrder ErrorResponseCode = "ReservationIdNotInReservationOrder" - // ReservationOrderCreationFailed ... - ReservationOrderCreationFailed ErrorResponseCode = "ReservationOrderCreationFailed" - // ReservationOrderIDAlreadyExists ... - ReservationOrderIDAlreadyExists ErrorResponseCode = "ReservationOrderIdAlreadyExists" - // ReservationOrderNotEnabled ... - ReservationOrderNotEnabled ErrorResponseCode = "ReservationOrderNotEnabled" - // ReservationOrderNotFound ... - ReservationOrderNotFound ErrorResponseCode = "ReservationOrderNotFound" - // RiskCheckFailed ... - RiskCheckFailed ErrorResponseCode = "RiskCheckFailed" - // RoleAssignmentCreationFailed ... - RoleAssignmentCreationFailed ErrorResponseCode = "RoleAssignmentCreationFailed" - // ServerTimeout ... - ServerTimeout ErrorResponseCode = "ServerTimeout" - // UnauthenticatedRequestsThrottled ... - UnauthenticatedRequestsThrottled ErrorResponseCode = "UnauthenticatedRequestsThrottled" - // UnsupportedReservationTerm ... - UnsupportedReservationTerm ErrorResponseCode = "UnsupportedReservationTerm" -) - -// PossibleErrorResponseCodeValues returns an array of possible values for the ErrorResponseCode const type. -func PossibleErrorResponseCodeValues() []ErrorResponseCode { - return []ErrorResponseCode{ActivateQuoteFailed, AppliedScopesNotAssociatedWithCommerceAccount, AuthorizationFailed, BadRequest, BillingCustomerInputError, BillingError, BillingPaymentInstrumentHardError, BillingPaymentInstrumentSoftError, BillingScopeIDCannotBeChanged, BillingTransientError, CalculatePriceFailed, CapacityUpdateScopesFailed, ClientCertificateThumbprintNotSet, CreateQuoteFailed, Forbidden, FulfillmentConfigurationError, FulfillmentError, FulfillmentOutOfStockError, FulfillmentTransientError, HTTPMethodNotSupported, InternalServerError, InvalidAccessToken, InvalidFulfillmentRequestParameters, InvalidHealthCheckType, InvalidLocationID, InvalidRefundQuantity, InvalidRequestContent, InvalidRequestURI, InvalidReservationID, InvalidReservationOrderID, InvalidSingleAppliedScopesCount, InvalidSubscriptionID, InvalidTenantID, MissingAppliedScopesForSingle, MissingTenantID, NonsupportedAccountID, NotSpecified, NotSupportedCountry, NoValidReservationsToReRate, OperationCannotBePerformedInCurrentState, OperationFailed, PatchValuesSameAsExisting, PaymentInstrumentNotFound, PurchaseError, ReRateOnlyAllowedForEA, ReservationIDNotInReservationOrder, ReservationOrderCreationFailed, ReservationOrderIDAlreadyExists, ReservationOrderNotEnabled, ReservationOrderNotFound, RiskCheckFailed, RoleAssignmentCreationFailed, ServerTimeout, UnauthenticatedRequestsThrottled, UnsupportedReservationTerm} -} - -// InstanceFlexibility enumerates the values for instance flexibility. -type InstanceFlexibility string - -const ( - // NotSupported ... - NotSupported InstanceFlexibility = "NotSupported" - // Off ... - Off InstanceFlexibility = "Off" - // On ... - On InstanceFlexibility = "On" -) - -// PossibleInstanceFlexibilityValues returns an array of possible values for the InstanceFlexibility const type. -func PossibleInstanceFlexibilityValues() []InstanceFlexibility { - return []InstanceFlexibility{NotSupported, Off, On} -} - -// ReservationTerm enumerates the values for reservation term. -type ReservationTerm string - -const ( - // P1Y ... - P1Y ReservationTerm = "P1Y" - // P3Y ... - P3Y ReservationTerm = "P3Y" -) - -// PossibleReservationTermValues returns an array of possible values for the ReservationTerm const type. -func PossibleReservationTermValues() []ReservationTerm { - return []ReservationTerm{P1Y, P3Y} -} - -// ReservedResourceType enumerates the values for reserved resource type. -type ReservedResourceType string - -const ( - // CosmosDb ... - CosmosDb ReservedResourceType = "CosmosDb" - // RedHat ... - RedHat ReservedResourceType = "RedHat" - // SQLDatabases ... - SQLDatabases ReservedResourceType = "SqlDatabases" - // SuseLinux ... - SuseLinux ReservedResourceType = "SuseLinux" - // VirtualMachines ... - VirtualMachines ReservedResourceType = "VirtualMachines" -) - -// PossibleReservedResourceTypeValues returns an array of possible values for the ReservedResourceType const type. -func PossibleReservedResourceTypeValues() []ReservedResourceType { - return []ReservedResourceType{CosmosDb, RedHat, SQLDatabases, SuseLinux, VirtualMachines} -} - -// StatusCode enumerates the values for status code. -type StatusCode string - -const ( - // StatusCodeActive ... - StatusCodeActive StatusCode = "Active" - // StatusCodeExpired ... - StatusCodeExpired StatusCode = "Expired" - // StatusCodeMerged ... - StatusCodeMerged StatusCode = "Merged" - // StatusCodeNone ... - StatusCodeNone StatusCode = "None" - // StatusCodePaymentInstrumentError ... - StatusCodePaymentInstrumentError StatusCode = "PaymentInstrumentError" - // StatusCodePending ... - StatusCodePending StatusCode = "Pending" - // StatusCodePurchaseError ... - StatusCodePurchaseError StatusCode = "PurchaseError" - // StatusCodeSplit ... - StatusCodeSplit StatusCode = "Split" - // StatusCodeSucceeded ... - StatusCodeSucceeded StatusCode = "Succeeded" -) - -// PossibleStatusCodeValues returns an array of possible values for the StatusCode const type. -func PossibleStatusCodeValues() []StatusCode { - return []StatusCode{StatusCodeActive, StatusCodeExpired, StatusCodeMerged, StatusCodeNone, StatusCodePaymentInstrumentError, StatusCodePending, StatusCodePurchaseError, StatusCodeSplit, StatusCodeSucceeded} -} - // AppliedReservationList ... type AppliedReservationList struct { Value *[]string `json:"value,omitempty"` @@ -451,10 +233,15 @@ func (l List) IsEmpty() bool { return l.Value == nil || len(*l.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (l List) hasNextLink() bool { + return l.NextLink != nil && len(*l.NextLink) != 0 +} + // listPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (l List) listPreparer(ctx context.Context) (*http.Request, error) { - if l.NextLink == nil || len(to.String(l.NextLink)) < 1 { + if !l.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -482,11 +269,16 @@ func (page *ListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.l) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.l) + if err != nil { + return err + } + page.l = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.l = next return nil } @@ -662,10 +454,15 @@ func (ol OperationList) IsEmpty() bool { return ol.Value == nil || len(*ol.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + // operationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { - if ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 { + if !ol.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -693,11 +490,16 @@ func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ol) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ol = next return nil } @@ -814,10 +616,15 @@ func (ol OrderList) IsEmpty() bool { return ol.Value == nil || len(*ol.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ol OrderList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + // orderListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ol OrderList) orderListPreparer(ctx context.Context) (*http.Request, error) { - if ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 { + if !ol.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -845,11 +652,16 @@ func (page *OrderListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ol) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ol = next return nil } @@ -1064,8 +876,52 @@ type Properties struct { MergeProperties *MergePropertiesType `json:"mergeProperties,omitempty"` } -// ReservationMergeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ReservedResourceType != "" { + objectMap["reservedResourceType"] = p.ReservedResourceType + } + if p.InstanceFlexibility != "" { + objectMap["instanceFlexibility"] = p.InstanceFlexibility + } + if p.DisplayName != nil { + objectMap["displayName"] = p.DisplayName + } + if p.AppliedScopes != nil { + objectMap["appliedScopes"] = p.AppliedScopes + } + if p.AppliedScopeType != "" { + objectMap["appliedScopeType"] = p.AppliedScopeType + } + if p.Quantity != nil { + objectMap["quantity"] = p.Quantity + } + if p.ProvisioningState != nil { + objectMap["provisioningState"] = p.ProvisioningState + } + if p.EffectiveDateTime != nil { + objectMap["effectiveDateTime"] = p.EffectiveDateTime + } + if p.ExpiryDate != nil { + objectMap["expiryDate"] = p.ExpiryDate + } + if p.SkuDescription != nil { + objectMap["skuDescription"] = p.SkuDescription + } + if p.ExtendedStatusInfo != nil { + objectMap["extendedStatusInfo"] = p.ExtendedStatusInfo + } + if p.SplitProperties != nil { + objectMap["splitProperties"] = p.SplitProperties + } + if p.MergeProperties != nil { + objectMap["mergeProperties"] = p.MergeProperties + } + return json.Marshal(objectMap) +} + +// ReservationMergeFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ReservationMergeFuture struct { azure.Future } @@ -1138,6 +994,21 @@ type Response struct { Type *string `json:"type,omitempty"` } +// MarshalJSON is the custom marshaler for Response. +func (r Response) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + if r.Properties != nil { + objectMap["properties"] = r.Properties + } + return json.Marshal(objectMap) +} + // SkuName ... type SkuName struct { Name *string `json:"name,omitempty"` diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/operation.go b/services/preview/reservations/mgmt/2018-06-01/reservations/operation.go index 64667cd31268..98319ae4e76e 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/operation.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/operation.go @@ -71,6 +71,9 @@ func (client OperationClient) List(ctx context.Context) (result OperationListPag if err != nil { err = autorest.NewErrorWithError(err, "reservations.OperationClient", "List", resp, "Failure responding to request") } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -101,7 +104,6 @@ func (client OperationClient) ListSender(req *http.Request) (*http.Response, err func (client OperationClient) ListResponder(resp *http.Response) (result OperationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/order.go b/services/preview/reservations/mgmt/2018-06-01/reservations/order.go index dc910e10d43b..4af90484303d 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/order.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/order.go @@ -106,7 +106,6 @@ func (client OrderClient) GetSender(req *http.Request) (*http.Response, error) { func (client OrderClient) GetResponder(resp *http.Response) (result OrderResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -144,6 +143,9 @@ func (client OrderClient) List(ctx context.Context) (result OrderListPage, err e if err != nil { err = autorest.NewErrorWithError(err, "reservations.OrderClient", "List", resp, "Failure responding to request") } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -174,7 +176,6 @@ func (client OrderClient) ListSender(req *http.Request) (*http.Response, error) func (client OrderClient) ListResponder(resp *http.Response) (result OrderList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/reservation.go b/services/preview/reservations/mgmt/2018-06-01/reservations/reservation.go index 991a6f117c7d..ff519e9e1f95 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/reservation.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/reservation.go @@ -108,7 +108,6 @@ func (client Client) GetSender(req *http.Request) (*http.Response, error) { func (client Client) GetResponder(resp *http.Response) (result Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -148,6 +147,9 @@ func (client Client) List(ctx context.Context, reservationOrderID string) (resul if err != nil { err = autorest.NewErrorWithError(err, "reservations.Client", "List", resp, "Failure responding to request") } + if result.l.hasNextLink() && result.l.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -182,7 +184,6 @@ func (client Client) ListSender(req *http.Request) (*http.Response, error) { func (client Client) ListResponder(resp *http.Response) (result List, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -260,6 +261,9 @@ func (client Client) ListRevisions(ctx context.Context, reservationID string, re if err != nil { err = autorest.NewErrorWithError(err, "reservations.Client", "ListRevisions", resp, "Failure responding to request") } + if result.l.hasNextLink() && result.l.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -295,7 +299,6 @@ func (client Client) ListRevisionsSender(req *http.Request) (*http.Response, err func (client Client) ListRevisionsResponder(resp *http.Response) (result List, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -409,7 +412,6 @@ func (client Client) MergeSender(req *http.Request) (future ReservationMergeFutu func (client Client) MergeResponder(resp *http.Response) (result ListResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -485,7 +487,6 @@ func (client Client) SplitSender(req *http.Request) (future SplitFuture, err err func (client Client) SplitResponder(resp *http.Response) (result ListResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -563,7 +564,6 @@ func (client Client) UpdateSender(req *http.Request) (future ReservationUpdateFu func (client Client) UpdateResponder(resp *http.Response) (result Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/reservations/mgmt/2018-06-01/reservations/version.go b/services/preview/reservations/mgmt/2018-06-01/reservations/version.go index 64d335ca8d94..083cb0349db2 100644 --- a/services/preview/reservations/mgmt/2018-06-01/reservations/version.go +++ b/services/preview/reservations/mgmt/2018-06-01/reservations/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " reservations/2018-06-01" + return "Azure-SDK-For-Go/" + Version() + " reservations/2018-06-01" } // Version returns the semantic version (see http://semver.org) of the client.