diff --git a/sdk/consumption/arm-consumption/CHANGELOG.md b/sdk/consumption/arm-consumption/CHANGELOG.md index 523754a9f6d8..73dcc1ba0dd9 100644 --- a/sdk/consumption/arm-consumption/CHANGELOG.md +++ b/sdk/consumption/arm-consumption/CHANGELOG.md @@ -1,15 +1,23 @@ # Release History - -## 9.0.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 10.0.0 (2022-06-23) + +**Features** + + - Added operation LotsOperations.listByCustomer + - Added Interface LotsListByCustomerNextOptionalParams + - Added Interface LotsListByCustomerOptionalParams + - Added Type Alias LotsListByCustomerNextResponse + - Added Type Alias LotsListByCustomerResponse + - Type Alias LegacyUsageDetail has a new parameter benefitId + - Type Alias LegacyUsageDetail has a new parameter benefitName + - Enum KnownEventType has a new value CreditExpired + +**Breaking Changes** + + - Operation ReservationRecommendationDetails.get has a new signature + - Interface BudgetFilter no longer has parameter not + ## 9.0.1 (2022-04-11) **features** diff --git a/sdk/consumption/arm-consumption/_meta.json b/sdk/consumption/arm-consumption/_meta.json index 422d27075fcf..599febf128de 100644 --- a/sdk/consumption/arm-consumption/_meta.json +++ b/sdk/consumption/arm-consumption/_meta.json @@ -1,8 +1,8 @@ { - "commit": "82fdf284eea880a8e027c354911a814999a77178", - "readme": "specification\\consumption\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\containerservice\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.18.20220329.1 --generate-sample=true", + "commit": "3cb7e908974fadf215a5579791f89074a1e282ce", + "readme": "specification/consumption/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --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-alpha.19.20220425.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.1", - "use": "@autorest/typescript@6.0.0-alpha.18.20220329.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.2", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/consumption/arm-consumption/package.json b/sdk/consumption/arm-consumption/package.json index aacd14c97e81..9375be44f4bb 100644 --- a/sdk/consumption/arm-consumption/package.json +++ b/sdk/consumption/arm-consumption/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ConsumptionManagementClient.", - "version": "9.0.2", + "version": "10.0.0", "engines": { "node": ">=12.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -38,9 +38,11 @@ "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/consumption/arm-consumption", "repository": { @@ -91,7 +93,7 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", "integration-test:browser": "echo skipped", "docs": "echo skipped" }, @@ -104,13 +106,5 @@ } ] }, - "autoPublish": true, - "//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 ff700c3e0aac..7540dc93ff22 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; } @@ -505,6 +504,8 @@ export enum KnownDatagrain { // @public export enum KnownEventType { + // (undocumented) + CreditExpired = "CreditExpired", // (undocumented) NewCredit = "NewCredit", // (undocumented) @@ -746,6 +747,8 @@ export type LegacyUsageDetail = UsageDetail & { readonly chargeType?: string; readonly frequency?: string; readonly payGPrice?: number; + readonly benefitId?: string; + readonly benefitName?: string; readonly pricingModel?: PricingModelType; }; @@ -788,10 +791,27 @@ export interface LotsListByBillingProfileOptionalParams extends coreClient.Opera // @public export type LotsListByBillingProfileResponse = Lots; +// @public +export interface LotsListByCustomerNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @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 @@ -1203,7 +1223,7 @@ export type ReservationRecommendation = 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 @@ -1270,7 +1290,7 @@ export type ReservationRecommendationKind = string; // @public export interface ReservationRecommendations { - list(scope: string, options?: ReservationRecommendationsListOptionalParams): PagedAsyncIterableIterator; + list(resourceScope: string, options?: ReservationRecommendationsListOptionalParams): PagedAsyncIterableIterator; } // @public @@ -1301,7 +1321,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; } @@ -1360,7 +1380,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 eb3037e9597e..48cd4e6b319e 100644 --- a/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts +++ b/sdk/consumption/arm-consumption/src/consumptionManagementClient.ts @@ -7,6 +7,12 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { UsageDetailsImpl, @@ -80,7 +86,7 @@ export class ConsumptionManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-consumption/9.0.2`; + const packageDetails = `azsdk-js-arm-consumption/10.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -99,6 +105,29 @@ export class ConsumptionManagementClient extends coreClient.ServiceClient { options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; @@ -124,6 +153,35 @@ export class ConsumptionManagementClient extends coreClient.ServiceClient { this.eventsOperations = new EventsOperationsImpl(this); this.lotsOperations = new LotsOperationsImpl(this); this.credits = new CreditsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } usageDetails: UsageDetails; diff --git a/sdk/consumption/arm-consumption/src/models/index.ts b/sdk/consumption/arm-consumption/src/models/index.ts index c37726a97d85..efdbae9f2ca8 100644 --- a/sdk/consumption/arm-consumption/src/models/index.ts +++ b/sdk/consumption/arm-consumption/src/models/index.ts @@ -136,8 +136,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 */ @@ -2121,6 +2119,16 @@ export type LegacyUsageDetail = 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. @@ -2998,6 +3006,22 @@ export enum KnownReservationRecommendationKind { */ export type ReservationRecommendationKind = string; +/** Known values of {@link Scope} that the service accepts. */ +export enum KnownScope { + Single = "Single", + 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 */ @@ -3045,7 +3069,8 @@ export enum KnownEventType { PendingNewCredit = "PendingNewCredit", PendingExpiredCredit = "PendingExpiredCredit", UnKnown = "UnKnown", - NewCredit = "NewCredit" + NewCredit = "NewCredit", + CreditExpired = "CreditExpired" } /** @@ -3059,7 +3084,8 @@ export enum KnownEventType { * **PendingNewCredit** \ * **PendingExpiredCredit** \ * **UnKnown** \ - * **NewCredit** + * **NewCredit** \ + * **CreditExpired** */ export type EventType = string; @@ -3123,22 +3149,6 @@ export enum KnownPricingModelType { */ export type PricingModelType = string; -/** Known values of {@link Scope} that the service accepts. */ -export enum KnownScope { - Single = "Single", - 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 { @@ -3586,6 +3596,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 {} @@ -3603,6 +3623,16 @@ export interface LotsListByBillingAccountNextOptionalParams /** Contains response data for the listByBillingAccountNext operation. */ export type LotsListByBillingAccountNextResponse = Lots; +/** Optional parameters. */ +export interface LotsListByCustomerNextOptionalParams + 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 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 2433e367e222..b6c08c54b470 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: { @@ -3023,7 +3016,6 @@ export const ReservationTransaction: coreClient.CompositeMapper = { }; export const ModernReservationTransaction: coreClient.CompositeMapper = { - serializedName: "Modern", type: { name: "Composite", className: "ModernReservationTransaction", @@ -3542,6 +3534,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, 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 cedd214243ff..1da8f7c3ddd6 100644 --- a/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts +++ b/sdk/consumption/arm-consumption/src/operations/lotsOperations.ts @@ -18,10 +18,14 @@ import { LotsListByBillingProfileOptionalParams, LotsListByBillingAccountNextOptionalParams, LotsListByBillingAccountOptionalParams, + LotsListByCustomerNextOptionalParams, + LotsListByCustomerOptionalParams, LotsListByBillingProfileResponse, LotsListByBillingAccountResponse, + LotsListByCustomerResponse, LotsListByBillingProfileNextResponse, - LotsListByBillingAccountNextResponse + LotsListByBillingAccountNextResponse, + LotsListByCustomerNextResponse } from "../models"; /// @@ -38,9 +42,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. @@ -111,9 +114,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. */ @@ -166,9 +168,80 @@ 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: () => { + return this.listByCustomerPagingPage( + billingAccountId, + customerId, + options + ); + } + }; + } + + private async *listByCustomerPagingPage( + billingAccountId: string, + customerId: string, + options?: LotsListByCustomerOptionalParams + ): AsyncIterableIterator { + let result = await this._listByCustomer( + billingAccountId, + customerId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByCustomerNext( + billingAccountId, + customerId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + 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. @@ -185,9 +258,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. */ @@ -201,6 +273,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 @@ -236,6 +326,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); @@ -278,6 +387,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", @@ -319,3 +449,24 @@ 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 + } + }, + queryParameters: [Parameters.filter, Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.billingAccountId, + Parameters.customerId + ], + headerParameters: [Parameters.accept], + serializer +}; 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 91e81411e61b..e223053d6e35 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationRecommendations.ts @@ -36,19 +36,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(); @@ -57,72 +57,72 @@ export class ReservationRecommendationsImpl return this; }, byPage: () => { - return this.listPagingPage(scope, options); + return this.listPagingPage(resourceScope, options); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, options?: ReservationRecommendationsListOptionalParams ): AsyncIterableIterator { - let result = await this._list(scope, options); + let result = await this._list(resourceScope, options); yield result.value || []; let continuationToken = result.nextLink; while (continuationToken) { - result = await this._listNext(scope, continuationToken, options); + result = await this._listNext(resourceScope, continuationToken, options); continuationToken = result.nextLink; yield result.value || []; } } 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 ); } @@ -131,7 +131,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: { @@ -143,7 +144,7 @@ const listOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [Parameters.filter, Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -160,7 +161,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [Parameters.filter, Parameters.apiVersion], - 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/reservationsDetails.ts b/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts index 559f5c455263..67f88a1dfd77 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationsDetails.ts @@ -196,18 +196,18 @@ 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). + * @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(); @@ -216,30 +216,30 @@ export class ReservationsDetailsImpl implements ReservationsDetails { return this; }, byPage: () => { - return this.listPagingPage(scope, options); + return this.listPagingPage(resourceScope, options); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, options?: ReservationsDetailsListOptionalParams ): AsyncIterableIterator { - let result = await this._list(scope, options); + let result = await this._list(resourceScope, options); yield result.value || []; let continuationToken = result.nextLink; while (continuationToken) { - result = await this._listNext(scope, continuationToken, options); + result = await this._listNext(resourceScope, continuationToken, options); continuationToken = result.nextLink; yield result.value || []; } } 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; } } @@ -284,19 +284,19 @@ 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). + * @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 ); } @@ -348,21 +348,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 ); } @@ -409,7 +409,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: { @@ -427,7 +427,7 @@ const listOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -491,7 +491,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - 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 8fc6c0110bb8..51a77c3884e8 100644 --- a/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts +++ b/sdk/consumption/arm-consumption/src/operations/reservationsSummaries.ts @@ -195,20 +195,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(); @@ -217,32 +217,41 @@ export class ReservationsSummariesImpl implements ReservationsSummaries { return this; }, byPage: () => { - return this.listPagingPage(scope, grain, options); + return this.listPagingPage(resourceScope, grain, options); } }; } private async *listPagingPage( - scope: string, + resourceScope: string, grain: Datagrain, options?: ReservationsSummariesListOptionalParams ): AsyncIterableIterator { - let result = await this._list(scope, grain, options); + let result = await this._list(resourceScope, grain, options); yield result.value || []; let continuationToken = result.nextLink; while (continuationToken) { - result = await this._listNext(scope, grain, continuationToken, options); + result = await this._listNext( + resourceScope, + grain, + continuationToken, + options + ); continuationToken = result.nextLink; yield result.value || []; } } 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; } } @@ -287,21 +296,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 ); } @@ -351,23 +360,23 @@ 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 grain Can be daily or monthly * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ private _listNext( - scope: string, + resourceScope: string, grain: Datagrain, nextLink: string, options?: ReservationsSummariesListNextOptionalParams ): Promise { return this.client.sendOperationRequest( - { scope, grain, nextLink, options }, + { resourceScope, grain, nextLink, options }, listNextOperationSpec ); } @@ -414,7 +423,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: { @@ -433,7 +442,7 @@ const listOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - urlParameters: [Parameters.$host, Parameters.scope], + urlParameters: [Parameters.$host, Parameters.resourceScope], headerParameters: [Parameters.accept], serializer }; @@ -498,7 +507,11 @@ const listNextOperationSpec: coreClient.OperationSpec = { Parameters.reservationId1, Parameters.reservationOrderId1 ], - 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 dcde2c7c829d..2836e80fc7a3 100644 --- a/sdk/consumption/arm-consumption/src/operations/usageDetails.ts +++ b/sdk/consumption/arm-consumption/src/operations/usageDetails.ts @@ -177,6 +177,7 @@ const listOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.UsageDetailsListResult }, + 204: {}, default: { bodyMapper: Mappers.ErrorResponse } @@ -200,6 +201,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/reservationsDetails.ts b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts index 771aedbfc513..2187365715f8 100644 --- a/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts +++ b/sdk/consumption/arm-consumption/src/operationsInterfaces/reservationsDetails.ts @@ -45,15 +45,15 @@ export interface ReservationsDetails { ): 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). + * @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"