From 724c018466c26e345aee36ee6e9ac7ed145249f3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 11 Jan 2023 20:46:12 +0000 Subject: [PATCH] CodeGen from PR 22153 in Azure/azure-rest-api-specs Merge f947fd18282ca7b81314c66a264cd1cddaa93288 into 71121282e39bccae590462648e77bca283df6d2b --- sdk/consumption/arm-consumption/CHANGELOG.md | 34 +- sdk/consumption/arm-consumption/_meta.json | 10 +- sdk/consumption/arm-consumption/package.json | 17 +- .../review/arm-consumption.api.md | 74 +- .../src/consumptionManagementClient.ts | 2 +- .../arm-consumption/src/models/index.ts | 547 +++++++++----- .../arm-consumption/src/models/mappers.ts | 704 +++++++++++------- .../arm-consumption/src/models/parameters.ts | 34 + .../src/operations/lotsOperations.ts | 189 ++++- .../src/operations/marketplaces.ts | 2 + .../reservationRecommendationDetails.ts | 24 +- .../operations/reservationRecommendations.ts | 71 +- .../src/operations/reservationTransactions.ts | 20 +- .../src/operations/reservationsDetails.ts | 88 ++- .../src/operations/reservationsSummaries.ts | 68 +- .../src/operations/usageDetails.ts | 2 + .../operationsInterfaces/lotsOperations.ts | 25 +- .../reservationRecommendationDetails.ts | 17 +- .../reservationRecommendations.ts | 14 +- .../reservationTransactions.ts | 10 +- .../reservationsDetails.ts | 24 +- .../reservationsSummaries.ts | 12 +- .../arm-consumption/test/sampleTest.ts | 43 ++ sdk/consumption/arm-consumption/tsconfig.json | 10 +- 24 files changed, 1371 insertions(+), 670 deletions(-) create mode 100644 sdk/consumption/arm-consumption/test/sampleTest.ts diff --git a/sdk/consumption/arm-consumption/CHANGELOG.md b/sdk/consumption/arm-consumption/CHANGELOG.md index f76f06327d23..a033fcca31a5 100644 --- a/sdk/consumption/arm-consumption/CHANGELOG.md +++ b/sdk/consumption/arm-consumption/CHANGELOG.md @@ -1,15 +1,33 @@ # Release History + +## 10.0.0 (2023-01-11) + +**Features** -## 9.2.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation LotsOperations.listByCustomer + - Added Interface LotsListByCustomerNextOptionalParams + - Added Interface LotsListByCustomerOptionalParams + - Added Interface ModernReservationRecommendationProperties + - Added Interface ModernSharedScopeReservationRecommendationProperties + - Added Interface ModernSingleScopeReservationRecommendationProperties + - Added Type Alias LotsListByCustomerNextResponse + - Added Type Alias LotsListByCustomerResponse + - Added Type Alias ModernReservationRecommendationPropertiesUnion + - Interface CreditSummary has a new optional parameter eTagPropertiesETag + - Interface LegacyChargeSummary has a new optional parameter azureMarketplaceCharges + - Interface LegacyUsageDetail has a new optional parameter benefitId + - Interface LegacyUsageDetail has a new optional parameter benefitName + - Interface ModernReservationRecommendation has a new optional parameter resourceType + - Enum KnownEventType has a new value CreditExpired -### Other Changes +**Breaking Changes** + - Operation ReservationRecommendationDetails.get has a new signature + - Interface BudgetFilter no longer has parameter not + - Interface LegacyChargeSummary no longer has parameter marketplaceCharges + - Parameter scope of interface ModernReservationRecommendation is now required + + ## 9.2.0 (2023-01-03) **Features** diff --git a/sdk/consumption/arm-consumption/_meta.json b/sdk/consumption/arm-consumption/_meta.json index 53b7e4beed2c..eb5e58123b45 100644 --- a/sdk/consumption/arm-consumption/_meta.json +++ b/sdk/consumption/arm-consumption/_meta.json @@ -1,8 +1,8 @@ { - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", - "readme": "specification\\consumption\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\consumption\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true", + "commit": "819d2805d9a43c3006af2487c46a8245df4790e8", + "readme": "specification/consumption/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/consumption/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.5", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.4", - "use": "@autorest/typescript@6.0.0-rc.5.20221215.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.0", + "use": "@autorest/typescript@6.0.0-rc.5" } \ No newline at end of file diff --git a/sdk/consumption/arm-consumption/package.json b/sdk/consumption/arm-consumption/package.json index 7003aa6aa9d3..5e60e9163529 100644 --- a/sdk/consumption/arm-consumption/package.json +++ b/sdk/consumption/arm-consumption/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ConsumptionManagementClient.", - "version": "9.2.1", + "version": "10.0.0", "engines": { "node": ">=14.0.0" }, @@ -37,7 +37,6 @@ "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", - "dotenv": "^8.2.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^2.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -48,6 +47,7 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/consumption/arm-consumption", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -108,14 +108,5 @@ } ] }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/consumption/arm-consumption", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-consumption?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/consumption/arm-consumption/review/arm-consumption.api.md b/sdk/consumption/arm-consumption/review/arm-consumption.api.md index e949327f5510..e15188f3c637 100644 --- a/sdk/consumption/arm-consumption/review/arm-consumption.api.md +++ b/sdk/consumption/arm-consumption/review/arm-consumption.api.md @@ -120,7 +120,6 @@ export interface BudgetComparisonExpression { export interface BudgetFilter { and?: BudgetFilterProperties[]; dimensions?: BudgetComparisonExpression; - not?: BudgetFilterProperties; tags?: BudgetComparisonExpression; } @@ -210,7 +209,7 @@ export interface ChargesListResult { } // @public -export interface ChargeSummary extends ProxyResource { +export interface ChargeSummary extends Resource { kind: ChargeSummaryKind; } @@ -292,11 +291,11 @@ export interface CreditsGetOptionalParams extends coreClient.OperationOptions { export type CreditsGetResponse = CreditSummary; // @public -export interface CreditSummary extends Resource { +export interface CreditSummary extends ProxyResource { readonly balanceSummary?: CreditBalanceSummary; readonly billingCurrency?: string; readonly creditCurrency?: string; - readonly eTag?: string; + readonly eTagPropertiesETag?: string; readonly expiredCredit?: Amount; readonly pendingCreditAdjustments?: Amount; readonly pendingEligibleCharges?: Amount; @@ -479,6 +478,7 @@ export enum KnownDatagrain { // @public export enum KnownEventType { + CreditExpired = "CreditExpired", NewCredit = "NewCredit", PendingAdjustments = "PendingAdjustments", PendingCharges = "PendingCharges", @@ -576,11 +576,11 @@ export enum KnownUsageDetailsKind { // @public export interface LegacyChargeSummary extends ChargeSummary { readonly azureCharges?: number; + readonly azureMarketplaceCharges?: number; readonly billingPeriodId?: string; readonly chargesBilledSeparately?: number; readonly currency?: string; kind: "legacy"; - readonly marketplaceCharges?: number; readonly usageEnd?: string; readonly usageStart?: string; } @@ -647,6 +647,8 @@ export interface LegacyUsageDetail extends UsageDetail { readonly accountName?: string; readonly accountOwnerId?: string; readonly additionalInfo?: string; + readonly benefitId?: string; + readonly benefitName?: string; readonly billingAccountId?: string; readonly billingAccountName?: string; readonly billingCurrency?: string; @@ -729,10 +731,26 @@ export interface LotsListByBillingProfileOptionalParams extends coreClient.Opera // @public export type LotsListByBillingProfileResponse = Lots; +// @public +export interface LotsListByCustomerNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LotsListByCustomerNextResponse = Lots; + +// @public +export interface LotsListByCustomerOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type LotsListByCustomerResponse = Lots; + // @public export interface LotsOperations { listByBillingAccount(billingAccountId: string, options?: LotsListByBillingAccountOptionalParams): PagedAsyncIterableIterator; listByBillingProfile(billingAccountId: string, billingProfileId: string, options?: LotsListByBillingProfileOptionalParams): PagedAsyncIterableIterator; + listByCustomer(billingAccountId: string, customerId: string, options?: LotsListByCustomerOptionalParams): PagedAsyncIterableIterator; } // @public @@ -883,13 +901,38 @@ export interface ModernReservationRecommendation extends ReservationRecommendati readonly normalizedSize?: string; readonly recommendedQuantity?: number; readonly recommendedQuantityNormalized?: number; - readonly scope?: string; + readonly resourceType?: string; + scope: string; readonly skuName?: string; readonly skuProperties?: SkuProperty[]; readonly term?: string; readonly totalCostWithReservedInstances?: Amount; } +// @public +export interface ModernReservationRecommendationProperties { + readonly costWithNoReservedInstances?: Amount; + readonly firstUsageDate?: Date; + readonly instanceFlexibilityGroup?: string; + readonly instanceFlexibilityRatio?: number; + readonly location?: string; + readonly lookBackPeriod?: number; + readonly meterId?: string; + readonly netSavings?: Amount; + readonly normalizedSize?: string; + readonly recommendedQuantity?: number; + readonly recommendedQuantityNormalized?: number; + readonly resourceType?: string; + scope: "Single" | "Shared"; + readonly skuName?: string; + readonly skuProperties?: SkuProperty[]; + readonly term?: string; + readonly totalCostWithReservedInstances?: Amount; +} + +// @public (undocumented) +export type ModernReservationRecommendationPropertiesUnion = ModernReservationRecommendationProperties | ModernSingleScopeReservationRecommendationProperties | ModernSharedScopeReservationRecommendationProperties; + // @public export interface ModernReservationTransaction extends ReservationTransactionResource { readonly amount?: number; @@ -920,6 +963,17 @@ export interface ModernReservationTransactionsListResult { readonly value?: ModernReservationTransaction[]; } +// @public +export interface ModernSharedScopeReservationRecommendationProperties extends ModernReservationRecommendationProperties { + scope: "Shared"; +} + +// @public +export interface ModernSingleScopeReservationRecommendationProperties extends ModernReservationRecommendationProperties { + scope: "Single"; + readonly subscriptionId?: string; +} + // @public export interface ModernUsageDetail extends UsageDetail { readonly additionalInfo?: string; @@ -1144,7 +1198,7 @@ export interface ReservationRecommendation extends Resource, ResourceAttributes // @public export interface ReservationRecommendationDetails { - get(scope: string, region: string, term: Term, lookBackPeriod: LookBackPeriod, product: string, options?: ReservationRecommendationDetailsGetOptionalParams): Promise; + get(resourceScope: string, scope: Scope, region: string, term: Term, lookBackPeriod: LookBackPeriod, product: string, options?: ReservationRecommendationDetailsGetOptionalParams): Promise; } // @public @@ -1211,7 +1265,7 @@ export type ReservationRecommendationKind = string; // @public export interface ReservationRecommendations { - list(scope: string, options?: ReservationRecommendationsListOptionalParams): PagedAsyncIterableIterator; + list(resourceScope: string, options?: ReservationRecommendationsListOptionalParams): PagedAsyncIterableIterator; } // @public @@ -1241,7 +1295,7 @@ export type ReservationRecommendationUnion = ReservationRecommendation | LegacyR // @public export interface ReservationsDetails { - list(scope: string, options?: ReservationsDetailsListOptionalParams): PagedAsyncIterableIterator; + list(resourceScope: string, options?: ReservationsDetailsListOptionalParams): PagedAsyncIterableIterator; listByReservationOrder(reservationOrderId: string, filter: string, options?: ReservationsDetailsListByReservationOrderOptionalParams): PagedAsyncIterableIterator; listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, filter: string, options?: ReservationsDetailsListByReservationOrderAndReservationOptionalParams): PagedAsyncIterableIterator; } @@ -1295,7 +1349,7 @@ export type ReservationsDetailsListResponse = ReservationDetailsListResult; // @public export interface ReservationsSummaries { - list(scope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams): PagedAsyncIterableIterator; + list(resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams): PagedAsyncIterableIterator; listByReservationOrder(reservationOrderId: string, grain: Datagrain, options?: ReservationsSummariesListByReservationOrderOptionalParams): PagedAsyncIterableIterator; listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, grain: Datagrain, options?: ReservationsSummariesListByReservationOrderAndReservationOptionalParams): PagedAsyncIterableIterator; } diff --git a/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts b/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts index 451072395676..8668f9b1500b 100644 --- a/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts +++ b/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts @@ -86,7 +86,7 @@ export class ConsumptionManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-consumption/9.2.1`; + const packageDetails = `azsdk-js-arm-consumption/10.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/consumption/arm-consumption/src/models/index.ts b/sdk/consumption/arm-consumption/src/models/index.ts index 50fb293eb139..22f295e8e3a1 100644 --- a/sdk/consumption/arm-consumption/src/models/index.ts +++ b/sdk/consumption/arm-consumption/src/models/index.ts @@ -12,18 +12,22 @@ export type LegacyReservationRecommendationPropertiesUnion = | LegacyReservationRecommendationProperties | LegacySingleScopeReservationRecommendationProperties | LegacySharedScopeReservationRecommendationProperties; +export type ModernReservationRecommendationPropertiesUnion = + | ModernReservationRecommendationProperties + | ModernSingleScopeReservationRecommendationProperties + | ModernSharedScopeReservationRecommendationProperties; export type UsageDetailUnion = | UsageDetail | LegacyUsageDetail | ModernUsageDetail; -export type ReservationRecommendationUnion = - | ReservationRecommendation - | LegacyReservationRecommendation - | ModernReservationRecommendation; export type ChargeSummaryUnion = | ChargeSummary | LegacyChargeSummary | ModernChargeSummary; +export type ReservationRecommendationUnion = + | ReservationRecommendation + | LegacyReservationRecommendation + | ModernReservationRecommendation; /** Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing period. */ export interface UsageDetailsListResult { @@ -136,8 +140,6 @@ export interface BudgetTimePeriod { export interface BudgetFilter { /** The logical "AND" expression. Must have at least 2 items. */ and?: BudgetFilterProperties[]; - /** The logical "NOT" expression. */ - not?: BudgetFilterProperties; /** Has comparison expression for a dimension */ dimensions?: BudgetComparisonExpression; /** Has comparison expression for a tag */ @@ -343,7 +345,7 @@ export interface ReservationRecommendationDetailsResourceProperties { */ readonly appliedScopes?: string[]; /** - * On demand rate of the resource. + * Hourly on-demand rate of the resource. Includes only hardware rate i.e, software rate is not included. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly onDemandRate?: number; @@ -358,7 +360,7 @@ export interface ReservationRecommendationDetailsResourceProperties { */ readonly region?: string; /** - * Reservation rate of the resource. + * Hourly reservation rate of the resource. Varies based on the term. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly reservationRate?: number; @@ -400,15 +402,15 @@ export interface ReservationRecommendationDetailsSavingsProperties { readonly unitOfMeasure?: string; } -/** Details of estimated savings. */ +/** Details of estimated savings. The costs and savings are estimated for the term. */ export interface ReservationRecommendationDetailsCalculatedSavingsProperties { /** - * The cost without reservation. + * The cost without reservation. Includes hardware and software cost. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly onDemandCost?: number; /** - * The difference between total reservation cost and reservation cost. + * Hardware and software cost of the resources not covered by the reservation. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly overageCost?: number; @@ -418,19 +420,19 @@ export interface ReservationRecommendationDetailsCalculatedSavingsProperties { */ readonly quantity?: number; /** - * The exact cost of the estimated usage using reservation. + * Hardware cost of the resources covered by the reservation. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly reservationCost?: number; /** - * The cost of the suggested quantity. + * Reservation cost + software cost of the resources covered by the reservation + overage cost. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly totalReservationCost?: number; /** The number of reserved units used to calculate savings. Always 1 for virtual machines. */ reservedUnitCount?: number; /** - * The amount saved by purchasing the recommended quantity of reservation. + * The amount saved by purchasing the recommended quantity of reservation. This is equal to onDemandCost - totalReservationCost. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly savings?: number; @@ -891,6 +893,92 @@ export interface SkuProperty { readonly value?: string; } +/** The properties of the reservation recommendation. */ +export interface ModernReservationRecommendationProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + scope: "Single" | "Shared"; + /** + * Resource Location. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly location?: string; + /** + * The number of days of usage to look back for recommendation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lookBackPeriod?: number; + /** + * The instance Flexibility Ratio. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly instanceFlexibilityRatio?: number; + /** + * The instance Flexibility Group. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly instanceFlexibilityGroup?: string; + /** + * The normalized Size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly normalizedSize?: string; + /** + * The recommended Quantity Normalized. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recommendedQuantityNormalized?: number; + /** + * The meter id (GUID) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly meterId?: string; + /** + * RI recommendations in one or three year terms. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly term?: string; + /** + * The total amount of cost without reserved instances. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly costWithNoReservedInstances?: Amount; + /** + * Recommended quality for reserved instances. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recommendedQuantity?: number; + /** + * Resource type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** + * The total amount of cost with reserved instances. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalCostWithReservedInstances?: Amount; + /** + * Total estimated savings with reserved instances. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly netSavings?: Amount; + /** + * The usage date for looking back. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly firstUsageDate?: Date; + /** + * List of sku properties + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly skuProperties?: SkuProperty[]; + /** + * This is the ARM Sku name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly skuName?: string; +} + /** The properties of the price sheet download. */ export interface DownloadProperties { /** @@ -1045,6 +1133,12 @@ export interface Marketplace extends Resource { readonly isRecurringCharge?: boolean; } +/** A charge summary resource. */ +export interface ChargeSummary extends Resource { + /** Specifies the kind of charge summary. */ + kind: ChargeSummaryKind; +} + /** A balance resource. */ export interface Balance extends Resource { /** @@ -1369,50 +1463,6 @@ export interface ManagementGroupAggregatedCostResult extends Resource { excludedSubscriptions?: string[]; } -/** A credit summary resource. */ -export interface CreditSummary extends Resource { - /** - * Summary of balances associated with this credit summary. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly balanceSummary?: CreditBalanceSummary; - /** - * Pending credit adjustments. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly pendingCreditAdjustments?: Amount; - /** - * Expired credit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiredCredit?: Amount; - /** - * Pending eligible charges. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly pendingEligibleCharges?: Amount; - /** - * The credit currency. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly creditCurrency?: string; - /** - * The billing currency. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly billingCurrency?: string; - /** - * Credit's reseller. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly reseller?: Reseller; - /** - * The eTag for the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly eTag?: string; -} - /** A budget resource. */ export interface Budget extends ProxyResource { /** The category of the budget, whether the budget tracks cost or usage. */ @@ -1455,12 +1505,6 @@ export interface TagsResult extends ProxyResource { readonly previousLink?: string; } -/** A charge summary resource. */ -export interface ChargeSummary extends ProxyResource { - /** Specifies the kind of charge summary. */ - kind: ChargeSummaryKind; -} - /** An event summary resource. */ export interface EventSummary extends ProxyResource { /** @@ -1651,6 +1695,50 @@ export interface LotSummary extends ProxyResource { readonly eTagPropertiesETag?: string; } +/** A credit summary resource. */ +export interface CreditSummary extends ProxyResource { + /** + * Summary of balances associated with this credit summary. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly balanceSummary?: CreditBalanceSummary; + /** + * Pending credit adjustments. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pendingCreditAdjustments?: Amount; + /** + * Expired credit. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiredCredit?: Amount; + /** + * Pending eligible charges. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pendingEligibleCharges?: Amount; + /** + * The credit currency. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creditCurrency?: string; + /** + * The billing currency. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingCurrency?: string; + /** + * Credit's reseller. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reseller?: Reseller; + /** + * The eTag for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly eTagPropertiesETag?: string; +} + /** Reservation transaction resource. */ export interface ReservationTransaction extends ReservationTransactionResource { /** @@ -1669,7 +1757,7 @@ export interface ReservationTransaction extends ReservationTransactionResource { */ readonly description?: string; /** - * The type of the transaction (Purchase, Cancel, etc.) + * The type of the transaction (Purchase, Cancel or Refund). * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly eventType?: string; @@ -1814,7 +1902,7 @@ export interface ModernReservationTransaction */ readonly eventDate?: Date; /** - * The type of the transaction (Purchase, Cancel, etc.) + * The type of the transaction (Purchase, Cancel or Refund). * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly eventType?: string; @@ -1908,6 +1996,25 @@ export interface LegacySharedScopeReservationRecommendationProperties scope: "Shared"; } +/** The properties of the modern reservation recommendation for single scope. */ +export interface ModernSingleScopeReservationRecommendationProperties + extends ModernReservationRecommendationProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + scope: "Single"; + /** + * Subscription ID associated with single scoped recommendation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subscriptionId?: string; +} + +/** The properties of the modern reservation recommendation for shared scope. */ +export interface ModernSharedScopeReservationRecommendationProperties + extends ModernReservationRecommendationProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + scope: "Shared"; +} + /** Legacy usage detail. */ export interface LegacyUsageDetail extends UsageDetail { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -2127,6 +2234,16 @@ export interface LegacyUsageDetail extends UsageDetail { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly payGPrice?: number; + /** + * Unique identifier for the applicable benefit. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly benefitId?: string; + /** + * Name of the applicable benefit. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly benefitName?: string; /** * Identifier that indicates how the meter is priced. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2500,100 +2617,118 @@ export interface ModernUsageDetail extends UsageDetail { readonly costAllocationRuleName?: string; } -/** Legacy reservation recommendation. */ -export interface LegacyReservationRecommendation - extends ReservationRecommendation { +/** Legacy charge summary. */ +export interface LegacyChargeSummary extends ChargeSummary { /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "legacy"; /** - * The number of days of usage to look back for recommendation. + * The id of the billing period resource that the charge belongs to. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly lookBackPeriod?: string; + readonly billingPeriodId?: string; /** - * The instance Flexibility Ratio. + * Usage start date. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly instanceFlexibilityRatio?: number; + readonly usageStart?: string; /** - * The instance Flexibility Group. + * Usage end date. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly instanceFlexibilityGroup?: string; + readonly usageEnd?: string; /** - * The normalized Size. + * Azure Charges. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly normalizedSize?: string; + readonly azureCharges?: number; /** - * The recommended Quantity Normalized. + * Charges Billed separately. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly recommendedQuantityNormalized?: number; + readonly chargesBilledSeparately?: number; /** - * The meter id (GUID) + * Marketplace Charges. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly meterId?: string; + readonly azureMarketplaceCharges?: number; /** - * The azure resource type. + * Currency Code * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly resourceType?: string; + readonly currency?: string; +} + +/** Modern charge summary. */ +export interface ModernChargeSummary extends ChargeSummary { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: "modern"; /** - * RI recommendations in one or three year terms. + * The id of the billing period resource that the charge belongs to. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly term?: string; + readonly billingPeriodId?: string; /** - * The total amount of cost without reserved instances. + * Usage start date. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly costWithNoReservedInstances?: number; + readonly usageStart?: string; /** - * Recommended quality for reserved instances. + * Usage end date. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly recommendedQuantity?: number; + readonly usageEnd?: string; /** - * The total amount of cost with reserved instances. + * Azure Charges. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly totalCostWithReservedInstances?: number; + readonly azureCharges?: Amount; /** - * Total estimated savings with reserved instances. + * Charges Billed separately. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly netSavings?: number; + readonly chargesBilledSeparately?: Amount; /** - * The usage date for looking back. + * Marketplace Charges. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly firstUsageDate?: Date; - /** Shared or single recommendation. */ - scope: string; + readonly marketplaceCharges?: Amount; /** - * List of sku properties + * Billing Account Id * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly skuProperties?: SkuProperty[]; + readonly billingAccountId?: string; + /** + * Billing Profile Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingProfileId?: string; + /** + * Invoice Section Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly invoiceSectionId?: string; + /** + * Customer Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly customerId?: string; + /** + * Is charge Invoiced + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isInvoiced?: boolean; } -/** Modern reservation recommendation. */ -export interface ModernReservationRecommendation +/** Legacy reservation recommendation. */ +export interface LegacyReservationRecommendation extends ReservationRecommendation { /** Polymorphic discriminator, which specifies the different types this object can be */ - kind: "modern"; - /** - * Resource Location. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly locationPropertiesLocation?: string; + kind: "legacy"; /** * The number of days of usage to look back for recommendation. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly lookBackPeriod?: number; + readonly lookBackPeriod?: string; /** * The instance Flexibility Ratio. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2619,6 +2754,11 @@ export interface ModernReservationRecommendation * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly meterId?: string; + /** + * The azure resource type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; /** * RI recommendations in one or three year terms. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2628,7 +2768,7 @@ export interface ModernReservationRecommendation * The total amount of cost without reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly costWithNoReservedInstances?: Amount; + readonly costWithNoReservedInstances?: number; /** * Recommended quality for reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2638,134 +2778,113 @@ export interface ModernReservationRecommendation * The total amount of cost with reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly totalCostWithReservedInstances?: Amount; + readonly totalCostWithReservedInstances?: number; /** * Total estimated savings with reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly netSavings?: Amount; + readonly netSavings?: number; /** * The usage date for looking back. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly firstUsageDate?: Date; - /** - * Shared or single recommendation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly scope?: string; + /** Shared or single recommendation. */ + scope: string; /** * List of sku properties * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly skuProperties?: SkuProperty[]; - /** - * This is the ARM Sku name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly skuName?: string; } -/** Legacy charge summary. */ -export interface LegacyChargeSummary extends ChargeSummary { +/** Modern reservation recommendation. */ +export interface ModernReservationRecommendation + extends ReservationRecommendation { /** Polymorphic discriminator, which specifies the different types this object can be */ - kind: "legacy"; - /** - * The id of the billing period resource that the charge belongs to. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly billingPeriodId?: string; - /** - * Usage start date. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageStart?: string; + kind: "modern"; /** - * Usage end date. + * Resource Location. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly usageEnd?: string; + readonly locationPropertiesLocation?: string; /** - * Azure Charges. + * The number of days of usage to look back for recommendation. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly azureCharges?: number; + readonly lookBackPeriod?: number; /** - * Charges Billed separately. + * The instance Flexibility Ratio. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly chargesBilledSeparately?: number; + readonly instanceFlexibilityRatio?: number; /** - * Marketplace Charges. + * The instance Flexibility Group. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly marketplaceCharges?: number; + readonly instanceFlexibilityGroup?: string; /** - * Currency Code + * The normalized Size. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly currency?: string; -} - -/** Modern charge summary. */ -export interface ModernChargeSummary extends ChargeSummary { - /** Polymorphic discriminator, which specifies the different types this object can be */ - kind: "modern"; + readonly normalizedSize?: string; /** - * The id of the billing period resource that the charge belongs to. + * The recommended Quantity Normalized. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly billingPeriodId?: string; + readonly recommendedQuantityNormalized?: number; /** - * Usage start date. + * The meter id (GUID) * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly usageStart?: string; + readonly meterId?: string; /** - * Usage end date. + * RI recommendations in one or three year terms. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly usageEnd?: string; + readonly term?: string; /** - * Azure Charges. + * The total amount of cost without reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly azureCharges?: Amount; + readonly costWithNoReservedInstances?: Amount; /** - * Charges Billed separately. + * Recommended quality for reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly chargesBilledSeparately?: Amount; + readonly recommendedQuantity?: number; /** - * Marketplace Charges. + * Resource type. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly marketplaceCharges?: Amount; + readonly resourceType?: string; /** - * Billing Account Id + * The total amount of cost with reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly billingAccountId?: string; + readonly totalCostWithReservedInstances?: Amount; /** - * Billing Profile Id + * Total estimated savings with reserved instances. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly billingProfileId?: string; + readonly netSavings?: Amount; /** - * Invoice Section Id + * The usage date for looking back. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly invoiceSectionId?: string; + readonly firstUsageDate?: Date; + /** Shared or single recommendation. */ + scope: string; /** - * Customer Id + * List of sku properties * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly customerId?: string; + readonly skuProperties?: SkuProperty[]; /** - * Is charge Invoiced + * This is the ARM Sku name. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly isInvoiced?: boolean; + readonly skuName?: string; } /** Legacy Reservation transaction resource. */ @@ -2872,11 +2991,11 @@ export type BudgetOperatorType = string; /** Known values of {@link OperatorType} that the service accepts. */ export enum KnownOperatorType { - /** EqualTo */ + /** Alert will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of your alert. This OperatorType will be deprecated in future. */ EqualTo = "EqualTo", - /** GreaterThan */ + /** Alert will be triggered if the evaluated cost is greater than the threshold value. Note: This is the recommended OperatorType while configuring Budget Alert. */ GreaterThan = "GreaterThan", - /** GreaterThanOrEqualTo */ + /** Alert will be triggered if the evaluated cost is greater than or equal to the threshold value. */ GreaterThanOrEqualTo = "GreaterThanOrEqualTo" } @@ -2885,17 +3004,17 @@ export enum KnownOperatorType { * {@link KnownOperatorType} can be used interchangeably with OperatorType, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **EqualTo** \ - * **GreaterThan** \ - * **GreaterThanOrEqualTo** + * **EqualTo**: Alert will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of your alert. This OperatorType will be deprecated in future. \ + * **GreaterThan**: Alert will be triggered if the evaluated cost is greater than the threshold value. Note: This is the recommended OperatorType while configuring Budget Alert. \ + * **GreaterThanOrEqualTo**: Alert will be triggered if the evaluated cost is greater than or equal to the threshold value. */ export type OperatorType = string; /** Known values of {@link ThresholdType} that the service accepts. */ export enum KnownThresholdType { - /** Actual */ + /** Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget . */ Actual = "Actual", - /** Forecasted */ + /** Forecasted costs budget alerts provide advanced notification that your spending trends are likely to exceed your allocated budget, as it relies on forecasted cost predictions. */ Forecasted = "Forecasted" } @@ -2904,8 +3023,8 @@ export enum KnownThresholdType { * {@link KnownThresholdType} can be used interchangeably with ThresholdType, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Actual** \ - * **Forecasted** + * **Actual**: Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget . \ + * **Forecasted**: Forecasted costs budget alerts provide advanced notification that your spending trends are likely to exceed your allocated budget, as it relies on forecasted cost predictions. */ export type ThresholdType = string; @@ -3059,6 +3178,24 @@ export enum KnownReservationRecommendationKind { */ export type ReservationRecommendationKind = string; +/** Known values of {@link Scope} that the service accepts. */ +export enum KnownScope { + /** Single */ + Single = "Single", + /** Shared */ + Shared = "Shared" +} + +/** + * Defines values for Scope. \ + * {@link KnownScope} can be used interchangeably with Scope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Single** \ + * **Shared** + */ +export type Scope = string; + /** Known values of {@link Term} that the service accepts. */ export enum KnownTerm { /** 1 year reservation term */ @@ -3113,7 +3250,9 @@ export enum KnownEventType { /** UnKnown */ UnKnown = "UnKnown", /** NewCredit */ - NewCredit = "NewCredit" + NewCredit = "NewCredit", + /** CreditExpired */ + CreditExpired = "CreditExpired" } /** @@ -3127,7 +3266,8 @@ export enum KnownEventType { * **PendingNewCredit** \ * **PendingExpiredCredit** \ * **UnKnown** \ - * **NewCredit** + * **NewCredit** \ + * **CreditExpired** */ export type EventType = string; @@ -3203,24 +3343,6 @@ export enum KnownPricingModelType { */ export type PricingModelType = string; -/** Known values of {@link Scope} that the service accepts. */ -export enum KnownScope { - /** Single */ - Single = "Single", - /** Shared */ - Shared = "Shared" -} - -/** - * Defines values for Scope. \ - * {@link KnownScope} can be used interchangeably with Scope, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Single** \ - * **Shared** - */ -export type Scope = string; - /** Optional parameters. */ export interface UsageDetailsListOptionalParams extends coreClient.OperationOptions { @@ -3472,7 +3594,7 @@ export type ReservationRecommendationDetailsGetResponse = ReservationRecommendat /** Optional parameters. */ export interface ReservationTransactionsListOptionalParams extends coreClient.OperationOptions { - /** Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports 'le' and 'ge' */ + /** Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports 'le' and 'ge'. Note: API returns data for the entire start date's and end date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29 will include data for the entire December 2020 month (i.e. will contain records for dates December 30 and 31) */ filter?: string; } @@ -3482,7 +3604,7 @@ export type ReservationTransactionsListResponse = ReservationTransactionsListRes /** Optional parameters. */ export interface ReservationTransactionsListByBillingProfileOptionalParams extends coreClient.OperationOptions { - /** Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports 'le' and 'ge' */ + /** Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports 'le' and 'ge'. Note: API returns data for the entire start date's and end date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29 will include data for entire December 2020 month (i.e. will contain records for dates December 30 and 31) */ filter?: string; } @@ -3610,6 +3732,16 @@ export interface LotsListByBillingAccountOptionalParams /** Contains response data for the listByBillingAccount operation. */ export type LotsListByBillingAccountResponse = Lots; +/** Optional parameters. */ +export interface LotsListByCustomerOptionalParams + extends coreClient.OperationOptions { + /** May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. Tag filter is a key value pair string where key and value is separated by a colon (:). */ + filter?: string; +} + +/** Contains response data for the listByCustomer operation. */ +export type LotsListByCustomerResponse = Lots; + /** Optional parameters. */ export interface LotsListByBillingProfileNextOptionalParams extends coreClient.OperationOptions {} @@ -3624,6 +3756,13 @@ export interface LotsListByBillingAccountNextOptionalParams /** Contains response data for the listByBillingAccountNext operation. */ export type LotsListByBillingAccountNextResponse = Lots; +/** Optional parameters. */ +export interface LotsListByCustomerNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCustomerNext operation. */ +export type LotsListByCustomerNextResponse = Lots; + /** Optional parameters. */ export interface CreditsGetOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/consumption/arm-consumption/src/models/mappers.ts b/sdk/consumption/arm-consumption/src/models/mappers.ts index bd98dc2dad1b..c3f5518f73e5 100644 --- a/sdk/consumption/arm-consumption/src/models/mappers.ts +++ b/sdk/consumption/arm-consumption/src/models/mappers.ts @@ -218,13 +218,6 @@ export const BudgetFilter: coreClient.CompositeMapper = { } } }, - not: { - serializedName: "not", - type: { - name: "Composite", - className: "BudgetFilterProperties" - } - }, dimensions: { serializedName: "dimensions", type: { @@ -1601,6 +1594,145 @@ export const SkuProperty: coreClient.CompositeMapper = { } }; +export const ModernReservationRecommendationProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ModernReservationRecommendationProperties", + uberParent: "ModernReservationRecommendationProperties", + polymorphicDiscriminator: { + serializedName: "scope", + clientName: "scope" + }, + modelProperties: { + location: { + serializedName: "location", + readOnly: true, + type: { + name: "String" + } + }, + lookBackPeriod: { + serializedName: "lookBackPeriod", + readOnly: true, + type: { + name: "Number" + } + }, + instanceFlexibilityRatio: { + serializedName: "instanceFlexibilityRatio", + readOnly: true, + type: { + name: "Number" + } + }, + instanceFlexibilityGroup: { + serializedName: "instanceFlexibilityGroup", + readOnly: true, + type: { + name: "String" + } + }, + normalizedSize: { + serializedName: "normalizedSize", + readOnly: true, + type: { + name: "String" + } + }, + recommendedQuantityNormalized: { + serializedName: "recommendedQuantityNormalized", + readOnly: true, + type: { + name: "Number" + } + }, + meterId: { + serializedName: "meterId", + readOnly: true, + type: { + name: "Uuid" + } + }, + term: { + serializedName: "term", + readOnly: true, + type: { + name: "String" + } + }, + costWithNoReservedInstances: { + serializedName: "costWithNoReservedInstances", + type: { + name: "Composite", + className: "Amount" + } + }, + recommendedQuantity: { + serializedName: "recommendedQuantity", + readOnly: true, + type: { + name: "Number" + } + }, + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + totalCostWithReservedInstances: { + serializedName: "totalCostWithReservedInstances", + type: { + name: "Composite", + className: "Amount" + } + }, + netSavings: { + serializedName: "netSavings", + type: { + name: "Composite", + className: "Amount" + } + }, + firstUsageDate: { + serializedName: "firstUsageDate", + readOnly: true, + type: { + name: "DateTime" + } + }, + scope: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + }, + skuProperties: { + serializedName: "skuProperties", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuProperty" + } + } + } + }, + skuName: { + serializedName: "skuName", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const DownloadProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1839,6 +1971,29 @@ export const Marketplace: coreClient.CompositeMapper = { } }; +export const ChargeSummary: coreClient.CompositeMapper = { + serializedName: "ChargeSummary", + type: { + name: "Composite", + className: "ChargeSummary", + uberParent: "Resource", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, + modelProperties: { + ...Resource.type.modelProperties, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String" + } + } + } + } +}; + export const Balance: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2385,72 +2540,6 @@ export const ManagementGroupAggregatedCostResult: coreClient.CompositeMapper = { } }; -export const CreditSummary: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CreditSummary", - modelProperties: { - ...Resource.type.modelProperties, - balanceSummary: { - serializedName: "properties.balanceSummary", - type: { - name: "Composite", - className: "CreditBalanceSummary" - } - }, - pendingCreditAdjustments: { - serializedName: "properties.pendingCreditAdjustments", - type: { - name: "Composite", - className: "Amount" - } - }, - expiredCredit: { - serializedName: "properties.expiredCredit", - type: { - name: "Composite", - className: "Amount" - } - }, - pendingEligibleCharges: { - serializedName: "properties.pendingEligibleCharges", - type: { - name: "Composite", - className: "Amount" - } - }, - creditCurrency: { - serializedName: "properties.creditCurrency", - readOnly: true, - type: { - name: "String" - } - }, - billingCurrency: { - serializedName: "properties.billingCurrency", - readOnly: true, - type: { - name: "String" - } - }, - reseller: { - serializedName: "properties.reseller", - type: { - name: "Composite", - className: "Reseller" - } - }, - eTag: { - serializedName: "properties.eTag", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - export const Budget: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2550,29 +2639,6 @@ export const TagsResult: coreClient.CompositeMapper = { } }; -export const ChargeSummary: coreClient.CompositeMapper = { - serializedName: "ChargeSummary", - type: { - name: "Composite", - className: "ChargeSummary", - uberParent: "ProxyResource", - polymorphicDiscriminator: { - serializedName: "kind", - clientName: "kind" - }, - modelProperties: { - ...ProxyResource.type.modelProperties, - kind: { - serializedName: "kind", - required: true, - type: { - name: "String" - } - } - } - } -}; - export const EventSummary: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2851,13 +2917,79 @@ export const LotSummary: coreClient.CompositeMapper = { } }; -export const ReservationTransaction: coreClient.CompositeMapper = { +export const CreditSummary: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationTransaction", + className: "CreditSummary", modelProperties: { - ...ReservationTransactionResource.type.modelProperties, - eventDate: { + ...ProxyResource.type.modelProperties, + balanceSummary: { + serializedName: "properties.balanceSummary", + type: { + name: "Composite", + className: "CreditBalanceSummary" + } + }, + pendingCreditAdjustments: { + serializedName: "properties.pendingCreditAdjustments", + type: { + name: "Composite", + className: "Amount" + } + }, + expiredCredit: { + serializedName: "properties.expiredCredit", + type: { + name: "Composite", + className: "Amount" + } + }, + pendingEligibleCharges: { + serializedName: "properties.pendingEligibleCharges", + type: { + name: "Composite", + className: "Amount" + } + }, + creditCurrency: { + serializedName: "properties.creditCurrency", + readOnly: true, + type: { + name: "String" + } + }, + billingCurrency: { + serializedName: "properties.billingCurrency", + readOnly: true, + type: { + name: "String" + } + }, + reseller: { + serializedName: "properties.reseller", + type: { + name: "Composite", + className: "Reseller" + } + }, + eTagPropertiesETag: { + serializedName: "properties.eTag", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ReservationTransaction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationTransaction", + modelProperties: { + ...ReservationTransactionResource.type.modelProperties, + eventDate: { serializedName: "properties.eventDate", readOnly: true, type: { @@ -3023,7 +3155,6 @@ export const ReservationTransaction: coreClient.CompositeMapper = { }; export const ModernReservationTransaction: coreClient.CompositeMapper = { - serializedName: "Modern", type: { name: "Composite", className: "ModernReservationTransaction", @@ -3232,6 +3363,41 @@ export const LegacySharedScopeReservationRecommendationProperties: coreClient.Co } }; +export const ModernSingleScopeReservationRecommendationProperties: coreClient.CompositeMapper = { + serializedName: "Single", + type: { + name: "Composite", + className: "ModernSingleScopeReservationRecommendationProperties", + uberParent: "ModernReservationRecommendationProperties", + polymorphicDiscriminator: + ModernReservationRecommendationProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ModernReservationRecommendationProperties.type.modelProperties, + subscriptionId: { + serializedName: "subscriptionId", + readOnly: true, + type: { + name: "Uuid" + } + } + } + } +}; + +export const ModernSharedScopeReservationRecommendationProperties: coreClient.CompositeMapper = { + serializedName: "Shared", + type: { + name: "Composite", + className: "ModernSharedScopeReservationRecommendationProperties", + uberParent: "ModernReservationRecommendationProperties", + polymorphicDiscriminator: + ModernReservationRecommendationProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ModernReservationRecommendationProperties.type.modelProperties + } + } +}; + export const LegacyUsageDetail: coreClient.CompositeMapper = { serializedName: "legacy", type: { @@ -3542,6 +3708,20 @@ export const LegacyUsageDetail: coreClient.CompositeMapper = { name: "Number" } }, + benefitId: { + serializedName: "properties.benefitId", + readOnly: true, + type: { + name: "String" + } + }, + benefitName: { + serializedName: "properties.benefitName", + readOnly: true, + type: { + name: "String" + } + }, pricingModel: { serializedName: "properties.pricingModel", readOnly: true, @@ -4070,153 +4250,173 @@ export const ModernUsageDetail: coreClient.CompositeMapper = { } }; -export const LegacyReservationRecommendation: coreClient.CompositeMapper = { +export const LegacyChargeSummary: coreClient.CompositeMapper = { serializedName: "legacy", type: { name: "Composite", - className: "LegacyReservationRecommendation", - uberParent: "ReservationRecommendation", - polymorphicDiscriminator: - ReservationRecommendation.type.polymorphicDiscriminator, + className: "LegacyChargeSummary", + uberParent: "ChargeSummary", + polymorphicDiscriminator: ChargeSummary.type.polymorphicDiscriminator, modelProperties: { - ...ReservationRecommendation.type.modelProperties, - lookBackPeriod: { - serializedName: "properties.lookBackPeriod", + ...ChargeSummary.type.modelProperties, + billingPeriodId: { + serializedName: "properties.billingPeriodId", readOnly: true, type: { name: "String" } }, - instanceFlexibilityRatio: { - serializedName: "properties.instanceFlexibilityRatio", + usageStart: { + serializedName: "properties.usageStart", readOnly: true, type: { - name: "Number" + name: "String" } }, - instanceFlexibilityGroup: { - serializedName: "properties.instanceFlexibilityGroup", + usageEnd: { + serializedName: "properties.usageEnd", readOnly: true, type: { name: "String" } }, - normalizedSize: { - serializedName: "properties.normalizedSize", + azureCharges: { + serializedName: "properties.azureCharges", readOnly: true, type: { - name: "String" + name: "Number" } }, - recommendedQuantityNormalized: { - serializedName: "properties.recommendedQuantityNormalized", + chargesBilledSeparately: { + serializedName: "properties.chargesBilledSeparately", readOnly: true, type: { name: "Number" } }, - meterId: { - serializedName: "properties.meterId", + azureMarketplaceCharges: { + serializedName: "properties.azureMarketplaceCharges", readOnly: true, type: { - name: "Uuid" + name: "Number" } }, - resourceType: { - serializedName: "properties.resourceType", + currency: { + serializedName: "properties.currency", readOnly: true, type: { name: "String" } - }, - term: { - serializedName: "properties.term", + } + } + } +}; + +export const ModernChargeSummary: coreClient.CompositeMapper = { + serializedName: "modern", + type: { + name: "Composite", + className: "ModernChargeSummary", + uberParent: "ChargeSummary", + polymorphicDiscriminator: ChargeSummary.type.polymorphicDiscriminator, + modelProperties: { + ...ChargeSummary.type.modelProperties, + billingPeriodId: { + serializedName: "properties.billingPeriodId", readOnly: true, type: { name: "String" } }, - costWithNoReservedInstances: { - serializedName: "properties.costWithNoReservedInstances", + usageStart: { + serializedName: "properties.usageStart", readOnly: true, type: { - name: "Number" + name: "String" } }, - recommendedQuantity: { - serializedName: "properties.recommendedQuantity", + usageEnd: { + serializedName: "properties.usageEnd", readOnly: true, type: { - name: "Number" + name: "String" } }, - totalCostWithReservedInstances: { - serializedName: "properties.totalCostWithReservedInstances", + azureCharges: { + serializedName: "properties.azureCharges", + type: { + name: "Composite", + className: "Amount" + } + }, + chargesBilledSeparately: { + serializedName: "properties.chargesBilledSeparately", + type: { + name: "Composite", + className: "Amount" + } + }, + marketplaceCharges: { + serializedName: "properties.marketplaceCharges", + type: { + name: "Composite", + className: "Amount" + } + }, + billingAccountId: { + serializedName: "properties.billingAccountId", readOnly: true, type: { - name: "Number" + name: "String" } }, - netSavings: { - serializedName: "properties.netSavings", + billingProfileId: { + serializedName: "properties.billingProfileId", readOnly: true, type: { - name: "Number" + name: "String" } }, - firstUsageDate: { - serializedName: "properties.firstUsageDate", + invoiceSectionId: { + serializedName: "properties.invoiceSectionId", readOnly: true, type: { - name: "DateTime" + name: "String" } }, - scope: { - serializedName: "properties.scope", - required: true, + customerId: { + serializedName: "properties.customerId", + readOnly: true, type: { name: "String" } }, - skuProperties: { - serializedName: "properties.skuProperties", + isInvoiced: { + serializedName: "properties.isInvoiced", readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SkuProperty" - } - } + name: "Boolean" } } } } }; -export const ModernReservationRecommendation: coreClient.CompositeMapper = { - serializedName: "modern", +export const LegacyReservationRecommendation: coreClient.CompositeMapper = { + serializedName: "legacy", type: { name: "Composite", - className: "ModernReservationRecommendation", + className: "LegacyReservationRecommendation", uberParent: "ReservationRecommendation", polymorphicDiscriminator: ReservationRecommendation.type.polymorphicDiscriminator, modelProperties: { ...ReservationRecommendation.type.modelProperties, - locationPropertiesLocation: { - serializedName: "properties.location", - readOnly: true, - type: { - name: "String" - } - }, lookBackPeriod: { serializedName: "properties.lookBackPeriod", readOnly: true, type: { - name: "Number" + name: "String" } }, instanceFlexibilityRatio: { @@ -4254,6 +4454,13 @@ export const ModernReservationRecommendation: coreClient.CompositeMapper = { name: "Uuid" } }, + resourceType: { + serializedName: "properties.resourceType", + readOnly: true, + type: { + name: "String" + } + }, term: { serializedName: "properties.term", readOnly: true, @@ -4263,9 +4470,9 @@ export const ModernReservationRecommendation: coreClient.CompositeMapper = { }, costWithNoReservedInstances: { serializedName: "properties.costWithNoReservedInstances", + readOnly: true, type: { - name: "Composite", - className: "Amount" + name: "Number" } }, recommendedQuantity: { @@ -4277,16 +4484,16 @@ export const ModernReservationRecommendation: coreClient.CompositeMapper = { }, totalCostWithReservedInstances: { serializedName: "properties.totalCostWithReservedInstances", + readOnly: true, type: { - name: "Composite", - className: "Amount" + name: "Number" } }, netSavings: { serializedName: "properties.netSavings", + readOnly: true, type: { - name: "Composite", - className: "Amount" + name: "Number" } }, firstUsageDate: { @@ -4298,7 +4505,7 @@ export const ModernReservationRecommendation: coreClient.CompositeMapper = { }, scope: { serializedName: "properties.scope", - readOnly: true, + required: true, type: { name: "String" } @@ -4315,165 +4522,145 @@ export const ModernReservationRecommendation: coreClient.CompositeMapper = { } } } - }, - skuName: { - serializedName: "properties.skuName", - readOnly: true, - type: { - name: "String" - } } } } }; -export const LegacyChargeSummary: coreClient.CompositeMapper = { - serializedName: "legacy", +export const ModernReservationRecommendation: coreClient.CompositeMapper = { + serializedName: "modern", type: { name: "Composite", - className: "LegacyChargeSummary", - uberParent: "ChargeSummary", - polymorphicDiscriminator: ChargeSummary.type.polymorphicDiscriminator, + className: "ModernReservationRecommendation", + uberParent: "ReservationRecommendation", + polymorphicDiscriminator: + ReservationRecommendation.type.polymorphicDiscriminator, modelProperties: { - ...ChargeSummary.type.modelProperties, - billingPeriodId: { - serializedName: "properties.billingPeriodId", + ...ReservationRecommendation.type.modelProperties, + locationPropertiesLocation: { + serializedName: "properties.location", readOnly: true, type: { name: "String" } }, - usageStart: { - serializedName: "properties.usageStart", + lookBackPeriod: { + serializedName: "properties.lookBackPeriod", readOnly: true, type: { - name: "String" + name: "Number" } }, - usageEnd: { - serializedName: "properties.usageEnd", + instanceFlexibilityRatio: { + serializedName: "properties.instanceFlexibilityRatio", readOnly: true, type: { - name: "String" + name: "Number" } }, - azureCharges: { - serializedName: "properties.azureCharges", + instanceFlexibilityGroup: { + serializedName: "properties.instanceFlexibilityGroup", readOnly: true, type: { - name: "Number" + name: "String" } }, - chargesBilledSeparately: { - serializedName: "properties.chargesBilledSeparately", + normalizedSize: { + serializedName: "properties.normalizedSize", readOnly: true, type: { - name: "Number" + name: "String" } }, - marketplaceCharges: { - serializedName: "properties.marketplaceCharges", + recommendedQuantityNormalized: { + serializedName: "properties.recommendedQuantityNormalized", readOnly: true, type: { name: "Number" } }, - currency: { - serializedName: "properties.currency", + meterId: { + serializedName: "properties.meterId", readOnly: true, type: { - name: "String" + name: "Uuid" } - } - } - } -}; - -export const ModernChargeSummary: coreClient.CompositeMapper = { - serializedName: "modern", - type: { - name: "Composite", - className: "ModernChargeSummary", - uberParent: "ChargeSummary", - polymorphicDiscriminator: ChargeSummary.type.polymorphicDiscriminator, - modelProperties: { - ...ChargeSummary.type.modelProperties, - billingPeriodId: { - serializedName: "properties.billingPeriodId", + }, + term: { + serializedName: "properties.term", readOnly: true, type: { name: "String" } }, - usageStart: { - serializedName: "properties.usageStart", - readOnly: true, + costWithNoReservedInstances: { + serializedName: "properties.costWithNoReservedInstances", type: { - name: "String" + name: "Composite", + className: "Amount" } }, - usageEnd: { - serializedName: "properties.usageEnd", + recommendedQuantity: { + serializedName: "properties.recommendedQuantity", readOnly: true, type: { - name: "String" + name: "Number" } }, - azureCharges: { - serializedName: "properties.azureCharges", + resourceType: { + serializedName: "properties.resourceType", + readOnly: true, type: { - name: "Composite", - className: "Amount" + name: "String" } }, - chargesBilledSeparately: { - serializedName: "properties.chargesBilledSeparately", + totalCostWithReservedInstances: { + serializedName: "properties.totalCostWithReservedInstances", type: { name: "Composite", className: "Amount" } }, - marketplaceCharges: { - serializedName: "properties.marketplaceCharges", + netSavings: { + serializedName: "properties.netSavings", type: { name: "Composite", className: "Amount" } }, - billingAccountId: { - serializedName: "properties.billingAccountId", + firstUsageDate: { + serializedName: "properties.firstUsageDate", readOnly: true, type: { - name: "String" + name: "DateTime" } }, - billingProfileId: { - serializedName: "properties.billingProfileId", - readOnly: true, + scope: { + serializedName: "properties.scope", + required: true, type: { name: "String" } }, - invoiceSectionId: { - serializedName: "properties.invoiceSectionId", + skuProperties: { + serializedName: "properties.skuProperties", readOnly: true, type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuProperty" + } + } } }, - customerId: { - serializedName: "properties.customerId", + skuName: { + serializedName: "properties.skuName", readOnly: true, type: { name: "String" } - }, - isInvoiced: { - serializedName: "properties.isInvoiced", - readOnly: true, - type: { - name: "Boolean" - } } } } @@ -4491,15 +4678,18 @@ export const LegacyReservationTransaction: coreClient.CompositeMapper = { export let discriminators = { LegacyReservationRecommendationProperties: LegacyReservationRecommendationProperties, + ModernReservationRecommendationProperties: ModernReservationRecommendationProperties, "Resource.UsageDetail": UsageDetail, + "Resource.ChargeSummary": ChargeSummary, "Resource.ReservationRecommendation": ReservationRecommendation, - "ProxyResource.ChargeSummary": ChargeSummary, "LegacyReservationRecommendationProperties.Single": LegacySingleScopeReservationRecommendationProperties, "LegacyReservationRecommendationProperties.Shared": LegacySharedScopeReservationRecommendationProperties, + "ModernReservationRecommendationProperties.Single": ModernSingleScopeReservationRecommendationProperties, + "ModernReservationRecommendationProperties.Shared": ModernSharedScopeReservationRecommendationProperties, "UsageDetail.legacy": LegacyUsageDetail, "UsageDetail.modern": ModernUsageDetail, - "ReservationRecommendation.legacy": LegacyReservationRecommendation, - "ReservationRecommendation.modern": ModernReservationRecommendation, "ChargeSummary.legacy": LegacyChargeSummary, - "ChargeSummary.modern": ModernChargeSummary + "ChargeSummary.modern": ModernChargeSummary, + "ReservationRecommendation.legacy": LegacyReservationRecommendation, + "ReservationRecommendation.modern": ModernReservationRecommendation }; diff --git a/sdk/consumption/arm-consumption/src/models/parameters.ts b/sdk/consumption/arm-consumption/src/models/parameters.ts index d3cccb1067c2..62d6743b26f3 100644 --- a/sdk/consumption/arm-consumption/src/models/parameters.ts +++ b/sdk/consumption/arm-consumption/src/models/parameters.ts @@ -240,6 +240,18 @@ export const reservationId: OperationURLParameter = { } }; +export const resourceScope: OperationURLParameter = { + parameterPath: "resourceScope", + mapper: { + serializedName: "resourceScope", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + export const reservationId1: OperationQueryParameter = { parameterPath: ["options", "reservationId"], mapper: { @@ -271,6 +283,17 @@ export const filter1: OperationQueryParameter = { } }; +export const scope1: OperationQueryParameter = { + parameterPath: "scope", + mapper: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + } +}; + export const region: OperationQueryParameter = { parameterPath: "region", mapper: { @@ -369,3 +392,14 @@ export const endDate1: OperationQueryParameter = { } } }; + +export const customerId: OperationURLParameter = { + parameterPath: "customerId", + mapper: { + serializedName: "customerId", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts b/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts index c26514278ceb..90e5064714ed 100644 --- a/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts +++ b/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts @@ -21,8 +21,12 @@ import { LotsListByBillingAccountNextOptionalParams, LotsListByBillingAccountOptionalParams, LotsListByBillingAccountResponse, + LotsListByCustomerNextOptionalParams, + LotsListByCustomerOptionalParams, + LotsListByCustomerResponse, LotsListByBillingProfileNextResponse, - LotsListByBillingAccountNextResponse + LotsListByBillingAccountNextResponse, + LotsListByCustomerNextResponse } from "../models"; /// @@ -39,9 +43,8 @@ export class LotsOperationsImpl implements LotsOperations { } /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Azure credits for a billing account or a billing profile. The API is only supported for + * Microsoft Customer Agreements (MCA) billing accounts. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. @@ -125,9 +128,8 @@ export class LotsOperationsImpl implements LotsOperations { } /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Microsoft Azure consumption commitments for a billing account. The API is only supported + * for Microsoft Customer Agreements (MCA) and Direct Enterprise Agreement (EA) billing accounts. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -196,9 +198,93 @@ export class LotsOperationsImpl implements LotsOperations { } /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements + * (MPA) billing accounts. + * @param billingAccountId BillingAccount ID + * @param customerId Customer ID + * @param options The options parameters. + */ + public listByCustomer( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCustomerPagingAll( + billingAccountId, + customerId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByCustomerPagingPage( + billingAccountId, + customerId, + options, + settings + ); + } + }; + } + + private async *listByCustomerPagingPage( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: LotsListByCustomerResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByCustomer( + billingAccountId, + customerId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByCustomerNext( + billingAccountId, + customerId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByCustomerPagingAll( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCustomerPagingPage( + billingAccountId, + customerId, + options + )) { + yield* page; + } + } + + /** + * Lists all Azure credits for a billing account or a billing profile. The API is only supported for + * Microsoft Customer Agreements (MCA) billing accounts. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. @@ -215,9 +301,8 @@ export class LotsOperationsImpl implements LotsOperations { } /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Microsoft Azure consumption commitments for a billing account. The API is only supported + * for Microsoft Customer Agreements (MCA) and Direct Enterprise Agreement (EA) billing accounts. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -231,6 +316,24 @@ export class LotsOperationsImpl implements LotsOperations { ); } + /** + * Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements + * (MPA) billing accounts. + * @param billingAccountId BillingAccount ID + * @param customerId Customer ID + * @param options The options parameters. + */ + private _listByCustomer( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { billingAccountId, customerId, options }, + listByCustomerOperationSpec + ); + } + /** * ListByBillingProfileNext * @param billingAccountId BillingAccount ID @@ -266,6 +369,25 @@ export class LotsOperationsImpl implements LotsOperations { listByBillingAccountNextOperationSpec ); } + + /** + * ListByCustomerNext + * @param billingAccountId BillingAccount ID + * @param customerId Customer ID + * @param nextLink The nextLink from the previous successful call to the ListByCustomer method. + * @param options The options parameters. + */ + private _listByCustomerNext( + billingAccountId: string, + customerId: string, + nextLink: string, + options?: LotsListByCustomerNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { billingAccountId, customerId, nextLink, options }, + listByCustomerNextOperationSpec + ); + } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); @@ -308,6 +430,27 @@ const listByBillingAccountOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listByCustomerOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}/providers/Microsoft.Consumption/lots", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Lots + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.filter, Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.billingAccountId, + Parameters.customerId + ], + headerParameters: [Parameters.accept], + serializer +}; const listByBillingProfileNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", @@ -347,3 +490,23 @@ const listByBillingAccountNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listByCustomerNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Lots + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.billingAccountId, + Parameters.customerId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/consumption/arm-consumption/src/operations/marketplaces.ts b/sdk/consumption/arm-consumption/src/operations/marketplaces.ts index 6f7daa62be12..6708321baa60 100644 --- a/sdk/consumption/arm-consumption/src/operations/marketplaces.ts +++ b/sdk/consumption/arm-consumption/src/operations/marketplaces.ts @@ -166,6 +166,7 @@ const listOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.MarketplacesListResult }, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } @@ -187,6 +188,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.MarketplacesListResult }, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } diff --git a/sdk/consumption/arm-consumption/src/operations/reservationRecommendationDetails.ts b/sdk/consumption/arm-consumption/src/operations/reservationRecommendationDetails.ts index c3bf7a979b7b..504c909de02f 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationRecommendationDetails.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationRecommendationDetails.ts @@ -12,6 +12,7 @@ import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { ConsumptionManagementClient } from "../consumptionManagementClient"; import { + Scope, Term, LookBackPeriod, ReservationRecommendationDetailsGetOptionalParams, @@ -33,12 +34,13 @@ export class ReservationRecommendationDetailsImpl /** * Details of a reservation recommendation for what-if analysis of reserved instances. - * @param scope The scope associated with reservation recommendation details operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendation details operations. This + * includes '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope + * @param scope Scope of the reservation. * @param region Used to select the region the recommendation should be generated for. * @param term Specify length of reservation recommendation term. * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. @@ -47,7 +49,8 @@ export class ReservationRecommendationDetailsImpl * @param options The options parameters. */ get( - scope: string, + resourceScope: string, + scope: Scope, region: string, term: Term, lookBackPeriod: LookBackPeriod, @@ -55,7 +58,7 @@ export class ReservationRecommendationDetailsImpl options?: ReservationRecommendationDetailsGetOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, region, term, lookBackPeriod, product, options }, + { resourceScope, scope, region, term, lookBackPeriod, product, options }, getOperationSpec ); } @@ -65,7 +68,7 @@ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const getOperationSpec: coreClient.OperationSpec = { path: - "/{scope}/providers/Microsoft.Consumption/reservationRecommendationDetails", + "/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails", httpMethod: "GET", responses: { 200: { @@ -78,12 +81,13 @@ const getOperationSpec: coreClient.OperationSpec = { }, queryParameters: [ Parameters.apiVersion, + Parameters.scope1, Parameters.region, Parameters.term, Parameters.lookBackPeriod, Parameters.product ], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts b/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts index c037c1e9b67d..ec7abf3ce7ee 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts @@ -37,19 +37,19 @@ export class ReservationRecommendationsImpl /** * List of recommendations for purchasing reserved instances. - * @param scope The scope associated with reservation recommendations operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope * @param options The options parameters. */ public list( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(scope, options); + const iter = this.listPagingAll(resourceScope, options); return { next() { return iter.next(); @@ -61,27 +61,27 @@ export class ReservationRecommendationsImpl if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } - return this.listPagingPage(scope, options, settings); + return this.listPagingPage(resourceScope, options, settings); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams, settings?: PageSettings ): AsyncIterableIterator { let result: ReservationRecommendationsListResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { - result = await this._list(scope, options); + result = await this._list(resourceScope, options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { - result = await this._listNext(scope, continuationToken, options); + result = await this._listNext(resourceScope, continuationToken, options); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); @@ -90,52 +90,52 @@ export class ReservationRecommendationsImpl } private async *listPagingAll( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams ): AsyncIterableIterator { - for await (const page of this.listPagingPage(scope, options)) { + for await (const page of this.listPagingPage(resourceScope, options)) { yield* page; } } /** * List of recommendations for purchasing reserved instances. - * @param scope The scope associated with reservation recommendations operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope * @param options The options parameters. */ private _list( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, options }, + { resourceScope, options }, listOperationSpec ); } /** * ListNext - * @param scope The scope associated with reservation recommendations operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ private _listNext( - scope: string, + resourceScope: string, nextLink: string, options?: ReservationRecommendationsListNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, nextLink, options }, + { resourceScope, nextLink, options }, listNextOperationSpec ); } @@ -144,7 +144,8 @@ export class ReservationRecommendationsImpl const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.Consumption/reservationRecommendations", + path: + "/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations", httpMethod: "GET", responses: { 200: { @@ -156,7 +157,7 @@ const listOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [Parameters.filter, Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -172,7 +173,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceScope + ], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/consumption/arm-consumption/src/operations/reservationTransactions.ts b/sdk/consumption/arm-consumption/src/operations/reservationTransactions.ts index 4eaf6125af4d..b0518eedd411 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationTransactions.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationTransactions.ts @@ -40,7 +40,10 @@ export class ReservationTransactionsImpl implements ReservationTransactions { } /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing account scope. Note: The refund transactions + * are posted along with its purchase transaction (i.e. in the purchase billing month). For example, + * The refund is requested in May 2021. This refund transaction will have event date as May 2021 but + * the billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -102,7 +105,10 @@ export class ReservationTransactionsImpl implements ReservationTransactions { } /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing profile scope. The refund transactions are + * posted along with its purchase transaction (i.e. in the purchase billing month). For example, The + * refund is requested in May 2021. This refund transaction will have event date as May 2021 but the + * billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. @@ -186,7 +192,10 @@ export class ReservationTransactionsImpl implements ReservationTransactions { } /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing account scope. Note: The refund transactions + * are posted along with its purchase transaction (i.e. in the purchase billing month). For example, + * The refund is requested in May 2021. This refund transaction will have event date as May 2021 but + * the billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -201,7 +210,10 @@ export class ReservationTransactionsImpl implements ReservationTransactions { } /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing profile scope. The refund transactions are + * posted along with its purchase transaction (i.e. in the purchase billing month). For example, The + * refund is requested in May 2021. This refund transaction will have event date as May 2021 but the + * billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. diff --git a/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts b/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts index 60a5ff3c0114..b3aba1baad35 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts @@ -43,7 +43,9 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and * end date. The filter supports 'le' and 'ge' @@ -127,7 +129,9 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and @@ -220,19 +224,21 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } /** - * Lists the reservations details for the defined scope and provided date range. - * @param scope The scope associated with reservations details operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * Lists the reservations details for the defined scope and provided date range. Note: ARM has a + * payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM + * limit. In such cases, API call should be made with smaller date ranges. + * @param resourceScope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param options The options parameters. */ public list( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(scope, options); + const iter = this.listPagingAll(resourceScope, options); return { next() { return iter.next(); @@ -244,27 +250,27 @@ export class ReservationsDetailsImpl implements ReservationsDetails { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } - return this.listPagingPage(scope, options, settings); + return this.listPagingPage(resourceScope, options, settings); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams, settings?: PageSettings ): AsyncIterableIterator { let result: ReservationsDetailsListResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { - result = await this._list(scope, options); + result = await this._list(resourceScope, options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { - result = await this._listNext(scope, continuationToken, options); + result = await this._listNext(resourceScope, continuationToken, options); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); @@ -273,16 +279,18 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } private async *listPagingAll( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams ): AsyncIterableIterator { - for await (const page of this.listPagingPage(scope, options)) { + for await (const page of this.listPagingPage(resourceScope, options)) { yield* page; } } /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and * end date. The filter supports 'le' and 'ge' @@ -300,7 +308,9 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and @@ -320,20 +330,22 @@ export class ReservationsDetailsImpl implements ReservationsDetails { } /** - * Lists the reservations details for the defined scope and provided date range. - * @param scope The scope associated with reservations details operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * Lists the reservations details for the defined scope and provided date range. Note: ARM has a + * payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM + * limit. In such cases, API call should be made with smaller date ranges. + * @param resourceScope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param options The options parameters. */ private _list( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, options }, + { resourceScope, options }, listOperationSpec ); } @@ -379,21 +391,21 @@ export class ReservationsDetailsImpl implements ReservationsDetails { /** * ListNext - * @param scope The scope associated with reservations details operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * @param resourceScope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ private _listNext( - scope: string, + resourceScope: string, nextLink: string, options?: ReservationsDetailsListNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, nextLink, options }, + { resourceScope, nextLink, options }, listNextOperationSpec ); } @@ -440,7 +452,7 @@ const listByReservationOrderAndReservationOperationSpec: coreClient.OperationSpe serializer }; const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.Consumption/reservationDetails", + path: "/{resourceScope}/providers/Microsoft.Consumption/reservationDetails", httpMethod: "GET", responses: { 200: { @@ -458,7 +470,7 @@ const listOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -512,7 +524,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceScope + ], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts b/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts index 3b492dbfd1d7..167fd9e4c7c9 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts @@ -220,20 +220,20 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { /** * Lists the reservations summaries for the defined scope daily or monthly grain. - * @param scope The scope associated with reservations summaries operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * @param resourceScope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param grain Can be daily or monthly * @param options The options parameters. */ public list( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(scope, grain, options); + const iter = this.listPagingAll(resourceScope, grain, options); return { next() { return iter.next(); @@ -245,13 +245,13 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } - return this.listPagingPage(scope, grain, options, settings); + return this.listPagingPage(resourceScope, grain, options, settings); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams, settings?: PageSettings @@ -259,14 +259,14 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { let result: ReservationsSummariesListResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { - result = await this._list(scope, grain, options); + result = await this._list(resourceScope, grain, options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { - result = await this._listNext(scope, continuationToken, options); + result = await this._listNext(resourceScope, continuationToken, options); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); @@ -275,11 +275,15 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { } private async *listPagingAll( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams ): AsyncIterableIterator { - for await (const page of this.listPagingPage(scope, grain, options)) { + for await (const page of this.listPagingPage( + resourceScope, + grain, + options + )) { yield* page; } } @@ -324,21 +328,21 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { /** * Lists the reservations summaries for the defined scope daily or monthly grain. - * @param scope The scope associated with reservations summaries operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * @param resourceScope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param grain Can be daily or monthly * @param options The options parameters. */ private _list( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, grain, options }, + { resourceScope, grain, options }, listOperationSpec ); } @@ -384,21 +388,21 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { /** * ListNext - * @param scope The scope associated with reservations summaries operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * @param resourceScope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ private _listNext( - scope: string, + resourceScope: string, nextLink: string, options?: ReservationsSummariesListNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, nextLink, options }, + { resourceScope, nextLink, options }, listNextOperationSpec ); } @@ -445,7 +449,7 @@ const listByReservationOrderAndReservationOperationSpec: coreClient.OperationSpe serializer }; const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.Consumption/reservationSummaries", + path: "/{resourceScope}/providers/Microsoft.Consumption/reservationSummaries", httpMethod: "GET", responses: { 200: { @@ -464,7 +468,7 @@ const listOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -518,7 +522,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceScope + ], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/consumption/arm-consumption/src/operations/usageDetails.ts b/sdk/consumption/arm-consumption/src/operations/usageDetails.ts index 3c118200ad97..65ee85aab717 100644 --- a/sdk/consumption/arm-consumption/src/operations/usageDetails.ts +++ b/sdk/consumption/arm-consumption/src/operations/usageDetails.ts @@ -190,6 +190,7 @@ const listOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.UsageDetailsListResult }, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } @@ -213,6 +214,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.UsageDetailsListResult }, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/lotsOperations.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/lotsOperations.ts index cee7524cb172..3be08764527e 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/lotsOperations.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/lotsOperations.ts @@ -10,16 +10,16 @@ import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { LotSummary, LotsListByBillingProfileOptionalParams, - LotsListByBillingAccountOptionalParams + LotsListByBillingAccountOptionalParams, + LotsListByCustomerOptionalParams } from "../models"; /// /** Interface representing a LotsOperations. */ export interface LotsOperations { /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Azure credits for a billing account or a billing profile. The API is only supported for + * Microsoft Customer Agreements (MCA) billing accounts. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. @@ -30,9 +30,8 @@ export interface LotsOperations { options?: LotsListByBillingProfileOptionalParams ): PagedAsyncIterableIterator; /** - * Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a - * billing profile. Microsoft Azure consumption commitments are only supported for the billing account - * scope. + * Lists all Microsoft Azure consumption commitments for a billing account. The API is only supported + * for Microsoft Customer Agreements (MCA) and Direct Enterprise Agreement (EA) billing accounts. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -40,4 +39,16 @@ export interface LotsOperations { billingAccountId: string, options?: LotsListByBillingAccountOptionalParams ): PagedAsyncIterableIterator; + /** + * Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements + * (MPA) billing accounts. + * @param billingAccountId BillingAccount ID + * @param customerId Customer ID + * @param options The options parameters. + */ + listByCustomer( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams + ): PagedAsyncIterableIterator; } diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendationDetails.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendationDetails.ts index 563830545ff9..5733c252df79 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendationDetails.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendationDetails.ts @@ -7,6 +7,7 @@ */ import { + Scope, Term, LookBackPeriod, ReservationRecommendationDetailsGetOptionalParams, @@ -17,12 +18,13 @@ import { export interface ReservationRecommendationDetails { /** * Details of a reservation recommendation for what-if analysis of reserved instances. - * @param scope The scope associated with reservation recommendation details operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendation details operations. This + * includes '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope + * @param scope Scope of the reservation. * @param region Used to select the region the recommendation should be generated for. * @param term Specify length of reservation recommendation term. * @param lookBackPeriod Filter the time period on which reservation recommendation results are based. @@ -31,7 +33,8 @@ export interface ReservationRecommendationDetails { * @param options The options parameters. */ get( - scope: string, + resourceScope: string, + scope: Scope, region: string, term: Term, lookBackPeriod: LookBackPeriod, diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendations.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendations.ts index e4df3b2a4d35..826ea6fcc729 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendations.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationRecommendations.ts @@ -17,16 +17,16 @@ import { export interface ReservationRecommendations { /** * List of recommendations for purchasing reserved instances. - * @param scope The scope associated with reservation recommendations operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billingProfile scope + * @param resourceScope The scope associated with reservation recommendations operations. This includes + * '/subscriptions/{subscriptionId}/' for subscription scope, + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for billingProfile scope * @param options The options parameters. */ list( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams ): PagedAsyncIterableIterator; } diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationTransactions.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationTransactions.ts index bc3dd77c5727..482594557f75 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationTransactions.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationTransactions.ts @@ -18,7 +18,10 @@ import { /** Interface representing a ReservationTransactions. */ export interface ReservationTransactions { /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing account scope. Note: The refund transactions + * are posted along with its purchase transaction (i.e. in the purchase billing month). For example, + * The refund is requested in May 2021. This refund transaction will have event date as May 2021 but + * the billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ @@ -27,7 +30,10 @@ export interface ReservationTransactions { options?: ReservationTransactionsListOptionalParams ): PagedAsyncIterableIterator; /** - * List of transactions for reserved instances on billing account scope + * List of transactions for reserved instances on billing profile scope. The refund transactions are + * posted along with its purchase transaction (i.e. in the purchase billing month). For example, The + * refund is requested in May 2021. This refund transaction will have event date as May 2021 but the + * billing month as April 2020 when the reservation purchase was made. * @param billingAccountId BillingAccount ID * @param billingProfileId Azure Billing Profile ID. * @param options The options parameters. diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts index 771aedbfc513..e1295f1f79eb 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts @@ -18,7 +18,9 @@ import { /** Interface representing a ReservationsDetails. */ export interface ReservationsDetails { /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and * end date. The filter supports 'le' and 'ge' @@ -30,7 +32,9 @@ export interface ReservationsDetails { options?: ReservationsDetailsListByReservationOrderOptionalParams ): PagedAsyncIterableIterator; /** - * Lists the reservations details for provided date range. + * Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, + * so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call + * should be made with smaller date ranges. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the reservation * @param filter Filter reservation details by date range. The properties/UsageDate for start date and @@ -44,16 +48,18 @@ export interface ReservationsDetails { options?: ReservationsDetailsListByReservationOrderAndReservationOptionalParams ): PagedAsyncIterableIterator; /** - * Lists the reservations details for the defined scope and provided date range. - * @param scope The scope associated with reservations details operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * Lists the reservations details for the defined scope and provided date range. Note: ARM has a + * payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM + * limit. In such cases, API call should be made with smaller date ranges. + * @param resourceScope The scope associated with reservations details operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param options The options parameters. */ list( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams ): PagedAsyncIterableIterator; } diff --git a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsSummaries.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsSummaries.ts index 935d9eeaef13..2870f5366039 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsSummaries.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsSummaries.ts @@ -44,16 +44,16 @@ export interface ReservationsSummaries { ): PagedAsyncIterableIterator; /** * Lists the reservations summaries for the defined scope daily or monthly grain. - * @param scope The scope associated with reservations summaries operations. This includes - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), - * and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for BillingProfile scope (modern). + * @param resourceScope The scope associated with reservations summaries operations. This includes + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), + * and + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + * for BillingProfile scope (modern). * @param grain Can be daily or monthly * @param options The options parameters. */ list( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams ): PagedAsyncIterableIterator; diff --git a/sdk/consumption/arm-consumption/test/sampleTest.ts b/sdk/consumption/arm-consumption/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/consumption/arm-consumption/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/consumption/arm-consumption/tsconfig.json b/sdk/consumption/arm-consumption/tsconfig.json index 6e8ad365181f..3e6ae96443f3 100644 --- a/sdk/consumption/arm-consumption/tsconfig.json +++ b/sdk/consumption/arm-consumption/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-consumption": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"