From 6dfcd9591533a624fd4cf665e2ceeaed89740746 Mon Sep 17 00:00:00 2001 From: Ruoxuan Wang <52271048+ruowan@users.noreply.github.com> Date: Tue, 8 Oct 2019 14:30:08 +0800 Subject: [PATCH] release reservations RP-Billing plan 2019-04 (#5449) --- .../arm-reservations/package.json | 2 +- .../src/azureReservationAPI.ts | 3 +- .../src/azureReservationAPIContext.ts | 8 +- .../arm-reservations/src/models/index.ts | 122 +++++++++++ .../arm-reservations/src/models/mappers.ts | 203 ++++++++++++++++++ .../arm-reservations/src/models/parameters.ts | 14 +- .../src/models/reservationMappers.ts | 3 + .../src/models/reservationOrderMappers.ts | 3 + .../src/operations/reservation.ts | 2 +- .../src/operations/reservationOrder.ts | 9 +- 10 files changed, 357 insertions(+), 12 deletions(-) diff --git a/sdk/reservations/arm-reservations/package.json b/sdk/reservations/arm-reservations/package.json index 06936e6544c6..336a2a5c96d4 100644 --- a/sdk/reservations/arm-reservations/package.json +++ b/sdk/reservations/arm-reservations/package.json @@ -2,7 +2,7 @@ "name": "@azure/arm-reservations", "author": "Microsoft Corporation", "description": "AzureReservationAPI Library with typescript type definitions for node.js and browser.", - "version": "3.0.0", + "version": "4.0.0", "dependencies": { "@azure/ms-rest-azure-js": "^2.0.1", "@azure/ms-rest-js": "^2.0.4", diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts index 591312dc464a..04ad2547c57d 100644 --- a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts +++ b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts @@ -68,7 +68,8 @@ class AzureReservationAPI extends AzureReservationAPIContext { } /** - * Get applicable `Reservation`s that are applied to this subscription. + * Get applicable `Reservation`s that are applied to this subscription or a resource group under + * this subscription. * @summary Get list of applicable `Reservation`s. * @param subscriptionId Id of the subscription * @param [options] The optional parameters diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts b/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts index 30d0953fda22..79bdbe3eda31 100644 --- a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts +++ b/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-reservations"; -const packageVersion = "3.0.0"; +const packageVersion = "4.0.0"; export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; @@ -32,7 +32,7 @@ export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { if (!options) { options = {}; } - if (!options.userAgent) { + if(!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } @@ -46,10 +46,10 @@ export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } } diff --git a/sdk/reservations/arm-reservations/src/models/index.ts b/sdk/reservations/arm-reservations/src/models/index.ts index fac9e2edd719..36d58d298379 100644 --- a/sdk/reservations/arm-reservations/src/models/index.ts +++ b/sdk/reservations/arm-reservations/src/models/index.ts @@ -18,6 +18,22 @@ export interface SkuName { name?: string; } +/** + * An interface representing CatalogBillingPlansItem. + */ +export interface CatalogBillingPlansItem { + /** + * The term for the billing SKU is available for. Possible values include: 'P1Y', 'P3Y' + */ + name?: ReservationTerm; + /** + * Describes unknown properties. The value of an unknown property MUST be of type + * "ReservationBillingPlan[]". Due to valid TS constraints we have modeled this as a union of + * `ReservationBillingPlan[] | any`. + */ + [property: string]: ReservationBillingPlan[] | any; +} + /** * An interface representing SkuProperty. */ @@ -65,6 +81,10 @@ export interface Catalog { * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly name?: string; + /** + * The billing plan options available for this SKU. + */ + billingPlans?: CatalogBillingPlansItem[]; /** * Available reservation terms for this resource * **NOTE: This property will not be serialized. It can only be populated by the server.** @@ -84,6 +104,17 @@ export interface Catalog { readonly restrictions?: SkuRestriction[]; } +/** + * An interface representing Price. + */ +export interface Price { + /** + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + currencyCode?: string; + amount?: number; +} + /** * An interface representing ExtendedStatusInfo. */ @@ -99,6 +130,57 @@ export interface ExtendedStatusInfo { message?: string; } +/** + * Information about payment related to a reservation order. + */ +export interface PaymentDetail { + /** + * Date when the payment needs to be done. + */ + dueDate?: Date; + /** + * Date when the transaction is completed. Is null when it is scheduled. + */ + paymentDate?: Date; + /** + * Amount in pricing currency. Tax not included. + */ + pricingCurrencyTotal?: Price; + /** + * Amount charged in Billing currency. Tax not included. Is null for future payments + */ + billingCurrencyTotal?: Price; + /** + * Shows the Account that is charged for this payment. + */ + billingAccount?: string; + /** + * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' + */ + status?: PaymentStatus; + extendedStatusInfo?: ExtendedStatusInfo; +} + +/** + * Information describing the type of billing plan for this reservation. + */ +export interface ReservationOrderBillingPlanInformation { + /** + * Amount of money to be paid for the Order. Tax is not included. + */ + pricingCurrencyTotal?: Price; + /** + * Date when the billing plan has started. + */ + startDate?: Date; + /** + * For recurring billing plans, indicates the date when next payment will be processed. Null when + * total is paid off. + */ + nextPaymentDueDate?: Date; + transactions?: PaymentDetail[]; +} + /** * An interface representing ReservationSplitProperties. */ @@ -161,6 +243,10 @@ export interface PurchaseRequest { * Possible values include: 'P1Y', 'P3Y' */ term?: ReservationTerm; + /** + * Possible values include: 'Upfront', 'Monthly' + */ + billingPlan?: ReservationBillingPlan; quantity?: number; /** * Friendly name of the Reservation @@ -258,6 +344,10 @@ export interface ReservationProperties { */ skuDescription?: string; extendedStatusInfo?: ExtendedStatusInfo; + /** + * Possible values include: 'Upfront', 'Monthly' + */ + billingPlan?: ReservationBillingPlan; splitProperties?: ReservationSplitProperties; mergeProperties?: ReservationMergeProperties; billingScopeId?: string; @@ -350,6 +440,11 @@ export interface ReservationOrderResponse extends BaseResource { * Current state of the reservation. */ provisioningState?: string; + /** + * Possible values include: 'Upfront', 'Monthly' + */ + billingPlan?: ReservationBillingPlan; + planInformation?: ReservationOrderBillingPlanInformation; reservations?: ReservationResponse[]; /** * Type of resource. "Microsoft.Capacity/reservations" @@ -406,6 +501,7 @@ export interface CalculatePriceResponseProperties { * not included. */ pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; + paymentSchedule?: PaymentDetail[]; } /** @@ -600,6 +696,16 @@ export interface AzureReservationAPIGetCatalogOptionalParams extends msRest.Requ location?: string; } +/** + * Optional Parameters. + */ +export interface ReservationOrderGetOptionalParams extends msRest.RequestOptionsBase { + /** + * May be used to expand the planInformation. + */ + expand?: string; +} + /** * An interface representing AzureReservationAPIOptions. */ @@ -678,6 +784,14 @@ export type ReservationStatusCode = 'None' | 'Pending' | 'Active' | 'PurchaseErr */ 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 ReservationBillingPlan. + * Possible values include: 'Upfront', 'Monthly' + * @readonly + * @enum {string} + */ +export type ReservationBillingPlan = 'Upfront' | 'Monthly'; + /** * Defines values for ReservationTerm. * Possible values include: 'P1Y', 'P3Y' @@ -686,6 +800,14 @@ export type ErrorResponseCode = 'NotSpecified' | 'InternalServerError' | 'Server */ export type ReservationTerm = 'P1Y' | 'P3Y'; +/** + * Defines values for PaymentStatus. + * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' + * @readonly + * @enum {string} + */ +export type PaymentStatus = 'Succeeded' | 'Failed' | 'Scheduled' | 'Cancelled'; + /** * Defines values for ReservedResourceType. * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', diff --git a/sdk/reservations/arm-reservations/src/models/mappers.ts b/sdk/reservations/arm-reservations/src/models/mappers.ts index 380ccf164f68..b8048804dfbe 100644 --- a/sdk/reservations/arm-reservations/src/models/mappers.ts +++ b/sdk/reservations/arm-reservations/src/models/mappers.ts @@ -28,6 +28,32 @@ export const SkuName: msRest.CompositeMapper = { } }; +export const CatalogBillingPlansItem: msRest.CompositeMapper = { + serializedName: "Catalog_billingPlansItem", + type: { + name: "Composite", + className: "CatalogBillingPlansItem", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + }, + additionalProperties: { + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } +}; + export const SkuProperty: msRest.CompositeMapper = { serializedName: "SkuProperty", type: { @@ -103,6 +129,28 @@ export const Catalog: msRest.CompositeMapper = { name: "String" } }, + billingPlans: { + serializedName: "billingPlans", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CatalogBillingPlansItem", + additionalProperties: { + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } + } + }, terms: { readOnly: true, serializedName: "terms", @@ -157,6 +205,28 @@ export const Catalog: msRest.CompositeMapper = { } }; +export const Price: msRest.CompositeMapper = { + serializedName: "Price", + type: { + name: "Composite", + className: "Price", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + export const ExtendedStatusInfo: msRest.CompositeMapper = { serializedName: "ExtendedStatusInfo", type: { @@ -179,6 +249,102 @@ export const ExtendedStatusInfo: msRest.CompositeMapper = { } }; +export const PaymentDetail: msRest.CompositeMapper = { + serializedName: "PaymentDetail", + type: { + name: "Composite", + className: "PaymentDetail", + modelProperties: { + dueDate: { + serializedName: "dueDate", + type: { + name: "Date" + } + }, + paymentDate: { + serializedName: "paymentDate", + type: { + name: "Date" + } + }, + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + billingAccount: { + serializedName: "billingAccount", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + extendedStatusInfo: { + serializedName: "extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + } + } + } +}; + +export const ReservationOrderBillingPlanInformation: msRest.CompositeMapper = { + serializedName: "ReservationOrderBillingPlanInformation", + type: { + name: "Composite", + className: "ReservationOrderBillingPlanInformation", + modelProperties: { + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + startDate: { + serializedName: "startDate", + type: { + name: "Date" + } + }, + nextPaymentDueDate: { + serializedName: "nextPaymentDueDate", + type: { + name: "Date" + } + }, + transactions: { + serializedName: "transactions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PaymentDetail" + } + } + } + } + } + } +}; + export const ReservationSplitProperties: msRest.CompositeMapper = { serializedName: "ReservationSplitProperties", type: { @@ -286,6 +452,12 @@ export const PurchaseRequest: msRest.CompositeMapper = { name: "String" } }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, quantity: { serializedName: "properties.quantity", type: { @@ -492,6 +664,12 @@ export const ReservationProperties: msRest.CompositeMapper = { className: "ExtendedStatusInfo" } }, + billingPlan: { + serializedName: "billingPlan", + type: { + name: "String" + } + }, splitProperties: { serializedName: "splitProperties", type: { @@ -673,6 +851,19 @@ export const ReservationOrderResponse: msRest.CompositeMapper = { name: "String" } }, + billingPlan: { + serializedName: "properties.billingPlan", + type: { + name: "String" + } + }, + planInformation: { + serializedName: "properties.planInformation", + type: { + name: "Composite", + className: "ReservationOrderBillingPlanInformation" + } + }, reservations: { serializedName: "properties.reservations", type: { @@ -783,6 +974,18 @@ export const CalculatePriceResponseProperties: msRest.CompositeMapper = { name: "Composite", className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" } + }, + paymentSchedule: { + serializedName: "paymentSchedule", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PaymentDetail" + } + } + } } } } diff --git a/sdk/reservations/arm-reservations/src/models/parameters.ts b/sdk/reservations/arm-reservations/src/models/parameters.ts index 1b683497de76..7b6fd0df4ef5 100644 --- a/sdk/reservations/arm-reservations/src/models/parameters.ts +++ b/sdk/reservations/arm-reservations/src/models/parameters.ts @@ -30,7 +30,7 @@ export const apiVersion: msRest.OperationQueryParameter = { } } }; -export const expand: msRest.OperationQueryParameter = { +export const expand0: msRest.OperationQueryParameter = { parameterPath: [ "options", "expand" @@ -42,6 +42,18 @@ export const expand: msRest.OperationQueryParameter = { } } }; +export const expand1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "expand" + ], + mapper: { + serializedName: "$expand", + type: { + name: "String" + } + } +}; export const location: msRest.OperationQueryParameter = { parameterPath: [ "options", diff --git a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationMappers.ts index 6bc4aa83d14f..3d29bc7020c1 100644 --- a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts +++ b/sdk/reservations/arm-reservations/src/models/reservationMappers.ts @@ -14,6 +14,8 @@ export { MergeRequest, Patch, PatchPropertiesRenewProperties, + PaymentDetail, + Price, Properties, PurchaseRequest, PurchaseRequestPropertiesReservedResourceProperties, @@ -22,6 +24,7 @@ export { RenewPropertiesResponsePricingCurrencyTotal, ReservationList, ReservationMergeProperties, + ReservationOrderBillingPlanInformation, ReservationOrderResponse, ReservationProperties, ReservationResponse, diff --git a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts index 877124fd40eb..3d1469c70c00 100644 --- a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts +++ b/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts @@ -15,12 +15,15 @@ export { ErrorModel, ExtendedErrorInfo, ExtendedStatusInfo, + PaymentDetail, + Price, PurchaseRequest, PurchaseRequestPropertiesReservedResourceProperties, RenewPropertiesResponse, RenewPropertiesResponseBillingCurrencyTotal, RenewPropertiesResponsePricingCurrencyTotal, ReservationMergeProperties, + ReservationOrderBillingPlanInformation, ReservationOrderList, ReservationOrderResponse, ReservationProperties, diff --git a/sdk/reservations/arm-reservations/src/operations/reservation.ts b/sdk/reservations/arm-reservations/src/operations/reservation.ts index 27372a747485..07f8c02ebb18 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservation.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservation.ts @@ -351,7 +351,7 @@ const getOperationSpec: msRest.OperationSpec = { ], queryParameters: [ Parameters.apiVersion, - Parameters.expand + Parameters.expand0 ], headerParameters: [ Parameters.acceptLanguage diff --git a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts index 4ee3cdc5f337..07d0d9272af5 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts @@ -101,7 +101,7 @@ export class ReservationOrder { * @param [options] The optional parameters * @returns Promise */ - get(reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; + get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams): Promise; /** * @param reservationOrderId Order Id of the reservation * @param callback The callback @@ -112,8 +112,8 @@ export class ReservationOrder { * @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 { + get(reservationOrderId: string, options: Models.ReservationOrderGetOptionalParams, callback: msRest.ServiceCallback): void; + get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { reservationOrderId, @@ -228,7 +228,8 @@ const getOperationSpec: msRest.OperationSpec = { Parameters.reservationOrderId ], queryParameters: [ - Parameters.apiVersion + Parameters.apiVersion, + Parameters.expand1 ], headerParameters: [ Parameters.acceptLanguage