From 6c50f4a71f501b451d34f6e8295c814fd4bb688b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 23 Apr 2019 22:01:58 +0000 Subject: [PATCH] Generated from 7f6156ebc084d5957701544e764be834af2c3228 FW: [Revert][Hub Generated] Review request for Microsoft.Capacity to add version preview/2019-04-01 (#5715) --- .../lib/azureReservationAPI.ts | 167 +++ .../lib/azureReservationAPIContext.ts | 56 + .../arm-reservations/lib/models/index.ts | 1220 +++++++++++++++++ .../arm-reservations/lib/models/mappers.ts | 1028 ++++++++++++++ .../lib/models/operationMappers.ts | 18 + .../arm-reservations/lib/models/parameters.ts | 95 ++ .../lib/models/reservationMappers.ts | 27 + .../lib/models/reservationOrderMappers.ts | 30 + .../arm-reservations/lib/operations/index.ts | 13 + .../lib/operations/operation.ts | 125 ++ .../lib/operations/reservation.ts | 514 +++++++ .../lib/operations/reservationOrder.ts | 299 ++++ .../arm-reservations/package.json | 10 +- .../arm-reservations/tsconfig.json | 2 +- 14 files changed, 3597 insertions(+), 7 deletions(-) create mode 100644 sdk/reservations/arm-reservations/lib/azureReservationAPI.ts create mode 100644 sdk/reservations/arm-reservations/lib/azureReservationAPIContext.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/index.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/mappers.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/operationMappers.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/parameters.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/reservationMappers.ts create mode 100644 sdk/reservations/arm-reservations/lib/models/reservationOrderMappers.ts create mode 100644 sdk/reservations/arm-reservations/lib/operations/index.ts create mode 100644 sdk/reservations/arm-reservations/lib/operations/operation.ts create mode 100644 sdk/reservations/arm-reservations/lib/operations/reservation.ts create mode 100644 sdk/reservations/arm-reservations/lib/operations/reservationOrder.ts diff --git a/sdk/reservations/arm-reservations/lib/azureReservationAPI.ts b/sdk/reservations/arm-reservations/lib/azureReservationAPI.ts new file mode 100644 index 000000000000..3af0b67288f5 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/azureReservationAPI.ts @@ -0,0 +1,167 @@ +/* + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as Parameters from "./models/parameters"; +import * as operations from "./operations"; +import { AzureReservationAPIContext } from "./azureReservationAPIContext"; + + +class AzureReservationAPI extends AzureReservationAPIContext { + // Operation groups + reservationOrder: operations.ReservationOrder; + reservation: operations.Reservation; + operation: operations.Operation; + + /** + * Initializes a new instance of the AzureReservationAPI class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { + super(credentials, options); + this.reservationOrder = new operations.ReservationOrder(this); + this.reservation = new operations.Reservation(this); + this.operation = new operations.Operation(this); + } + + /** + * @summary Get the regions and skus that are available for RI purchase for the specified Azure + * subscription. + * @param subscriptionId Id of the subscription + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param [options] The optional parameters + * @returns Promise + */ + getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams): Promise; + /** + * @param subscriptionId Id of the subscription + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param callback The callback + */ + getCatalog(subscriptionId: string, reservedResourceType: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Id of the subscription + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param options The optional parameters + * @param callback The callback + */ + getCatalog(subscriptionId: string, reservedResourceType: string, options: Models.AzureReservationAPIGetCatalogOptionalParams, callback: msRest.ServiceCallback): void; + getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + subscriptionId, + reservedResourceType, + options + }, + getCatalogOperationSpec, + callback) as Promise; + } + + /** + * Get applicable `Reservation`s that are applied to this subscription. + * @summary Get list of applicable `Reservation`s. + * @param subscriptionId Id of the subscription + * @param [options] The optional parameters + * @returns Promise + */ + getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Id of the subscription + * @param callback The callback + */ + getAppliedReservationList(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Id of the subscription + * @param options The optional parameters + * @param callback The callback + */ + getAppliedReservationList(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + subscriptionId, + options + }, + getAppliedReservationListOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getCatalogOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.reservedResourceType, + Parameters.location + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Catalog" + } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const getAppliedReservationListOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AppliedReservations + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +export { + AzureReservationAPI, + AzureReservationAPIContext, + Models as AzureReservationAPIModels, + Mappers as AzureReservationAPIMappers +}; +export * from "./operations"; diff --git a/sdk/reservations/arm-reservations/lib/azureReservationAPIContext.ts b/sdk/reservations/arm-reservations/lib/azureReservationAPIContext.ts new file mode 100644 index 000000000000..cc75095c4054 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/azureReservationAPIContext.ts @@ -0,0 +1,56 @@ +/* + * 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. + */ + +import * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-reservations"; +const packageVersion = "2.3.0"; + +export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + apiVersion?: string; + + /** + * Initializes a new instance of the AzureReservationAPI class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2019-04-01'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/reservations/arm-reservations/lib/models/index.ts b/sdk/reservations/arm-reservations/lib/models/index.ts new file mode 100644 index 000000000000..76a7881be300 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/index.ts @@ -0,0 +1,1220 @@ +/* + * 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. + */ + +import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + + +/** + * @interface + * An interface representing SkuName. + */ +export interface SkuName { + /** + * @member {string} [name] + */ + name?: string; +} + +/** + * @interface + * An interface representing SkuProperty. + */ +export interface SkuProperty { + /** + * @member {string} [name] An invariant to describe the feature. + */ + name?: string; + /** + * @member {string} [value] An invariant if the feature is measured by + * quantity. + */ + value?: string; +} + +/** + * @interface + * An interface representing SkuRestriction. + */ +export interface SkuRestriction { + /** + * @member {string} [type] The type of restrictions. + */ + type?: string; + /** + * @member {string[]} [values] The value of restrictions. If the restriction + * type is set to location. This would be different locations where the SKU + * is restricted. + */ + values?: string[]; + /** + * @member {string} [reasonCode] The reason for restriction. + */ + reasonCode?: string; +} + +/** + * @interface + * An interface representing Catalog. + */ +export interface Catalog { + /** + * @member {string} [resourceType] The type of resource the SKU applies to. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly resourceType?: string; + /** + * @member {string} [name] The name of SKU + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {ReservationTerm[]} [terms] Available reservation terms for this + * resource + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly terms?: ReservationTerm[]; + /** + * @member {string[]} [locations] **NOTE: This property will not be + * serialized. It can only be populated by the server.** + */ + readonly locations?: string[]; + /** + * @member {SkuProperty[]} [skuProperties] **NOTE: This property will not be + * serialized. It can only be populated by the server.** + */ + readonly skuProperties?: SkuProperty[]; + /** + * @member {SkuRestriction[]} [restrictions] **NOTE: This property will not + * be serialized. It can only be populated by the server.** + */ + readonly restrictions?: SkuRestriction[]; +} + +/** + * @interface + * An interface representing ExtendedStatusInfo. + */ +export interface ExtendedStatusInfo { + /** + * @member {ReservationStatusCode} [statusCode] Possible values include: + * 'None', 'Pending', 'Active', 'PurchaseError', 'PaymentInstrumentError', + * 'Split', 'Merged', 'Expired', 'Succeeded' + */ + statusCode?: ReservationStatusCode; + /** + * @member {string} [message] The message giving detailed information about + * the status code. + */ + message?: string; +} + +/** + * @interface + * An interface representing ReservationSplitProperties. + */ +export interface ReservationSplitProperties { + /** + * @member {string[]} [splitDestinations] List of destination Resource Id + * that are created due to split. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + splitDestinations?: string[]; + /** + * @member {string} [splitSource] Resource Id of the Reservation from which + * this is split. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + splitSource?: string; +} + +/** + * @interface + * An interface representing ReservationMergeProperties. + */ +export interface ReservationMergeProperties { + /** + * @member {string} [mergeDestination] Reservation Resource Id Created due to + * the merge. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + mergeDestination?: string; + /** + * @member {string[]} [mergeSources] Resource Ids of the Source Reservation's + * merged to form this Reservation. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + mergeSources?: string[]; +} + +/** + * @interface + * An interface representing ReservationProperties. + */ +export interface ReservationProperties { + /** + * @member {ReservedResourceType} [reservedResourceType] Possible values + * include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb' + */ + reservedResourceType?: ReservedResourceType; + /** + * @member {InstanceFlexibility} [instanceFlexibility] Possible values + * include: 'On', 'Off' + */ + instanceFlexibility?: InstanceFlexibility; + /** + * @member {string} [displayName] Friendly name for user to easily identify + * the reservation + */ + displayName?: string; + /** + * @member {string[]} [appliedScopes] + */ + appliedScopes?: string[]; + /** + * @member {AppliedScopeType} [appliedScopeType] Possible values include: + * 'Single', 'Shared' + */ + appliedScopeType?: AppliedScopeType; + /** + * @member {number} [quantity] + */ + quantity?: number; + /** + * @member {string} [provisioningState] Current state of the reservation. + */ + provisioningState?: string; + /** + * @member {Date} [effectiveDateTime] DateTime of the Reservation starting + * when this version is effective from. + */ + effectiveDateTime?: Date; + /** + * @member {Date} [lastUpdatedDateTime] DateTime of the last time the + * Reservation was updated. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly lastUpdatedDateTime?: Date; + /** + * @member {Date} [expiryDate] This is the date when the Reservation will + * expire. + */ + expiryDate?: Date; + /** + * @member {string} [skuDescription] Description of the SKU in english. + */ + skuDescription?: string; + /** + * @member {ExtendedStatusInfo} [extendedStatusInfo] + */ + extendedStatusInfo?: ExtendedStatusInfo; + /** + * @member {ReservationSplitProperties} [splitProperties] + */ + splitProperties?: ReservationSplitProperties; + /** + * @member {ReservationMergeProperties} [mergeProperties] + */ + mergeProperties?: ReservationMergeProperties; +} + +/** + * @interface + * An interface representing ReservationResponse. + * @extends BaseResource + */ +export interface ReservationResponse extends BaseResource { + /** + * @member {string} [location] The Azure Region where the reserved resource + * lives. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly location?: string; + /** + * @member {number} [etag] + */ + etag?: number; + /** + * @member {string} [id] Identifier of the reservation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] Name of the reservation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {SkuName} [sku] + */ + sku?: SkuName; + /** + * @member {ReservationProperties} [properties] + */ + properties?: ReservationProperties; + /** + * @member {string} [type] Type of resource. + * "Microsoft.Capacity/reservationOrders/reservations" + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; +} + +/** + * @interface + * An interface representing ReservationOrderResponse. + * @extends BaseResource + */ +export interface ReservationOrderResponse extends BaseResource { + /** + * @member {number} [etag] + */ + etag?: number; + /** + * @member {string} [id] Identifier of the reservation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] Name of the reservation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [displayName] Friendly name for user to easily identified + * the reservation. + */ + displayName?: string; + /** + * @member {Date} [requestDateTime] This is the DateTime when the reservation + * was initially requested for purchase. + */ + requestDateTime?: Date; + /** + * @member {Date} [createdDateTime] This is the DateTime when the reservation + * was created. + */ + createdDateTime?: Date; + /** + * @member {Date} [expiryDate] This is the date when the Reservation will + * expire. + */ + expiryDate?: Date; + /** + * @member {number} [originalQuantity] + */ + originalQuantity?: number; + /** + * @member {ReservationTerm} [term] Possible values include: 'P1Y', 'P3Y' + */ + term?: ReservationTerm; + /** + * @member {string} [provisioningState] Current state of the reservation. + */ + provisioningState?: string; + /** + * @member {ReservationResponse[]} [reservations] + */ + reservations?: ReservationResponse[]; + /** + * @member {string} [type] Type of resource. + * "Microsoft.Capacity/reservations" + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; +} + +/** + * @interface + * An interface representing CalculatePriceResponsePropertiesBillingCurrencyTotal. + * Currency and amount that customer will be charged in customer's local + * currency. Tax is not included. + * + */ +export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { + /** + * @member {string} [currencyCode] + */ + currencyCode?: string; + /** + * @member {number} [amount] + */ + amount?: number; +} + +/** + * @interface + * An interface representing CalculatePriceResponsePropertiesPricingCurrencyTotal. + * Amount that Microsoft uses for record. Used during refund for calculating + * refund limit. Tax is not included. + * + */ +export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { + /** + * @member {string} [currencyCode] + */ + currencyCode?: string; + /** + * @member {number} [amount] + */ + amount?: number; +} + +/** + * @interface + * An interface representing CalculatePriceResponseProperties. + */ +export interface CalculatePriceResponseProperties { + /** + * @member {CalculatePriceResponsePropertiesBillingCurrencyTotal} + * [billingCurrencyTotal] Currency and amount that customer will be charged + * in customer's local currency. Tax is not included. + */ + billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; + /** + * @member {boolean} [isBillingPartnerManaged] True if billing is managed by + * Microsoft Partner. Used only for CSP accounts. + */ + isBillingPartnerManaged?: boolean; + /** + * @member {string} [reservationOrderId] GUID that represents reservation + * order that can be placed after calculating price. + */ + reservationOrderId?: string; + /** + * @member {string} [skuTitle] Title of SKU that is being purchased. + */ + skuTitle?: string; + /** + * @member {string} [skuDescription] Description of SKU that is being + * purchased. + */ + skuDescription?: string; + /** + * @member {CalculatePriceResponsePropertiesPricingCurrencyTotal} + * [pricingCurrencyTotal] Amount that Microsoft uses for record. Used during + * refund for calculating refund limit. Tax is not included. + */ + pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; +} + +/** + * @interface + * An interface representing CalculatePriceResponse. + */ +export interface CalculatePriceResponse { + /** + * @member {CalculatePriceResponseProperties} [properties] + */ + properties?: CalculatePriceResponseProperties; +} + +/** + * @interface + * An interface representing PurchaseRequestPropertiesReservedResourceProperties. + * Properties specific to each reserved resource type. Not required if not + * applicable. + * + */ +export interface PurchaseRequestPropertiesReservedResourceProperties { + /** + * @member {InstanceFlexibility} [instanceFlexibility] Possible values + * include: 'On', 'Off' + */ + instanceFlexibility?: InstanceFlexibility; +} + +/** + * @interface + * An interface representing MergeRequest. + */ +export interface MergeRequest { + /** + * @member {string[]} [sources] Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + sources?: string[]; +} + +/** + * @interface + * An interface representing PurchaseRequest. + */ +export interface PurchaseRequest { + /** + * @member {SkuName} [sku] + */ + sku?: SkuName; + /** + * @member {string} [location] The Azure Region where the reserved resource + * lives. + */ + location?: string; + /** + * @member {ReservedResourceType} [reservedResourceType] Possible values + * include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb' + */ + reservedResourceType?: ReservedResourceType; + /** + * @member {string} [billingScopeId] + */ + billingScopeId?: string; + /** + * @member {ReservationTerm} [term] Possible values include: 'P1Y', 'P3Y' + */ + term?: ReservationTerm; + /** + * @member {number} [quantity] + */ + quantity?: number; + /** + * @member {string} [displayName] Friendly name of the Reservation + */ + displayName?: string; + /** + * @member {AppliedScopeType} [appliedScopeType] Possible values include: + * 'Single', 'Shared' + */ + appliedScopeType?: AppliedScopeType; + /** + * @member {string[]} [appliedScopes] + */ + appliedScopes?: string[]; + /** + * @member {PurchaseRequestPropertiesReservedResourceProperties} + * [reservedResourceProperties] Properties specific to each reserved resource + * type. Not required if not applicable. + */ + reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; +} + +/** + * @interface + * An interface representing Patch. + */ +export interface Patch { + /** + * @member {AppliedScopeType} [appliedScopeType] Possible values include: + * 'Single', 'Shared' + */ + appliedScopeType?: AppliedScopeType; + /** + * @member {string[]} [appliedScopes] + */ + appliedScopes?: string[]; + /** + * @member {InstanceFlexibility} [instanceFlexibility] Possible values + * include: 'On', 'Off' + */ + instanceFlexibility?: InstanceFlexibility; + /** + * @member {string} [name] Name of the Reservation + */ + name?: string; +} + +/** + * @interface + * An interface representing SplitRequest. + */ +export interface SplitRequest { + /** + * @member {number[]} [quantities] List of the quantities in the new + * reservations to create. + */ + quantities?: number[]; + /** + * @member {string} [reservationId] Resource id of the reservation to be + * split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + reservationId?: string; +} + +/** + * @interface + * An interface representing ExtendedErrorInfo. + */ +export interface ExtendedErrorInfo { + /** + * @member {ErrorResponseCode} [code] Possible values include: + * 'NotSpecified', 'InternalServerError', 'ServerTimeout', + * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', + * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', + * 'InvalidRequestUri', 'MissingTenantId', 'InvalidTenantId', + * 'InvalidReservationOrderId', 'InvalidReservationId', + * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', + * 'InvalidSubscriptionId', 'InvalidAccessToken', 'InvalidLocationId', + * 'UnauthenticatedRequestsThrottled', 'InvalidHealthCheckType', 'Forbidden', + * 'BillingScopeIdCannotBeChanged', + * 'AppliedScopesNotAssociatedWithCommerceAccount', + * 'PatchValuesSameAsExisting', 'RoleAssignmentCreationFailed', + * 'ReservationOrderCreationFailed', 'ReservationOrderNotEnabled', + * 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', + * 'ReservationOrderIdAlreadyExists', 'RiskCheckFailed', 'CreateQuoteFailed', + * 'ActivateQuoteFailed', 'NonsupportedAccountId', + * 'PaymentInstrumentNotFound', 'MissingAppliedScopesForSingle', + * 'NoValidReservationsToReRate', 'ReRateOnlyAllowedForEA', + * 'OperationCannotBePerformedInCurrentState', + * 'InvalidSingleAppliedScopesCount', 'InvalidFulfillmentRequestParameters', + * 'NotSupportedCountry', 'InvalidRefundQuantity', 'PurchaseError', + * 'BillingCustomerInputError', 'BillingPaymentInstrumentSoftError', + * 'BillingPaymentInstrumentHardError', 'BillingTransientError', + * 'BillingError', 'FulfillmentConfigurationError', + * 'FulfillmentOutOfStockError', 'FulfillmentTransientError', + * 'FulfillmentError', 'CalculatePriceFailed' + */ + code?: ErrorResponseCode; + /** + * @member {string} [message] + */ + message?: string; +} + +/** + * @interface + * An interface representing ErrorModel. + */ +export interface ErrorModel { + /** + * @member {ExtendedErrorInfo} [error] + */ + error?: ExtendedErrorInfo; +} + +/** + * @interface + * An interface representing AppliedReservationList. + */ +export interface AppliedReservationList { + /** + * @member {string[]} [value] + */ + value?: string[]; + /** + * @member {string} [nextLink] Url to get the next page of reservations + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing AppliedReservations. + */ +export interface AppliedReservations { + /** + * @member {string} [id] Identifier of the applied reservations + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] Name of resource + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] Type of resource. + * "Microsoft.Capacity/AppliedReservations" + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {AppliedReservationList} [reservationOrderIds] + */ + reservationOrderIds?: AppliedReservationList; +} + +/** + * @interface + * An interface representing OperationDisplay. + */ +export interface OperationDisplay { + /** + * @member {string} [provider] + */ + provider?: string; + /** + * @member {string} [resource] + */ + resource?: string; + /** + * @member {string} [operation] + */ + operation?: string; + /** + * @member {string} [description] + */ + description?: string; +} + +/** + * @interface + * An interface representing OperationResponse. + */ +export interface OperationResponse { + /** + * @member {string} [name] + */ + name?: string; + /** + * @member {OperationDisplay} [display] + */ + display?: OperationDisplay; + /** + * @member {string} [origin] + */ + origin?: string; +} + +/** + * @interface + * An interface representing AzureReservationAPIGetCatalogOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface AzureReservationAPIGetCatalogOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [location] Filters the skus based on the location + * specified in this parameter. This can be an azure region or global + */ + location?: string; +} + +/** + * @interface + * An interface representing AzureReservationAPIOptions. + * @extends AzureServiceClientOptions + */ +export interface AzureReservationAPIOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the ReservationOrderList. + * @extends Array + */ +export interface ReservationOrderList extends Array { + /** + * @member {string} [nextLink] Url to get the next page of reservationOrders. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the ReservationList. + * @extends Array + */ +export interface ReservationList extends Array { + /** + * @member {string} [nextLink] Url to get the next page of reservations. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the OperationList. + * @extends Array + */ +export interface OperationList extends Array { + /** + * @member {string} [nextLink] Url to get the next page of items. + */ + nextLink?: string; +} + +/** + * Defines values for ReservationStatusCode. + * Possible values include: 'None', 'Pending', 'Active', 'PurchaseError', 'PaymentInstrumentError', + * 'Split', 'Merged', 'Expired', 'Succeeded' + * @readonly + * @enum {string} + */ +export type ReservationStatusCode = 'None' | 'Pending' | 'Active' | 'PurchaseError' | 'PaymentInstrumentError' | 'Split' | 'Merged' | 'Expired' | 'Succeeded'; + +/** + * Defines values for ErrorResponseCode. + * Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', + * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', + * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', 'InvalidRequestUri', + * 'MissingTenantId', 'InvalidTenantId', 'InvalidReservationOrderId', 'InvalidReservationId', + * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionId', + * 'InvalidAccessToken', 'InvalidLocationId', 'UnauthenticatedRequestsThrottled', + * 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIdCannotBeChanged', + * 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', + * 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', 'ReservationOrderNotEnabled', + * 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', 'ReservationOrderIdAlreadyExists', + * 'RiskCheckFailed', 'CreateQuoteFailed', 'ActivateQuoteFailed', 'NonsupportedAccountId', + * 'PaymentInstrumentNotFound', 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', + * 'ReRateOnlyAllowedForEA', 'OperationCannotBePerformedInCurrentState', + * 'InvalidSingleAppliedScopesCount', 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', + * 'InvalidRefundQuantity', 'PurchaseError', 'BillingCustomerInputError', + * 'BillingPaymentInstrumentSoftError', 'BillingPaymentInstrumentHardError', + * 'BillingTransientError', 'BillingError', 'FulfillmentConfigurationError', + * 'FulfillmentOutOfStockError', 'FulfillmentTransientError', 'FulfillmentError', + * 'CalculatePriceFailed' + * @readonly + * @enum {string} + */ +export type ErrorResponseCode = 'NotSpecified' | 'InternalServerError' | 'ServerTimeout' | 'AuthorizationFailed' | 'BadRequest' | 'ClientCertificateThumbprintNotSet' | 'InvalidRequestContent' | 'OperationFailed' | 'HttpMethodNotSupported' | 'InvalidRequestUri' | 'MissingTenantId' | 'InvalidTenantId' | 'InvalidReservationOrderId' | 'InvalidReservationId' | 'ReservationIdNotInReservationOrder' | 'ReservationOrderNotFound' | 'InvalidSubscriptionId' | 'InvalidAccessToken' | 'InvalidLocationId' | 'UnauthenticatedRequestsThrottled' | 'InvalidHealthCheckType' | 'Forbidden' | 'BillingScopeIdCannotBeChanged' | 'AppliedScopesNotAssociatedWithCommerceAccount' | 'PatchValuesSameAsExisting' | 'RoleAssignmentCreationFailed' | 'ReservationOrderCreationFailed' | 'ReservationOrderNotEnabled' | 'CapacityUpdateScopesFailed' | 'UnsupportedReservationTerm' | 'ReservationOrderIdAlreadyExists' | 'RiskCheckFailed' | 'CreateQuoteFailed' | 'ActivateQuoteFailed' | 'NonsupportedAccountId' | 'PaymentInstrumentNotFound' | 'MissingAppliedScopesForSingle' | 'NoValidReservationsToReRate' | 'ReRateOnlyAllowedForEA' | 'OperationCannotBePerformedInCurrentState' | 'InvalidSingleAppliedScopesCount' | 'InvalidFulfillmentRequestParameters' | 'NotSupportedCountry' | 'InvalidRefundQuantity' | 'PurchaseError' | 'BillingCustomerInputError' | 'BillingPaymentInstrumentSoftError' | 'BillingPaymentInstrumentHardError' | 'BillingTransientError' | 'BillingError' | 'FulfillmentConfigurationError' | 'FulfillmentOutOfStockError' | 'FulfillmentTransientError' | 'FulfillmentError' | 'CalculatePriceFailed'; + +/** + * Defines values for ReservationTerm. + * Possible values include: 'P1Y', 'P3Y' + * @readonly + * @enum {string} + */ +export type ReservationTerm = 'P1Y' | 'P3Y'; + +/** + * Defines values for ReservedResourceType. + * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb' + * @readonly + * @enum {string} + */ +export type ReservedResourceType = 'VirtualMachines' | 'SqlDatabases' | 'SuseLinux' | 'CosmosDb'; + +/** + * Defines values for InstanceFlexibility. + * Possible values include: 'On', 'Off' + * @readonly + * @enum {string} + */ +export type InstanceFlexibility = 'On' | 'Off'; + +/** + * Defines values for AppliedScopeType. + * Possible values include: 'Single', 'Shared' + * @readonly + * @enum {string} + */ +export type AppliedScopeType = 'Single' | 'Shared'; + +/** + * Contains response data for the getCatalog operation. + */ +export type GetCatalogResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Catalog[]; + }; +}; + +/** + * Contains response data for the getAppliedReservationList operation. + */ +export type GetAppliedReservationListResponse = AppliedReservations & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: AppliedReservations; + }; +}; + +/** + * Contains response data for the calculate operation. + */ +export type ReservationOrderCalculateResponse = CalculatePriceResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: CalculatePriceResponse; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ReservationOrderListResponse = ReservationOrderList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationOrderList; + }; +}; + +/** + * Contains response data for the purchase operation. + */ +export type ReservationOrderPurchaseResponse = ReservationOrderResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationOrderResponse; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ReservationOrderGetResponse = ReservationOrderResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationOrderResponse; + }; +}; + +/** + * Contains response data for the beginPurchase operation. + */ +export type ReservationOrderBeginPurchaseResponse = ReservationOrderResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationOrderResponse; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ReservationOrderListNextResponse = ReservationOrderList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationOrderList; + }; +}; + +/** + * Contains response data for the split operation. + */ +export type ReservationSplitResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse[]; + }; +}; + +/** + * Contains response data for the merge operation. + */ +export type ReservationMergeResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse[]; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ReservationListResponse = ReservationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ReservationGetResponse = ReservationResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type ReservationUpdateResponse = ReservationResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse; + }; +}; + +/** + * Contains response data for the listRevisions operation. + */ +export type ReservationListRevisionsResponse = ReservationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationList; + }; +}; + +/** + * Contains response data for the beginSplit operation. + */ +export type ReservationBeginSplitResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse[]; + }; +}; + +/** + * Contains response data for the beginMerge operation. + */ +export type ReservationBeginMergeResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse[]; + }; +}; + +/** + * Contains response data for the beginUpdate operation. + */ +export type ReservationBeginUpdateResponse = ReservationResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationResponse; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ReservationListNextResponse = ReservationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationList; + }; +}; + +/** + * Contains response data for the listRevisionsNext operation. + */ +export type ReservationListRevisionsNextResponse = ReservationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ReservationList; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationListResponse = OperationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationList; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationListNextResponse = OperationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationList; + }; +}; diff --git a/sdk/reservations/arm-reservations/lib/models/mappers.ts b/sdk/reservations/arm-reservations/lib/models/mappers.ts new file mode 100644 index 000000000000..ea1d038f0a8a --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/mappers.ts @@ -0,0 +1,1028 @@ +/* + * 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. + */ + +import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const SkuName: msRest.CompositeMapper = { + serializedName: "SkuName", + type: { + name: "Composite", + className: "SkuName", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const SkuProperty: msRest.CompositeMapper = { + serializedName: "SkuProperty", + type: { + name: "Composite", + className: "SkuProperty", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const SkuRestriction: msRest.CompositeMapper = { + serializedName: "SkuRestriction", + type: { + name: "Composite", + className: "SkuRestriction", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + values: { + serializedName: "values", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reasonCode: { + serializedName: "reasonCode", + type: { + name: "String" + } + } + } + } +}; + +export const Catalog: msRest.CompositeMapper = { + serializedName: "Catalog", + type: { + name: "Composite", + className: "Catalog", + modelProperties: { + resourceType: { + readOnly: true, + serializedName: "resourceType", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + terms: { + readOnly: true, + serializedName: "terms", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + locations: { + readOnly: true, + serializedName: "locations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + skuProperties: { + readOnly: true, + serializedName: "skuProperties", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuProperty" + } + } + } + }, + restrictions: { + readOnly: true, + serializedName: "restrictions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuRestriction" + } + } + } + } + } + } +}; + +export const ExtendedStatusInfo: msRest.CompositeMapper = { + serializedName: "ExtendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo", + modelProperties: { + statusCode: { + serializedName: "statusCode", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationSplitProperties: msRest.CompositeMapper = { + serializedName: "ReservationSplitProperties", + type: { + name: "Composite", + className: "ReservationSplitProperties", + modelProperties: { + splitDestinations: { + serializedName: "splitDestinations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + splitSource: { + serializedName: "splitSource", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationMergeProperties: msRest.CompositeMapper = { + serializedName: "ReservationMergeProperties", + type: { + name: "Composite", + className: "ReservationMergeProperties", + modelProperties: { + mergeDestination: { + serializedName: "mergeDestination", + type: { + name: "String" + } + }, + mergeSources: { + serializedName: "mergeSources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ReservationProperties: msRest.CompositeMapper = { + serializedName: "ReservationProperties", + type: { + name: "Composite", + className: "ReservationProperties", + modelProperties: { + reservedResourceType: { + serializedName: "reservedResourceType", + type: { + name: "String" + } + }, + instanceFlexibility: { + serializedName: "instanceFlexibility", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "appliedScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + appliedScopeType: { + serializedName: "appliedScopeType", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + effectiveDateTime: { + serializedName: "effectiveDateTime", + type: { + name: "DateTime" + } + }, + lastUpdatedDateTime: { + readOnly: true, + serializedName: "lastUpdatedDateTime", + type: { + name: "DateTime" + } + }, + expiryDate: { + serializedName: "expiryDate", + type: { + name: "Date" + } + }, + skuDescription: { + serializedName: "skuDescription", + type: { + name: "String" + } + }, + extendedStatusInfo: { + serializedName: "extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + }, + splitProperties: { + serializedName: "splitProperties", + type: { + name: "Composite", + className: "ReservationSplitProperties" + } + }, + mergeProperties: { + serializedName: "mergeProperties", + type: { + name: "Composite", + className: "ReservationMergeProperties" + } + } + } + } +}; + +export const ReservationResponse: msRest.CompositeMapper = { + serializedName: "ReservationResponse", + type: { + name: "Composite", + className: "ReservationResponse", + modelProperties: { + location: { + readOnly: true, + serializedName: "location", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "Number" + } + }, + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "SkuName" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ReservationProperties" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationOrderResponse: msRest.CompositeMapper = { + serializedName: "ReservationOrderResponse", + type: { + name: "Composite", + className: "ReservationOrderResponse", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "Number" + } + }, + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + requestDateTime: { + serializedName: "properties.requestDateTime", + type: { + name: "DateTime" + } + }, + createdDateTime: { + serializedName: "properties.createdDateTime", + type: { + name: "DateTime" + } + }, + expiryDate: { + serializedName: "properties.expiryDate", + type: { + name: "Date" + } + }, + originalQuantity: { + serializedName: "properties.originalQuantity", + type: { + name: "Number" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + reservations: { + serializedName: "properties.reservations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CalculatePriceResponsePropertiesBillingCurrencyTotal: msRest.CompositeMapper = { + serializedName: "CalculatePriceResponseProperties_billingCurrencyTotal", + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const CalculatePriceResponsePropertiesPricingCurrencyTotal: msRest.CompositeMapper = { + serializedName: "CalculatePriceResponseProperties_pricingCurrencyTotal", + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const CalculatePriceResponseProperties: msRest.CompositeMapper = { + serializedName: "CalculatePriceResponseProperties", + type: { + name: "Composite", + className: "CalculatePriceResponseProperties", + modelProperties: { + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal" + } + }, + isBillingPartnerManaged: { + serializedName: "isBillingPartnerManaged", + type: { + name: "Boolean" + } + }, + reservationOrderId: { + serializedName: "reservationOrderId", + type: { + name: "String" + } + }, + skuTitle: { + serializedName: "skuTitle", + type: { + name: "String" + } + }, + skuDescription: { + serializedName: "skuDescription", + type: { + name: "String" + } + }, + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" + } + } + } + } +}; + +export const CalculatePriceResponse: msRest.CompositeMapper = { + serializedName: "CalculatePriceResponse", + type: { + name: "Composite", + className: "CalculatePriceResponse", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "CalculatePriceResponseProperties" + } + } + } + } +}; + +export const PurchaseRequestPropertiesReservedResourceProperties: msRest.CompositeMapper = { + serializedName: "PurchaseRequestProperties_reservedResourceProperties", + type: { + name: "Composite", + className: "PurchaseRequestPropertiesReservedResourceProperties", + modelProperties: { + instanceFlexibility: { + serializedName: "instanceFlexibility", + type: { + name: "String" + } + } + } + } +}; + +export const MergeRequest: msRest.CompositeMapper = { + serializedName: "MergeRequest", + type: { + name: "Composite", + className: "MergeRequest", + modelProperties: { + sources: { + serializedName: "properties.sources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const PurchaseRequest: msRest.CompositeMapper = { + serializedName: "PurchaseRequest", + type: { + name: "Composite", + className: "PurchaseRequest", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "SkuName" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + reservedResourceType: { + serializedName: "properties.reservedResourceType", + type: { + name: "String" + } + }, + billingScopeId: { + serializedName: "properties.billingScopeId", + type: { + name: "String" + } + }, + term: { + serializedName: "properties.term", + type: { + name: "String" + } + }, + quantity: { + serializedName: "properties.quantity", + type: { + name: "Number" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "properties.appliedScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reservedResourceProperties: { + serializedName: "properties.reservedResourceProperties", + type: { + name: "Composite", + className: "PurchaseRequestPropertiesReservedResourceProperties" + } + } + } + } +}; + +export const Patch: msRest.CompositeMapper = { + serializedName: "Patch", + type: { + name: "Composite", + className: "Patch", + modelProperties: { + appliedScopeType: { + serializedName: "properties.appliedScopeType", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "properties.appliedScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + instanceFlexibility: { + serializedName: "properties.instanceFlexibility", + type: { + name: "String" + } + }, + name: { + serializedName: "properties.name", + type: { + name: "String" + } + } + } + } +}; + +export const SplitRequest: msRest.CompositeMapper = { + serializedName: "SplitRequest", + type: { + name: "Composite", + className: "SplitRequest", + modelProperties: { + quantities: { + serializedName: "properties.quantities", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + reservationId: { + serializedName: "properties.reservationId", + type: { + name: "String" + } + } + } + } +}; + +export const ExtendedErrorInfo: msRest.CompositeMapper = { + serializedName: "ExtendedErrorInfo", + type: { + name: "Composite", + className: "ExtendedErrorInfo", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ExtendedErrorInfo" + } + } + } + } +}; + +export const AppliedReservationList: msRest.CompositeMapper = { + serializedName: "AppliedReservationList", + type: { + name: "Composite", + className: "AppliedReservationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const AppliedReservations: msRest.CompositeMapper = { + serializedName: "AppliedReservations", + type: { + name: "Composite", + className: "AppliedReservations", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + reservationOrderIds: { + serializedName: "properties.reservationOrderIds", + type: { + name: "Composite", + className: "AppliedReservationList" + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "OperationDisplay", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResponse: msRest.CompositeMapper = { + serializedName: "OperationResponse", + type: { + name: "Composite", + className: "OperationResponse", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationOrderList: msRest.CompositeMapper = { + serializedName: "ReservationOrderList", + type: { + name: "Composite", + className: "ReservationOrderList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationOrderResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationList: msRest.CompositeMapper = { + serializedName: "ReservationList", + type: { + name: "Composite", + className: "ReservationList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationList: msRest.CompositeMapper = { + serializedName: "OperationList", + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/reservations/arm-reservations/lib/models/operationMappers.ts b/sdk/reservations/arm-reservations/lib/models/operationMappers.ts new file mode 100644 index 000000000000..e360e157e02e --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/operationMappers.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { + OperationList, + OperationResponse, + OperationDisplay, + ErrorModel, + ExtendedErrorInfo +} from "../models/mappers"; + diff --git a/sdk/reservations/arm-reservations/lib/models/parameters.ts b/sdk/reservations/arm-reservations/lib/models/parameters.ts new file mode 100644 index 000000000000..dc4ae6ee1801 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/parameters.ts @@ -0,0 +1,95 @@ +/* + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; +export const location: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "location" + ], + mapper: { + serializedName: "location", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const reservationId: msRest.OperationURLParameter = { + parameterPath: "reservationId", + mapper: { + required: true, + serializedName: "reservationId", + type: { + name: "String" + } + } +}; +export const reservationOrderId: msRest.OperationURLParameter = { + parameterPath: "reservationOrderId", + mapper: { + required: true, + serializedName: "reservationOrderId", + type: { + name: "String" + } + } +}; +export const reservedResourceType: msRest.OperationQueryParameter = { + parameterPath: "reservedResourceType", + mapper: { + required: true, + serializedName: "reservedResourceType", + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/reservations/arm-reservations/lib/models/reservationMappers.ts b/sdk/reservations/arm-reservations/lib/models/reservationMappers.ts new file mode 100644 index 000000000000..e9a0396d71b1 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/reservationMappers.ts @@ -0,0 +1,27 @@ +/* + * 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. + */ + +export { + SplitRequest, + ReservationResponse, + BaseResource, + SkuName, + ReservationProperties, + ExtendedStatusInfo, + ReservationSplitProperties, + ReservationMergeProperties, + ErrorModel, + ExtendedErrorInfo, + MergeRequest, + ReservationList, + Patch, + ReservationOrderResponse +} from "../models/mappers"; + diff --git a/sdk/reservations/arm-reservations/lib/models/reservationOrderMappers.ts b/sdk/reservations/arm-reservations/lib/models/reservationOrderMappers.ts new file mode 100644 index 000000000000..e43785ce0768 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/models/reservationOrderMappers.ts @@ -0,0 +1,30 @@ +/* + * 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. + */ + +export { + PurchaseRequest, + SkuName, + PurchaseRequestPropertiesReservedResourceProperties, + CalculatePriceResponse, + CalculatePriceResponseProperties, + CalculatePriceResponsePropertiesBillingCurrencyTotal, + CalculatePriceResponsePropertiesPricingCurrencyTotal, + ErrorModel, + ExtendedErrorInfo, + ReservationOrderList, + ReservationOrderResponse, + BaseResource, + ReservationResponse, + ReservationProperties, + ExtendedStatusInfo, + ReservationSplitProperties, + ReservationMergeProperties +} from "../models/mappers"; + diff --git a/sdk/reservations/arm-reservations/lib/operations/index.ts b/sdk/reservations/arm-reservations/lib/operations/index.ts new file mode 100644 index 000000000000..e4097a35df4b --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/operations/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export * from "./reservationOrder"; +export * from "./reservation"; +export * from "./operation"; diff --git a/sdk/reservations/arm-reservations/lib/operations/operation.ts b/sdk/reservations/arm-reservations/lib/operations/operation.ts new file mode 100644 index 000000000000..b1c036dbf972 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/operations/operation.ts @@ -0,0 +1,125 @@ +/* + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationMappers"; +import * as Parameters from "../models/parameters"; +import { AzureReservationAPIContext } from "../azureReservationAPIContext"; + +/** Class representing a Operation. */ +export class Operation { + private readonly client: AzureReservationAPIContext; + + /** + * Create a Operation. + * @param {AzureReservationAPIContext} client Reference to the service client. + */ + constructor(client: AzureReservationAPIContext) { + this.client = client; + } + + /** + * List all the operations. + * @summary Get operations. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * List all the operations. + * @summary Get operations. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; diff --git a/sdk/reservations/arm-reservations/lib/operations/reservation.ts b/sdk/reservations/arm-reservations/lib/operations/reservation.ts new file mode 100644 index 000000000000..231a4cd56e95 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/operations/reservation.ts @@ -0,0 +1,514 @@ +/* + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/reservationMappers"; +import * as Parameters from "../models/parameters"; +import { AzureReservationAPIContext } from "../azureReservationAPIContext"; + +/** Class representing a Reservation. */ +export class Reservation { + private readonly client: AzureReservationAPIContext; + + /** + * Create a Reservation. + * @param {AzureReservationAPIContext} client Reference to the service client. + */ + constructor(client: AzureReservationAPIContext) { + this.client = client; + } + + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @summary Split the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param [options] The optional parameters + * @returns Promise + */ + split(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { + return this.beginSplit(reservationOrderId,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @summary Merges two `Reservation`s. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param [options] The optional parameters + * @returns Promise + */ + merge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { + return this.beginMerge(reservationOrderId,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * List `Reservation`s within a single `ReservationOrder`. + * @summary Get `Reservation`s in a given reservation Order + * @param reservationOrderId Order Id of the reservation + * @param [options] The optional parameters + * @returns Promise + */ + list(reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param reservationOrderId Order Id of the reservation + * @param callback The callback + */ + list(reservationOrderId: string, callback: msRest.ServiceCallback): void; + /** + * @param reservationOrderId Order Id of the reservation + * @param options The optional parameters + * @param callback The callback + */ + list(reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + reservationOrderId, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Get specific `Reservation` details. + * @summary Get `Reservation` details. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param [options] The optional parameters + * @returns Promise + */ + get(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param callback The callback + */ + get(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; + /** + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The optional parameters + * @param callback The callback + */ + get(reservationId: string, reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + reservationId, + reservationOrderId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Updates the applied scopes of the `Reservation`. + * @summary Updates a `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param [options] The optional parameters + * @returns Promise + */ + update(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { + return this.beginUpdate(reservationOrderId,reservationId,parameters,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * List of all the revisions for the `Reservation`. + * @summary Get `Reservation` revisions. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param [options] The optional parameters + * @returns Promise + */ + listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param callback The callback + */ + listRevisions(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; + /** + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The optional parameters + * @param callback The callback + */ + listRevisions(reservationId: string, reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + reservationId, + reservationOrderId, + options + }, + listRevisionsOperationSpec, + callback) as Promise; + } + + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @summary Split the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param [options] The optional parameters + * @returns Promise + */ + beginSplit(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + reservationOrderId, + body, + options + }, + beginSplitOperationSpec, + options); + } + + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @summary Merges two `Reservation`s. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param [options] The optional parameters + * @returns Promise + */ + beginMerge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + reservationOrderId, + body, + options + }, + beginMergeOperationSpec, + options); + } + + /** + * Updates the applied scopes of the `Reservation`. + * @summary Updates a `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param [options] The optional parameters + * @returns Promise + */ + beginUpdate(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + reservationOrderId, + reservationId, + parameters, + options + }, + beginUpdateOperationSpec, + options); + } + + /** + * List `Reservation`s within a single `ReservationOrder`. + * @summary Get `Reservation`s in a given reservation Order + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } + + /** + * List of all the revisions for the `Reservation`. + * @summary Get `Reservation` revisions. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listRevisionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listRevisionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listRevisionsNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", + urlParameters: [ + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + urlParameters: [ + Parameters.reservationId, + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listRevisionsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", + urlParameters: [ + Parameters.reservationId, + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const beginSplitOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", + urlParameters: [ + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.SplitRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + } + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const beginMergeOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", + urlParameters: [ + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.MergeRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + } + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const beginUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + urlParameters: [ + Parameters.reservationOrderId, + Parameters.reservationId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.Patch, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.ReservationResponse + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listRevisionsNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; diff --git a/sdk/reservations/arm-reservations/lib/operations/reservationOrder.ts b/sdk/reservations/arm-reservations/lib/operations/reservationOrder.ts new file mode 100644 index 000000000000..4ee3cdc5f337 --- /dev/null +++ b/sdk/reservations/arm-reservations/lib/operations/reservationOrder.ts @@ -0,0 +1,299 @@ +/* + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/reservationOrderMappers"; +import * as Parameters from "../models/parameters"; +import { AzureReservationAPIContext } from "../azureReservationAPIContext"; + +/** Class representing a ReservationOrder. */ +export class ReservationOrder { + private readonly client: AzureReservationAPIContext; + + /** + * Create a ReservationOrder. + * @param {AzureReservationAPIContext} client Reference to the service client. + */ + constructor(client: AzureReservationAPIContext) { + this.client = client; + } + + /** + * Calculate price for placing a `ReservationOrder`. + * @summary Calculate price for a `ReservationOrder`. + * @param body Information needed for calculate or purchase reservation + * @param [options] The optional parameters + * @returns Promise + */ + calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise; + /** + * @param body Information needed for calculate or purchase reservation + * @param callback The callback + */ + calculate(body: Models.PurchaseRequest, callback: msRest.ServiceCallback): void; + /** + * @param body Information needed for calculate or purchase reservation + * @param options The optional parameters + * @param callback The callback + */ + calculate(body: Models.PurchaseRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + body, + options + }, + calculateOperationSpec, + callback) as Promise; + } + + /** + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @summary Get all `ReservationOrder`s. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @summary Purchase `ReservationOrder` + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param [options] The optional parameters + * @returns Promise + */ + purchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { + return this.beginPurchase(reservationOrderId,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Get the details of the `ReservationOrder`. + * @summary Get a specific `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param [options] The optional parameters + * @returns Promise + */ + get(reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param reservationOrderId Order Id of the reservation + * @param callback The callback + */ + get(reservationOrderId: string, callback: msRest.ServiceCallback): void; + /** + * @param reservationOrderId Order Id of the reservation + * @param options The optional parameters + * @param callback The callback + */ + get(reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + reservationOrderId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @summary Purchase `ReservationOrder` + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param [options] The optional parameters + * @returns Promise + */ + beginPurchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + reservationOrderId, + body, + options + }, + beginPurchaseOperationSpec, + options); + } + + /** + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @summary Get all `ReservationOrder`s. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const calculateOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Capacity/calculatePrice", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.PurchaseRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CalculatePriceResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/reservationOrders", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", + urlParameters: [ + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const beginPurchaseOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", + urlParameters: [ + Parameters.reservationOrderId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.PurchaseRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderResponse + }, + 202: { + bodyMapper: Mappers.ReservationOrderResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; diff --git a/sdk/reservations/arm-reservations/package.json b/sdk/reservations/arm-reservations/package.json index 53bc0240154f..b495d6b7aefe 100644 --- a/sdk/reservations/arm-reservations/package.json +++ b/sdk/reservations/arm-reservations/package.json @@ -4,8 +4,8 @@ "description": "AzureReservationAPI Library with typescript type definitions for node.js and browser.", "version": "2.3.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.3.2", - "@azure/ms-rest-js": "^1.8.1", + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -43,8 +43,7 @@ "esm/**/*.js.map", "esm/**/*.d.ts", "esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", + "lib/**/*.ts", "rollup.config.js", "tsconfig.json" ], @@ -53,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-reservations.js.map'\" -o ./dist/arm-reservations.min.js ./dist/arm-reservations.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "autoPublish": true + "sideEffects": false } diff --git a/sdk/reservations/arm-reservations/tsconfig.json b/sdk/reservations/arm-reservations/tsconfig.json index 87bbf5b5fa49..51ea90961ce5 100644 --- a/sdk/reservations/arm-reservations/tsconfig.json +++ b/sdk/reservations/arm-reservations/tsconfig.json @@ -14,6 +14,6 @@ "outDir": "./esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./lib/**/*.ts"], "exclude": ["node_modules"] }