diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 54f1a1847991..6fedd9b3b1be 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4132,7 +4132,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20230811 + typescript: 5.3.0-dev.20230816 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8717,8 +8717,8 @@ packages: hasBin: true dev: false - /typescript/5.3.0-dev.20230811: - resolution: {integrity: sha512-C4bwx7ZpBwX7bKxrrNl+M1j8yNGmwQ5M58X0mT4VYI1+FHqRvb/uJ4F1uJsVJ+X7iy22iXSICR/Vxnpc1gNk7w==} + /typescript/5.3.0-dev.20230816: + resolution: {integrity: sha512-iEOudrx61DsbJn+z2bVX+/FldF7ILAuGwQYO2EvF4F33Q8DUV0KSkiikxUB83VVH8ExkwQHVNdtkr16wd2V71w==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -14254,7 +14254,7 @@ packages: dev: false file:projects/arm-quota.tgz: - resolution: {integrity: sha512-bgF/j29uZOM9JgU/s8P/xRqcDYqnAU6dswTQf6WcE9FNRxd2eDIKKe8bImjp1BXWerPDeMKyFTM5lBex8FFVCg==, tarball: file:projects/arm-quota.tgz} + resolution: {integrity: sha512-Mv7RMHqclBrNClOJmPMv/cSRbhLcEijOJzRSdhnXsJbSEViSet6H04JtKAxRvmtuoGsk7fYhJ6u53iy/odZKOA==, tarball: file:projects/arm-quota.tgz} name: '@rush-temp/arm-quota' version: 0.0.0 dependencies: @@ -14268,15 +14268,19 @@ packages: '@types/node': 14.18.54 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.3.1 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_dmbj5memikchm63lpeyt6ukdau + ts-node: 10.9.1_n7tz6hmpirns3flqdptizaxofa tslib: 2.6.1 typescript: 5.0.4 uglify-js: 3.17.4 transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' - supports-color dev: false diff --git a/sdk/quota/arm-quota/CHANGELOG.md b/sdk/quota/arm-quota/CHANGELOG.md index e1bb3e17e367..8a2368e7d807 100644 --- a/sdk/quota/arm-quota/CHANGELOG.md +++ b/sdk/quota/arm-quota/CHANGELOG.md @@ -1,22 +1,141 @@ # Release History + +## 1.0.0-beta.6 (2023-08-16) + +**Features** -## 1.0.0-beta.6 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation group GroupQuotaLimits + - Added operation group GroupQuotaLimitsRequests + - Added operation group GroupQuotas + - Added operation group GroupQuotaSubscriptionQuotaAllocation + - Added operation group GroupQuotaSubscriptionQuotaAllocationRequests + - Added operation group GroupQuotaSubscriptions + - Added operation group SubscriptionRequests + - Added Interface AdditionalAttributes + - Added Interface AssignedToSubscription + - Added Interface BillingAccountId + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Interface GroupingId + - Added Interface GroupQuotaDetails + - Added Interface GroupQuotaDetailsName + - Added Interface GroupQuotaLimit + - Added Interface GroupQuotaLimitList + - Added Interface GroupQuotaLimitsCreateOrUpdateHeaders + - Added Interface GroupQuotaLimitsCreateOrUpdateOptionalParams + - Added Interface GroupQuotaLimitsGetOptionalParams + - Added Interface GroupQuotaLimitsListNextOptionalParams + - Added Interface GroupQuotaLimitsListOptionalParams + - Added Interface GroupQuotaLimitsRequestsGetOptionalParams + - Added Interface GroupQuotaLimitsRequestsListNextOptionalParams + - Added Interface GroupQuotaLimitsRequestsListOptionalParams + - Added Interface GroupQuotaLimitsUpdateHeaders + - Added Interface GroupQuotaLimitsUpdateOptionalParams + - Added Interface GroupQuotaList + - Added Interface GroupQuotasCreateOrUpdateHeaders + - Added Interface GroupQuotasCreateOrUpdateOptionalParams + - Added Interface GroupQuotasDeleteOptionalParams + - Added Interface GroupQuotasEntity + - Added Interface GroupQuotasEntityBase + - Added Interface GroupQuotasGetOptionalParams + - Added Interface GroupQuotasListNextOptionalParams + - Added Interface GroupQuotasListOptionalParams + - Added Interface GroupQuotaSubscriptionId + - Added Interface GroupQuotaSubscriptionIdList + - Added Interface GroupQuotaSubscriptionIdProperties + - Added Interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateHeaders + - Added Interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationGetOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationListNextOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationListOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationRequestsListNextOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + - Added Interface GroupQuotaSubscriptionQuotaAllocationUpdateHeaders + - Added Interface GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + - Added Interface GroupQuotaSubscriptionsCreateOrUpdateHeaders + - Added Interface GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + - Added Interface GroupQuotaSubscriptionsDeleteOptionalParams + - Added Interface GroupQuotaSubscriptionsGetOptionalParams + - Added Interface GroupQuotaSubscriptionsListNextOptionalParams + - Added Interface GroupQuotaSubscriptionsListOptionalParams + - Added Interface GroupQuotaSubscriptionsUpdateHeaders + - Added Interface GroupQuotaSubscriptionsUpdateOptionalParams + - Added Interface GroupQuotasUpdateHeaders + - Added Interface GroupQuotasUpdateOptionalParams + - Added Interface ProxyResource + - Added Interface Resource + - Added Interface ResourceBaseRequest + - Added Interface SubmittedResourceRequestStatus + - Added Interface SubmittedResourceRequestStatusList + - Added Interface SubscriptionGroupQuotaAssignment + - Added Interface SubscriptionQuotaAllocationRequest + - Added Interface SubscriptionQuotaAllocationRequestList + - Added Interface SubscriptionQuotaAllocationRequestProperties + - Added Interface SubscriptionQuotaAllocations + - Added Interface SubscriptionQuotaAllocationsList + - Added Interface SubscriptionQuotaDetails + - Added Interface SubscriptionRequestsGetOptionalParams + - Added Interface SubscriptionRequestsListNextOptionalParams + - Added Interface SubscriptionRequestsListOptionalParams + - Added Interface SystemData + - Added Type Alias CreatedByType + - Added Type Alias EnvironmentType + - Added Type Alias GroupingIdType + - Added Type Alias GroupQuotaLimitsCreateOrUpdateResponse + - Added Type Alias GroupQuotaLimitsGetResponse + - Added Type Alias GroupQuotaLimitsListNextResponse + - Added Type Alias GroupQuotaLimitsListResponse + - Added Type Alias GroupQuotaLimitsRequestsGetResponse + - Added Type Alias GroupQuotaLimitsRequestsListNextResponse + - Added Type Alias GroupQuotaLimitsRequestsListResponse + - Added Type Alias GroupQuotaLimitsUpdateResponse + - Added Type Alias GroupQuotasCreateOrUpdateResponse + - Added Type Alias GroupQuotasGetResponse + - Added Type Alias GroupQuotasListNextResponse + - Added Type Alias GroupQuotasListResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationGetResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationListNextResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationListResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationRequestsGetResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationRequestsListNextResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationRequestsListResponse + - Added Type Alias GroupQuotaSubscriptionQuotaAllocationUpdateResponse + - Added Type Alias GroupQuotaSubscriptionsCreateOrUpdateResponse + - Added Type Alias GroupQuotaSubscriptionsGetResponse + - Added Type Alias GroupQuotaSubscriptionsListNextResponse + - Added Type Alias GroupQuotaSubscriptionsListResponse + - Added Type Alias GroupQuotaSubscriptionsUpdateResponse + - Added Type Alias GroupQuotasUpdateResponse + - Added Type Alias RequestState + - Added Type Alias SubscriptionRequestsGetResponse + - Added Type Alias SubscriptionRequestsListNextResponse + - Added Type Alias SubscriptionRequestsListResponse + - Added Enum KnownCreatedByType + - Added Enum KnownEnvironmentType + - Added Enum KnownGroupingIdType + - Added Enum KnownRequestState -### Other Changes +**Breaking Changes** + - Class AzureQuotaExtensionAPI has a new signature + - Interface AzureQuotaExtensionAPIOptionalParams no longer has parameter $host + - Interface AzureQuotaExtensionAPIOptionalParams no longer has parameter apiVersion + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter filter + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter skiptoken + - Interface QuotaRequestStatusListNextOptionalParams no longer has parameter top + - Class AzureQuotaExtensionAPI no longer has parameter apiVersion + + ## 1.0.0-beta.5 (2022-12-05) **Features** - Added Interface LimitObject -## 1.0.0-beta.4 (2022-04-28) +### 1.0.0-beta.4 (2022-04-28) **Features** diff --git a/sdk/quota/arm-quota/LICENSE b/sdk/quota/arm-quota/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/quota/arm-quota/LICENSE +++ b/sdk/quota/arm-quota/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/quota/arm-quota/README.md b/sdk/quota/arm-quota/README.md index 62516ec73d5e..d02b8491573d 100644 --- a/sdk/quota/arm-quota/README.md +++ b/sdk/quota/arm-quota/README.md @@ -2,7 +2,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureQuotaExtensionApi client. -Microsoft Azure Quota Resource Provider +Microsoft Azure Quota Resource Provider. This Swagger is for Azure MG Group Quota using GroupQuota Entity. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-quota) | diff --git a/sdk/quota/arm-quota/_meta.json b/sdk/quota/arm-quota/_meta.json index 8ac45aa52360..94d776b3f3de 100644 --- a/sdk/quota/arm-quota/_meta.json +++ b/sdk/quota/arm-quota/_meta.json @@ -1,8 +1,8 @@ { - "commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf", - "readme": "specification\\quota\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\quota\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true", + "commit": "93ab3e747b6613b32a52f9c0ef489f97822ebc0c", + "readme": "specification/quota/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/quota/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.3.20221108.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.1", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/quota/arm-quota/package.json b/sdk/quota/arm-quota/package.json index 0bff7f542475..8c87edcfc71a 100644 --- a/sdk/quota/arm-quota/package.json +++ b/sdk/quota/arm-quota/package.json @@ -8,12 +8,12 @@ "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.4", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -33,12 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -47,9 +48,9 @@ "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.0.0", + "ts-node": "^10.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,12 +112,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-quota?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota" +} \ No newline at end of file diff --git a/sdk/quota/arm-quota/review/arm-quota.api.md b/sdk/quota/arm-quota/review/arm-quota.api.md index 28d562f535bc..a3b649adf034 100644 --- a/sdk/quota/arm-quota/review/arm-quota.api.md +++ b/sdk/quota/arm-quota/review/arm-quota.api.md @@ -6,17 +6,40 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export interface AdditionalAttributes { + environment?: EnvironmentType; + groupId: GroupingId; +} + +// @public +export interface AssignedToSubscription { + quotaAllocated?: number; + subscriptionId?: string; +} // @public (undocumented) export class AzureQuotaExtensionAPI extends coreClient.ServiceClient { // (undocumented) $host: string; - constructor(credentials: coreAuth.TokenCredential, options?: AzureQuotaExtensionAPIOptionalParams); + constructor(credentials: coreAuth.TokenCredential, $host: string, subscriptionId: string, options?: AzureQuotaExtensionAPIOptionalParams); + constructor(credentials: coreAuth.TokenCredential, $host: string, options?: AzureQuotaExtensionAPIOptionalParams); + // (undocumented) + groupQuotaLimits: GroupQuotaLimits; + // (undocumented) + groupQuotaLimitsRequests: GroupQuotaLimitsRequests; + // (undocumented) + groupQuotas: GroupQuotas; + // (undocumented) + groupQuotaSubscriptionQuotaAllocation: GroupQuotaSubscriptionQuotaAllocation; + // (undocumented) + groupQuotaSubscriptionQuotaAllocationRequests: GroupQuotaSubscriptionQuotaAllocationRequests; // (undocumented) - apiVersion: string; + groupQuotaSubscriptions: GroupQuotaSubscriptions; // (undocumented) quota: Quota; // (undocumented) @@ -24,16 +47,24 @@ export class AzureQuotaExtensionAPI extends coreClient.ServiceClient { // (undocumented) quotaRequestStatus: QuotaRequestStatus; // (undocumented) + subscriptionId?: string; + // (undocumented) + subscriptionRequests: SubscriptionRequests; + // (undocumented) usages: Usages; } // @public export interface AzureQuotaExtensionAPIOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; - apiVersion?: string; endpoint?: string; } +// @public +export interface BillingAccountId { + // (undocumented) + id?: string; +} + // @public export interface CommonResourceProperties { readonly id?: string; @@ -41,6 +72,9 @@ export interface CommonResourceProperties { readonly type?: string; } +// @public +export type CreatedByType = string; + // @public export interface CreateGenericQuotaRequestParameters { value?: CurrentQuotaLimitBase[]; @@ -62,6 +96,29 @@ export interface CurrentUsagesBase { readonly type?: string; } +// @public +export type EnvironmentType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + // @public export interface ExceptionResponse { error?: ServiceError; @@ -70,6 +127,419 @@ export interface ExceptionResponse { // @public export function getContinuationToken(page: unknown): string | undefined; +// @public +export interface GroupingId { + groupingIdType?: GroupingIdType; + value?: string; +} + +// @public +export type GroupingIdType = string; + +// @public +export interface GroupQuotaDetails { + readonly assignedToSubscriptions?: AssignedToSubscription[]; + readonly availableLimit?: number; + comment?: string; + limit?: number; + name?: GroupQuotaDetailsName; + readonly provisioningState?: RequestState; + readonly unit?: string; +} + +// @public +export interface GroupQuotaDetailsName { + readonly localizedValue?: string; + readonly value?: string; +} + +// @public +export interface GroupQuotaLimit extends ProxyResource { + properties?: GroupQuotaDetails; +} + +// @public +export interface GroupQuotaLimitList { + readonly nextLink?: string; + value?: GroupQuotaLimit[]; +} + +// @public +export interface GroupQuotaLimits { + beginCreateOrUpdate(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaLimitsCreateOrUpdateOptionalParams): Promise, GroupQuotaLimitsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaLimitsCreateOrUpdateOptionalParams): Promise; + beginUpdate(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaLimitsUpdateOptionalParams): Promise, GroupQuotaLimitsUpdateResponse>>; + beginUpdateAndWait(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaLimitsUpdateOptionalParams): Promise; + get(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaLimitsGetOptionalParams): Promise; + list(mgId: string, resourceProviderScope: string, groupQuotaName: string, options?: GroupQuotaLimitsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotaLimitsCreateOrUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaLimitsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + groupQuotaLimitRequest?: GroupQuotaLimit; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaLimitsCreateOrUpdateResponse = GroupQuotaLimit; + +// @public +export interface GroupQuotaLimitsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsGetResponse = GroupQuotaLimit; + +// @public +export interface GroupQuotaLimitsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsListNextResponse = GroupQuotaLimitList; + +// @public +export interface GroupQuotaLimitsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsListResponse = GroupQuotaLimitList; + +// @public +export interface GroupQuotaLimitsRequests { + get(mgId: string, resourceProviderScope: string, groupQuotaName: string, requestId: string, options?: GroupQuotaLimitsRequestsGetOptionalParams): Promise; + list(mgId: string, resourceProviderScope: string, groupQuotaName: string, options?: GroupQuotaLimitsRequestsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotaLimitsRequestsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsRequestsGetResponse = SubmittedResourceRequestStatus; + +// @public +export interface GroupQuotaLimitsRequestsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsRequestsListNextResponse = SubmittedResourceRequestStatusList; + +// @public +export interface GroupQuotaLimitsRequestsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaLimitsRequestsListResponse = SubmittedResourceRequestStatusList; + +// @public +export interface GroupQuotaLimitsUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaLimitsUpdateOptionalParams extends coreClient.OperationOptions { + groupQuotaLimitRequest?: GroupQuotaLimit; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaLimitsUpdateResponse = GroupQuotaLimit; + +// @public +export interface GroupQuotaList { + readonly nextLink?: string; + value?: GroupQuotasEntity[]; +} + +// @public +export interface GroupQuotas { + beginCreateOrUpdate(mgId: string, groupQuotaName: string, options?: GroupQuotasCreateOrUpdateOptionalParams): Promise, GroupQuotasCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(mgId: string, groupQuotaName: string, options?: GroupQuotasCreateOrUpdateOptionalParams): Promise; + beginUpdate(mgId: string, groupQuotaName: string, options?: GroupQuotasUpdateOptionalParams): Promise, GroupQuotasUpdateResponse>>; + beginUpdateAndWait(mgId: string, groupQuotaName: string, options?: GroupQuotasUpdateOptionalParams): Promise; + delete(mgId: string, groupQuotaName: string, options?: GroupQuotasDeleteOptionalParams): Promise; + get(mgId: string, groupQuotaName: string, options?: GroupQuotasGetOptionalParams): Promise; + list(mgId: string, options?: GroupQuotasListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotasCreateOrUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotasCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + groupQuotaPutRequestBody?: GroupQuotasEntity; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotasCreateOrUpdateResponse = GroupQuotasEntity; + +// @public +export interface GroupQuotasDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GroupQuotasEntity extends ProxyResource { + properties?: GroupQuotasEntityBase; +} + +// @public +export interface GroupQuotasEntityBase { + additionalAttributes?: AdditionalAttributes; + displayName?: string; + readonly provisioningState?: RequestState; +} + +// @public +export interface GroupQuotasGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotasGetResponse = GroupQuotasEntity; + +// @public +export interface GroupQuotasListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotasListNextResponse = GroupQuotaList; + +// @public +export interface GroupQuotasListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotasListResponse = GroupQuotaList; + +// @public +export interface GroupQuotaSubscriptionId extends ProxyResource { + // (undocumented) + properties?: GroupQuotaSubscriptionIdProperties; +} + +// @public +export interface GroupQuotaSubscriptionIdList { + readonly nextLink?: string; + value?: GroupQuotaSubscriptionId[]; +} + +// @public (undocumented) +export interface GroupQuotaSubscriptionIdProperties { + readonly provisioningState?: RequestState; + readonly subscriptionId?: string; +} + +// @public +export interface GroupQuotaSubscriptionQuotaAllocation { + beginCreateOrUpdate(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, allocateQuotaRequest: SubscriptionQuotaAllocations, options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams): Promise, GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, allocateQuotaRequest: SubscriptionQuotaAllocations, options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams): Promise; + beginUpdate(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, allocateQuotaRequest: SubscriptionQuotaAllocations, options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams): Promise, GroupQuotaSubscriptionQuotaAllocationUpdateResponse>>; + beginUpdateAndWait(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, allocateQuotaRequest: SubscriptionQuotaAllocations, options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams): Promise; + get(mgId: string, resourceProviderScope: string, groupQuotaName: string, resourceName: string, options?: GroupQuotaSubscriptionQuotaAllocationGetOptionalParams): Promise; + list(mgId: string, resourceProviderScope: string, groupQuotaName: string, options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse = SubscriptionQuotaAllocations; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationGetResponse = SubscriptionQuotaAllocations; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationListNextResponse = SubscriptionQuotaAllocationsList; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationListResponse = SubscriptionQuotaAllocationsList; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationRequests { + get(mgId: string, resourceProviderScope: string, groupQuotaName: string, allocationId: string, options?: GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams): Promise; + list(mgId: string, resourceProviderScope: string, groupQuotaName: string, options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationRequestsGetResponse = SubscriptionQuotaAllocationRequest; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationRequestsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationRequestsListNextResponse = SubscriptionQuotaAllocationRequestList; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationRequestsListResponse = SubscriptionQuotaAllocationRequestList; + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaSubscriptionQuotaAllocationUpdateResponse = SubscriptionQuotaAllocations; + +// @public +export interface GroupQuotaSubscriptions { + beginCreateOrUpdate(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams): Promise, GroupQuotaSubscriptionsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams): Promise; + beginUpdate(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsUpdateOptionalParams): Promise, GroupQuotaSubscriptionsUpdateResponse>>; + beginUpdateAndWait(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsUpdateOptionalParams): Promise; + delete(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsDeleteOptionalParams): Promise; + get(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsGetOptionalParams): Promise; + list(mgId: string, groupQuotaName: string, options?: GroupQuotaSubscriptionsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface GroupQuotaSubscriptionsCreateOrUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaSubscriptionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaSubscriptionsCreateOrUpdateResponse = GroupQuotaSubscriptionId; + +// @public +export interface GroupQuotaSubscriptionsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GroupQuotaSubscriptionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionsGetResponse = GroupQuotaSubscriptionId; + +// @public +export interface GroupQuotaSubscriptionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionsListNextResponse = GroupQuotaSubscriptionIdList; + +// @public +export interface GroupQuotaSubscriptionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GroupQuotaSubscriptionsListResponse = GroupQuotaSubscriptionIdList; + +// @public +export interface GroupQuotaSubscriptionsUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotaSubscriptionsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotaSubscriptionsUpdateResponse = GroupQuotaSubscriptionId; + +// @public +export interface GroupQuotasUpdateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface GroupQuotasUpdateOptionalParams extends coreClient.OperationOptions { + groupQuotasPatchRequestBody?: GroupQuotasEntity; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GroupQuotasUpdateResponse = GroupQuotasEntity; + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownEnvironmentType { + NonProduction = "NonProduction", + Production = "Production" +} + +// @public +export enum KnownGroupingIdType { + BillingId = "BillingId", + ServiceTreeId = "ServiceTreeId" +} + // @public export enum KnownLimitType { LimitValue = "LimitValue" @@ -90,6 +560,17 @@ export enum KnownQuotaRequestState { Succeeded = "Succeeded" } +// @public +export enum KnownRequestState { + Accepted = "Accepted", + Canceled = "Canceled", + Created = "Created", + Failed = "Failed", + InProgress = "InProgress", + Invalid = "Invalid", + Succeeded = "Succeeded" +} + // @public export enum KnownUsagesTypes { Combined = "Combined", @@ -139,11 +620,15 @@ export interface OperationResponse { origin?: string; } +// @public +export interface ProxyResource extends Resource { +} + // @public export interface Quota { - beginCreateOrUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise, QuotaCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise, QuotaCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise; - beginUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise, QuotaUpdateResponse>>; + beginUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise, QuotaUpdateResponse>>; beginUpdateAndWait(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise; get(resourceName: string, scope: string, options?: QuotaGetOptionalParams): Promise; list(scope: string, options?: QuotaListOptionalParams): PagedAsyncIterableIterator; @@ -303,9 +788,6 @@ export type QuotaRequestStatusGetResponse = QuotaRequestDetails; // @public export interface QuotaRequestStatusListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - skiptoken?: string; - top?: number; } // @public @@ -353,6 +835,24 @@ export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions { // @public export type QuotaUpdateResponse = CurrentQuotaLimitBase; +// @public +export type RequestState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ResourceBaseRequest { + limits?: number; + resourceName?: string; + readonly unit?: string; +} + // @public export interface ResourceName { readonly localizedValue?: string; @@ -372,6 +872,18 @@ export interface ServiceErrorDetail { readonly message?: string; } +// @public +export interface SubmittedResourceRequestStatus { + requestedResource?: ResourceBaseRequest; + readonly status?: RequestState; +} + +// @public +export interface SubmittedResourceRequestStatusList { + readonly nextLink?: string; + value?: SubmittedResourceRequestStatus[]; +} + // @public export interface SubRequest { limit?: LimitJsonObjectUnion; @@ -383,6 +895,86 @@ export interface SubRequest { unit?: string; } +// @public +export interface SubscriptionGroupQuotaAssignment { + managementGroupId?: string; + quotaAllocated?: number; +} + +// @public +export interface SubscriptionQuotaAllocationRequest { + // (undocumented) + properties?: SubscriptionQuotaAllocationRequestProperties; +} + +// @public (undocumented) +export interface SubscriptionQuotaAllocationRequestList { + readonly nextLink?: string; + value?: SubscriptionQuotaAllocationRequest[]; +} + +// @public (undocumented) +export interface SubscriptionQuotaAllocationRequestProperties { + limit?: number; + readonly provisioningState?: RequestState; +} + +// @public +export interface SubscriptionQuotaAllocations extends ProxyResource { + properties?: SubscriptionQuotaDetails; +} + +// @public +export interface SubscriptionQuotaAllocationsList { + readonly nextLink?: string; + value?: SubscriptionQuotaAllocations[]; +} + +// @public +export interface SubscriptionQuotaDetails { + readonly limit?: number; + readonly nonShareableQuota?: number; + readonly provisioningState?: RequestState; + quotaSources?: SubscriptionGroupQuotaAssignment[]; +} + +// @public +export interface SubscriptionRequests { + get(mgId: string, groupQuotaName: string, requestId: string, options?: SubscriptionRequestsGetOptionalParams): Promise; + list(mgId: string, groupQuotaName: string, options?: SubscriptionRequestsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SubscriptionRequestsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SubscriptionRequestsGetResponse = GroupQuotaSubscriptionId; + +// @public +export interface SubscriptionRequestsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SubscriptionRequestsListNextResponse = GroupQuotaSubscriptionIdList; + +// @public +export interface SubscriptionRequestsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SubscriptionRequestsListResponse = GroupQuotaSubscriptionIdList; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + // @public export interface Usages { get(resourceName: string, scope: string, options?: UsagesGetOptionalParams): Promise; diff --git a/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts b/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts index 2eea16afdcf6..0adbbd4d05b7 100644 --- a/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts +++ b/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts @@ -8,19 +8,28 @@ 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 { + GroupQuotasImpl, + GroupQuotaSubscriptionsImpl, + SubscriptionRequestsImpl, + GroupQuotaLimitsImpl, + GroupQuotaLimitsRequestsImpl, + GroupQuotaSubscriptionQuotaAllocationImpl, + GroupQuotaSubscriptionQuotaAllocationRequestsImpl, UsagesImpl, QuotaImpl, QuotaRequestStatusImpl, QuotaOperationImpl } from "./operations"; import { + GroupQuotas, + GroupQuotaSubscriptions, + SubscriptionRequests, + GroupQuotaLimits, + GroupQuotaLimitsRequests, + GroupQuotaSubscriptionQuotaAllocation, + GroupQuotaSubscriptionQuotaAllocationRequests, Usages, Quota, QuotaRequestStatus, @@ -30,20 +39,46 @@ import { AzureQuotaExtensionAPIOptionalParams } from "./models"; export class AzureQuotaExtensionAPI extends coreClient.ServiceClient { $host: string; - apiVersion: string; + subscriptionId?: string; /** * Initializes a new instance of the AzureQuotaExtensionAPI class. * @param credentials Subscription credentials which uniquely identify client subscription. + * @param $host server parameter + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param options The parameter options */ constructor( credentials: coreAuth.TokenCredential, + $host: string, + subscriptionId: string, + options?: AzureQuotaExtensionAPIOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + $host: string, + options?: AzureQuotaExtensionAPIOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + $host: string, + subscriptionIdOrOptions?: AzureQuotaExtensionAPIOptionalParams | string, options?: AzureQuotaExtensionAPIOptionalParams ) { if (credentials === undefined) { throw new Error("'credentials' cannot be null"); } + if ($host === undefined) { + throw new Error("'$host' cannot be null"); + } + + let subscriptionId: string | undefined; + + if (typeof subscriptionIdOrOptions === "string") { + subscriptionId = subscriptionIdOrOptions; + } else if (typeof subscriptionIdOrOptions === "object") { + options = subscriptionIdOrOptions; + } // Initializing default values for options if (!options) { @@ -102,45 +137,33 @@ export class AzureQuotaExtensionAPI extends coreClient.ServiceClient { }) ); } - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-03-15-preview"; + // Parameter assignments + this.$host = $host; + this.subscriptionId = subscriptionId; + this.groupQuotas = new GroupQuotasImpl(this); + this.groupQuotaSubscriptions = new GroupQuotaSubscriptionsImpl(this); + this.subscriptionRequests = new SubscriptionRequestsImpl(this); + this.groupQuotaLimits = new GroupQuotaLimitsImpl(this); + this.groupQuotaLimitsRequests = new GroupQuotaLimitsRequestsImpl(this); + this.groupQuotaSubscriptionQuotaAllocation = new GroupQuotaSubscriptionQuotaAllocationImpl( + this + ); + this.groupQuotaSubscriptionQuotaAllocationRequests = new GroupQuotaSubscriptionQuotaAllocationRequestsImpl( + this + ); this.usages = new UsagesImpl(this); this.quota = new QuotaImpl(this); this.quotaRequestStatus = new QuotaRequestStatusImpl(this); this.quotaOperation = new QuotaOperationImpl(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 "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); } + groupQuotas: GroupQuotas; + groupQuotaSubscriptions: GroupQuotaSubscriptions; + subscriptionRequests: SubscriptionRequests; + groupQuotaLimits: GroupQuotaLimits; + groupQuotaLimitsRequests: GroupQuotaLimitsRequests; + groupQuotaSubscriptionQuotaAllocation: GroupQuotaSubscriptionQuotaAllocation; + groupQuotaSubscriptionQuotaAllocationRequests: GroupQuotaSubscriptionQuotaAllocationRequests; usages: Usages; quota: Quota; quotaRequestStatus: QuotaRequestStatus; diff --git a/sdk/quota/arm-quota/src/lroImpl.ts b/sdk/quota/arm-quota/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/quota/arm-quota/src/lroImpl.ts +++ b/sdk/quota/arm-quota/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; import { LongRunningOperation, LroResponse } from "@azure/core-lro"; -export class LroImpl implements LongRunningOperation { - constructor( - private sendOperationFn: (args: any, spec: any) => Promise>, - private args: Record, - private spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record, - public requestPath: string = spec.path!, - public requestMethod: string = spec.httpMethod - ) {} - public async sendInitialRequest(): Promise> { - return this.sendOperationFn(this.args, this.spec); - } - public async sendPollRequest(path: string): Promise> { - const { requestBody, ...restSpec } = this.spec; - return this.sendOperationFn(this.args, { - ...restSpec, - path, - httpMethod: "GET" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/quota/arm-quota/src/models/index.ts b/sdk/quota/arm-quota/src/models/index.ts index b8fafd6bd0e6..8e1f4047d5ce 100644 --- a/sdk/quota/arm-quota/src/models/index.ts +++ b/sdk/quota/arm-quota/src/models/index.ts @@ -10,6 +10,322 @@ import * as coreClient from "@azure/core-client"; export type LimitJsonObjectUnion = LimitJsonObject | LimitObject; +/** Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. */ +export interface GroupQuotasEntityBase { + /** Display name of the GroupQuota entity. */ + displayName?: string; + /** Additional attributes to allow subscription, which can be added to the subscriptionIds. */ + additionalAttributes?: AdditionalAttributes; + /** + * Provisioning state of the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RequestState; +} + +/** Additional attribute to allow subscriptions to be part of the GroupQuota. */ +export interface AdditionalAttributes { + /** The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if applicable. */ + groupId: GroupingId; + /** Environment name. */ + environment?: EnvironmentType; +} + +/** The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if applicable. */ +export interface GroupingId { + /** GroupingId type. It is a required property. More types of groupIds can be supported in future. MGID is already in the URI, so it's not needed.' */ + groupingIdType?: GroupingIdType; + /** GroupId value based on the groupingType selected - management Group Id or ServiceTreeId. */ + value?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** List of Group Quotas at MG level. */ +export interface GroupQuotaList { + /** List of Group Quotas at MG level. */ + value?: GroupQuotasEntity[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +export interface GroupQuotaSubscriptionIdProperties { + /** + * An Azure subscriptionId. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subscriptionId?: string; + /** + * Status of this subscriptionId being associated with the GroupQuotasEntity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RequestState; +} + +/** List of GroupQuotaSubscriptionIds */ +export interface GroupQuotaSubscriptionIdList { + /** List of GroupQuotaSubscriptionIds */ + value?: GroupQuotaSubscriptionId[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Group Quota details. */ +export interface GroupQuotaDetails { + /** The current Group Quota Limit at the parentId level. */ + limit?: number; + /** Any comment related to quota request. */ + comment?: string; + /** Name of the resource provided by the resource Provider. This property is already included in the request URI, so it is a readonly property returned in the response. */ + name?: GroupQuotaDetailsName; + /** + * The usages units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET response in the request body of your PUT operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly unit?: string; + /** + * The available Group Quota Limit at the MG level. This Group quota can be assigned to subscription(s). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly availableLimit?: number; + /** + * Assigned Group Quota to subscriptions. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly assignedToSubscriptions?: AssignedToSubscription[]; + /** + * Request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RequestState; +} + +/** Name of the resource provided by the resource Provider. This property is already included in the request URI, so it is a readonly property returned in the response. */ +export interface GroupQuotaDetailsName { + /** + * Resource name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: string; + /** + * Resource display name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly localizedValue?: string; +} + +/** SubscriptionIds and quota allocated to subscriptions from the GroupQuota. */ +export interface AssignedToSubscription { + /** An Azure subscriptionId. */ + subscriptionId?: string; + /** The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. */ + quotaAllocated?: number; +} + +/** List of Group Quota Limit details. */ +export interface GroupQuotaLimitList { + /** List of Group Quota Limit details. */ + value?: GroupQuotaLimit[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Share Quota Entity list. */ +export interface SubmittedResourceRequestStatusList { + /** Subscription groupQuotaRequests list. */ + value?: SubmittedResourceRequestStatus[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Status of a single GroupQuota request. */ +export interface SubmittedResourceRequestStatus { + /** Requested Resource. */ + requestedResource?: ResourceBaseRequest; + /** + * Request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: RequestState; +} + +/** Resource definition with the requested quota. */ +export interface ResourceBaseRequest { + /** The resource name, such as SKU name. */ + resourceName?: string; + /** Quota requested for the resource. */ + limits?: number; + /** + * Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. Based on - https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . Different RPs may have different units, Count, type as int64 should work for most of the integer values. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly unit?: string; +} + +/** Subscription quota list. */ +export interface SubscriptionQuotaAllocationsList { + /** Subscription quota list. */ + value?: SubscriptionQuotaAllocations[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Subscription Quota details. */ +export interface SubscriptionQuotaDetails { + /** + * The total quota limit for the subscription. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly limit?: number; + /** + * The non shareable quota for the subscription. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nonShareableQuota?: number; + /** + * Request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RequestState; + /** Assigned Group Quota to subscriptions. */ + quotaSources?: SubscriptionGroupQuotaAssignment[]; +} + +/** MGId the source of groupQuota. */ +export interface SubscriptionGroupQuotaAssignment { + /** The management group id of the quota source. */ + managementGroupId?: string; + /** The amount of quota allocated to this subscriptionId from the quota source. */ + quotaAllocated?: number; +} + +/** The new quota limit for the subscription. */ +export interface SubscriptionQuotaAllocationRequest { + properties?: SubscriptionQuotaAllocationRequestProperties; +} + +export interface SubscriptionQuotaAllocationRequestProperties { + /** + * Request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RequestState; + /** The new quota limit for the subscription. The incremental quota will be assigned from pre-approved groupQuota. */ + limit?: number; +} + +export interface SubscriptionQuotaAllocationRequestList { + /** Assigned Group Quota to subscriptions. */ + value?: SubscriptionQuotaAllocationRequest[]; + /** + * The URL to use for getting the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + /** Resource usage. */ export interface CurrentUsagesBase { /** @@ -42,7 +358,7 @@ export interface UsagesProperties { readonly unit?: string; /** Resource name provided by the resource provider. Use this property name when requesting quota. */ name?: ResourceName; - /** The name of the resource type. */ + /** The name of the resource type. Optional field. */ resourceType?: string; /** * The time period for the summary of the quota usage values. For example: @@ -154,7 +470,7 @@ export interface QuotaProperties { readonly unit?: string; /** Resource name provided by the resource provider. Use this property name when requesting quota. */ name?: ResourceName; - /** Resource type name. */ + /** The name of the resource type. Optional field. */ resourceType?: string; /** * The time period over which the quota usage values are summarized. For example: @@ -310,6 +626,11 @@ export interface OperationDisplay { description?: string; } +/** A Billing Account Id. */ +export interface BillingAccountId { + id?: string; +} + /** Resource properties. */ export interface CommonResourceProperties { /** @@ -386,7 +707,7 @@ export interface QuotaRequestOneResourceSubmitResponse { unit?: string; /** Resource name provided by the resource provider. Use this property name when requesting quota. */ namePropertiesName?: ResourceName; - /** Resource type name. */ + /** The name of the resource type. Optional field. */ resourceType?: string; /** * The time period over which the quota usage values are summarized. For example: @@ -462,7 +783,7 @@ export interface QuotaRequestSubmitResponse202 { unit?: string; /** Resource name provided by the resource provider. Use this property name when requesting quota. */ namePropertiesName?: ResourceName; - /** Resource type name. */ + /** The name of the resource type. Optional field. */ resourceType?: string; /** * The time period over which the quota usage values are summarized. For example: @@ -477,6 +798,9 @@ export interface QuotaRequestSubmitResponse202 { properties?: Record; } +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + /** The resource quota limit value. */ export interface LimitObject extends LimitJsonObject { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -487,6 +811,189 @@ export interface LimitObject extends LimitJsonObject { limitType?: QuotaLimitTypes; } +/** Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. */ +export interface GroupQuotasEntity extends ProxyResource { + /** Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. */ + properties?: GroupQuotasEntityBase; +} + +/** This represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. */ +export interface GroupQuotaSubscriptionId extends ProxyResource { + properties?: GroupQuotaSubscriptionIdProperties; +} + +/** Group Quota limit. */ +export interface GroupQuotaLimit extends ProxyResource { + /** Group Quota properties for the specified resource. */ + properties?: GroupQuotaDetails; +} + +/** Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription can be assigned back to the MG Group Quota. */ +export interface SubscriptionQuotaAllocations extends ProxyResource { + /** Quota properties for the specified resource. */ + properties?: SubscriptionQuotaDetails; +} + +/** Defines headers for GroupQuotas_createOrUpdate operation. */ +export interface GroupQuotasCreateOrUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers. New guidelines - https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#131-resource-based-long-running-operations-relo + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotas_update operation. */ +export interface GroupQuotasUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaSubscriptions_createOrUpdate operation. */ +export interface GroupQuotaSubscriptionsCreateOrUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers. New guidelines - https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#131-resource-based-long-running-operations-relo + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaSubscriptions_update operation. */ +export interface GroupQuotaSubscriptionsUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaLimits_createOrUpdate operation. */ +export interface GroupQuotaLimitsCreateOrUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaLimits_update operation. */ +export interface GroupQuotaLimitsUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaSubscriptionQuotaAllocation_createOrUpdate operation. */ +export interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + +/** Defines headers for GroupQuotaSubscriptionQuotaAllocation_update operation. */ +export interface GroupQuotaSubscriptionQuotaAllocationUpdateHeaders { + /** The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ + retryAfter?: number; + /** + * URL for determining when an operation has completed. Send a GET request to the URL in Location header. + * The URI should return a 202 until the operation reaches a terminal state and 200 once it reaches a terminal state. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + */ + location?: string; + /** + * URL for checking the ongoing status of the operation. + * To get the status of the asynchronous operation, send a GET request to the URL in Azure-AsyncOperation header value. + * + * For more info: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + */ + azureAsyncOperation?: string; +} + /** Defines headers for Usages_get operation. */ export interface UsagesGetHeaders { /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ @@ -523,6 +1030,99 @@ export interface QuotaListNextHeaders { eTag?: string; } +/** Known values of {@link GroupingIdType} that the service accepts. */ +export enum KnownGroupingIdType { + /** ServiceTreeId */ + ServiceTreeId = "ServiceTreeId", + /** BillingId */ + BillingId = "BillingId" +} + +/** + * Defines values for GroupingIdType. \ + * {@link KnownGroupingIdType} can be used interchangeably with GroupingIdType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ServiceTreeId** \ + * **BillingId** + */ +export type GroupingIdType = string; + +/** Known values of {@link EnvironmentType} that the service accepts. */ +export enum KnownEnvironmentType { + /** NonProduction */ + NonProduction = "NonProduction", + /** Production */ + Production = "Production" +} + +/** + * Defines values for EnvironmentType. \ + * {@link KnownEnvironmentType} can be used interchangeably with EnvironmentType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NonProduction** \ + * **Production** + */ +export type EnvironmentType = string; + +/** Known values of {@link RequestState} that the service accepts. */ +export enum KnownRequestState { + /** Accepted */ + Accepted = "Accepted", + /** Created */ + Created = "Created", + /** Invalid */ + Invalid = "Invalid", + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** InProgress */ + InProgress = "InProgress", + /** Canceled */ + Canceled = "Canceled" +} + +/** + * Defines values for RequestState. \ + * {@link KnownRequestState} can be used interchangeably with RequestState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Created** \ + * **Invalid** \ + * **Succeeded** \ + * **Failed** \ + * **InProgress** \ + * **Canceled** + */ +export type RequestState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + /** Known values of {@link UsagesTypes} that the service accepts. */ export enum KnownUsagesTypes { /** Individual */ @@ -601,6 +1201,265 @@ export enum KnownQuotaLimitTypes { */ export type QuotaLimitTypes = string; +/** Optional parameters. */ +export interface GroupQuotasCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** The GroupQuota body details for creation or update of a GroupQuota entity. */ + groupQuotaPutRequestBody?: GroupQuotasEntity; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type GroupQuotasCreateOrUpdateResponse = GroupQuotasEntity; + +/** Optional parameters. */ +export interface GroupQuotasUpdateOptionalParams + extends coreClient.OperationOptions { + /** The GroupQuotas Patch Request. */ + groupQuotasPatchRequestBody?: GroupQuotasEntity; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type GroupQuotasUpdateResponse = GroupQuotasEntity; + +/** Optional parameters. */ +export interface GroupQuotasGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotasGetResponse = GroupQuotasEntity; + +/** Optional parameters. */ +export interface GroupQuotasDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface GroupQuotasListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotasListResponse = GroupQuotaList; + +/** Optional parameters. */ +export interface GroupQuotasListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotasListNextResponse = GroupQuotaList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type GroupQuotaSubscriptionsCreateOrUpdateResponse = GroupQuotaSubscriptionId; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type GroupQuotaSubscriptionsUpdateResponse = GroupQuotaSubscriptionId; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotaSubscriptionsGetResponse = GroupQuotaSubscriptionId; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotaSubscriptionsListResponse = GroupQuotaSubscriptionIdList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotaSubscriptionsListNextResponse = GroupQuotaSubscriptionIdList; + +/** Optional parameters. */ +export interface SubscriptionRequestsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SubscriptionRequestsListResponse = GroupQuotaSubscriptionIdList; + +/** Optional parameters. */ +export interface SubscriptionRequestsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SubscriptionRequestsGetResponse = GroupQuotaSubscriptionId; + +/** Optional parameters. */ +export interface SubscriptionRequestsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SubscriptionRequestsListNextResponse = GroupQuotaSubscriptionIdList; + +/** Optional parameters. */ +export interface GroupQuotaLimitsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** The GroupQuotaLimit Request. */ + groupQuotaLimitRequest?: GroupQuotaLimit; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type GroupQuotaLimitsCreateOrUpdateResponse = GroupQuotaLimit; + +/** Optional parameters. */ +export interface GroupQuotaLimitsUpdateOptionalParams + extends coreClient.OperationOptions { + /** The GroupQuotaLimit Request. */ + groupQuotaLimitRequest?: GroupQuotaLimit; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type GroupQuotaLimitsUpdateResponse = GroupQuotaLimit; + +/** Optional parameters. */ +export interface GroupQuotaLimitsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotaLimitsGetResponse = GroupQuotaLimit; + +/** Optional parameters. */ +export interface GroupQuotaLimitsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotaLimitsListResponse = GroupQuotaLimitList; + +/** Optional parameters. */ +export interface GroupQuotaLimitsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotaLimitsListNextResponse = GroupQuotaLimitList; + +/** Optional parameters. */ +export interface GroupQuotaLimitsRequestsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotaLimitsRequestsListResponse = SubmittedResourceRequestStatusList; + +/** Optional parameters. */ +export interface GroupQuotaLimitsRequestsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotaLimitsRequestsGetResponse = SubmittedResourceRequestStatus; + +/** Optional parameters. */ +export interface GroupQuotaLimitsRequestsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotaLimitsRequestsListNextResponse = SubmittedResourceRequestStatusList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotaSubscriptionQuotaAllocationListResponse = SubscriptionQuotaAllocationsList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse = SubscriptionQuotaAllocations; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type GroupQuotaSubscriptionQuotaAllocationUpdateResponse = SubscriptionQuotaAllocations; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotaSubscriptionQuotaAllocationGetResponse = SubscriptionQuotaAllocations; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotaSubscriptionQuotaAllocationListNextResponse = SubscriptionQuotaAllocationsList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GroupQuotaSubscriptionQuotaAllocationRequestsGetResponse = SubscriptionQuotaAllocationRequest; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GroupQuotaSubscriptionQuotaAllocationRequestsListResponse = SubscriptionQuotaAllocationRequestList; + +/** Optional parameters. */ +export interface GroupQuotaSubscriptionQuotaAllocationRequestsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GroupQuotaSubscriptionQuotaAllocationRequestsListNextResponse = SubscriptionQuotaAllocationRequestList; + /** Optional parameters. */ export interface UsagesGetOptionalParams extends coreClient.OperationOptions {} @@ -693,22 +1552,7 @@ export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; /** Optional parameters. */ export interface QuotaRequestStatusListNextOptionalParams - extends coreClient.OperationOptions { - /** - * | Field | Supported operators - * |---------------------|------------------------ - * - * |requestSubmitTime | ge, le, eq, gt, lt - * |provisioningState eq {QuotaRequestState} - * |resourceName eq {resourceName} - * - */ - filter?: string; - /** Number of records to return. */ - top?: number; - /** The **Skiptoken** parameter is used only if a previous operation returned a partial result. If a previous response contains a **nextLink** element, its value includes a **skiptoken** parameter that specifies a starting point to use for subsequent calls. */ - skiptoken?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; @@ -730,10 +1574,6 @@ export type QuotaOperationListNextResponse = OperationList; /** Optional parameters. */ export interface AzureQuotaExtensionAPIOptionalParams extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; /** Overrides client endpoint. */ endpoint?: string; } diff --git a/sdk/quota/arm-quota/src/models/mappers.ts b/sdk/quota/arm-quota/src/models/mappers.ts index 77e0c3fb3058..81cd68f0f511 100644 --- a/sdk/quota/arm-quota/src/models/mappers.ts +++ b/sdk/quota/arm-quota/src/models/mappers.ts @@ -8,6 +8,705 @@ import * as coreClient from "@azure/core-client"; +export const GroupQuotasEntityBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotasEntityBase", + modelProperties: { + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + additionalAttributes: { + serializedName: "additionalAttributes", + type: { + name: "Composite", + className: "AdditionalAttributes" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AdditionalAttributes: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AdditionalAttributes", + modelProperties: { + groupId: { + serializedName: "groupId", + type: { + name: "Composite", + className: "GroupingId" + } + }, + environment: { + serializedName: "environment", + type: { + name: "String" + } + } + } + } +}; + +export const GroupingId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupingId", + modelProperties: { + groupingIdType: { + serializedName: "groupingIdType", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const GroupQuotaList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GroupQuotasEntity" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionIdProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionIdProperties", + modelProperties: { + subscriptionId: { + serializedName: "subscriptionId", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionIdList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionIdList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionId" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaDetails", + modelProperties: { + limit: { + serializedName: "limit", + type: { + name: "Number" + } + }, + comment: { + serializedName: "comment", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "GroupQuotaDetailsName" + } + }, + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + }, + availableLimit: { + serializedName: "availableLimit", + readOnly: true, + type: { + name: "Number" + } + }, + assignedToSubscriptions: { + serializedName: "assignedToSubscriptions", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AssignedToSubscription" + } + } + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaDetailsName: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaDetailsName", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AssignedToSubscription: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssignedToSubscription", + modelProperties: { + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + quotaAllocated: { + serializedName: "quotaAllocated", + type: { + name: "Number" + } + } + } + } +}; + +export const GroupQuotaLimitList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaLimitList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GroupQuotaLimit" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SubmittedResourceRequestStatusList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubmittedResourceRequestStatusList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubmittedResourceRequestStatus" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SubmittedResourceRequestStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubmittedResourceRequestStatus", + modelProperties: { + requestedResource: { + serializedName: "requestedResource", + type: { + name: "Composite", + className: "ResourceBaseRequest" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceBaseRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceBaseRequest", + modelProperties: { + resourceName: { + serializedName: "resourceName", + type: { + name: "String" + } + }, + limits: { + serializedName: "limits", + type: { + name: "Number" + } + }, + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionQuotaAllocationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationsList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocations" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionQuotaDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaDetails", + modelProperties: { + limit: { + serializedName: "limit", + readOnly: true, + type: { + name: "Number" + } + }, + nonShareableQuota: { + serializedName: "nonShareableQuota", + readOnly: true, + type: { + name: "Number" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + quotaSources: { + serializedName: "quotaSources", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubscriptionGroupQuotaAssignment" + } + } + } + } + } + } +}; + +export const SubscriptionGroupQuotaAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionGroupQuotaAssignment", + modelProperties: { + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, + quotaAllocated: { + serializedName: "quotaAllocated", + type: { + name: "Number" + } + } + } + } +}; + +export const SubscriptionQuotaAllocationRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationRequestProperties" + } + } + } + } +}; + +export const SubscriptionQuotaAllocationRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationRequestProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + limit: { + serializedName: "limit", + type: { + name: "Number" + } + } + } + } +}; + +export const SubscriptionQuotaAllocationRequestList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationRequestList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocationRequest" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const CurrentUsagesBase: coreClient.CompositeMapper = { type: { name: "Composite", @@ -679,6 +1378,21 @@ export const OperationDisplay: coreClient.CompositeMapper = { } }; +export const BillingAccountId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BillingAccountId", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + export const CommonResourceProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -990,6 +1704,16 @@ export const QuotaRequestSubmitResponse202: coreClient.CompositeMapper = { } }; +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + export const LimitObject: coreClient.CompositeMapper = { serializedName: "LimitValue", type: { @@ -1016,6 +1740,290 @@ export const LimitObject: coreClient.CompositeMapper = { } }; +export const GroupQuotasEntity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotasEntity", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "GroupQuotasEntityBase" + } + } + } + } +}; + +export const GroupQuotaSubscriptionId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionId", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "GroupQuotaSubscriptionIdProperties" + } + } + } + } +}; + +export const GroupQuotaLimit: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaLimit", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "GroupQuotaDetails" + } + } + } + } +}; + +export const SubscriptionQuotaAllocations: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubscriptionQuotaAllocations", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SubscriptionQuotaDetails" + } + } + } + } +}; + +export const GroupQuotasCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotasCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotasUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotasUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionsUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaLimitsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaLimitsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaLimitsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaLimitsUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const GroupQuotaSubscriptionQuotaAllocationUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupQuotaSubscriptionQuotaAllocationUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + export const UsagesGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/quota/arm-quota/src/models/parameters.ts b/sdk/quota/arm-quota/src/models/parameters.ts index 16ad1e6b051d..f0c7b2294107 100644 --- a/sdk/quota/arm-quota/src/models/parameters.ts +++ b/sdk/quota/arm-quota/src/models/parameters.ts @@ -11,7 +11,29 @@ import { OperationURLParameter, OperationQueryParameter } from "@azure/core-client"; -import { CurrentQuotaLimitBase as CurrentQuotaLimitBaseMapper } from "../models/mappers"; +import { + GroupQuotasEntity as GroupQuotasEntityMapper, + GroupQuotaLimit as GroupQuotaLimitMapper, + SubscriptionQuotaAllocations as SubscriptionQuotaAllocationsMapper, + CurrentQuotaLimitBase as CurrentQuotaLimitBaseMapper +} from "../models/mappers"; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const groupQuotaPutRequestBody: OperationParameter = { + parameterPath: ["options", "groupQuotaPutRequestBody"], + mapper: GroupQuotasEntityMapper +}; export const accept: OperationParameter = { parameterPath: "accept", @@ -37,10 +59,30 @@ export const $host: OperationURLParameter = { skipEncoding: true }; -export const resourceName: OperationURLParameter = { - parameterPath: "resourceName", +export const mgId: OperationURLParameter = { + parameterPath: "mgId", mapper: { - serializedName: "resourceName", + constraints: { + MaxLength: 63, + MinLength: 3 + }, + serializedName: "mgId", + required: true, + type: { + name: "String" + } + } +}; + +export const groupQuotaName: OperationURLParameter = { + parameterPath: "groupQuotaName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z][a-z0-9]*$"), + MaxLength: 63, + MinLength: 3 + }, + serializedName: "groupQuotaName", required: true, type: { name: "String" @@ -51,7 +93,7 @@ export const resourceName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-03-15-preview", + defaultValue: "2023-06-01-preview", isConstant: true, serializedName: "api-version", type: { @@ -60,10 +102,15 @@ export const apiVersion: OperationQueryParameter = { } }; -export const scope: OperationURLParameter = { - parameterPath: "scope", +export const groupQuotasPatchRequestBody: OperationParameter = { + parameterPath: ["options", "groupQuotasPatchRequestBody"], + mapper: GroupQuotasEntityMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { - serializedName: "scope", + serializedName: "nextLink", required: true, type: { name: "String" @@ -72,30 +119,111 @@ export const scope: OperationURLParameter = { skipEncoding: true }; -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { - serializedName: "nextLink", + serializedName: "subscriptionId", + required: true, + type: { + name: "Uuid" + } + } +}; + +export const requestId: OperationURLParameter = { + parameterPath: "requestId", + mapper: { + serializedName: "requestId", required: true, type: { name: "String" } - }, - skipEncoding: true + } }; -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], +export const groupQuotaLimitRequest: OperationParameter = { + parameterPath: ["options", "groupQuotaLimitRequest"], + mapper: GroupQuotaLimitMapper +}; + +export const resourceProviderScope: OperationURLParameter = { + parameterPath: "resourceProviderScope", mapper: { - defaultValue: "application/json", + serializedName: "resourceProviderScope", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z][a-z0-9]*$"), + MaxLength: 63, + MinLength: 3 + }, + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const allocateQuotaRequest: OperationParameter = { + parameterPath: "allocateQuotaRequest", + mapper: SubscriptionQuotaAllocationsMapper +}; + +export const allocationId: OperationURLParameter = { + parameterPath: "allocationId", + mapper: { + serializedName: "allocationId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceName1: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion1: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2023-02-01", isConstant: true, - serializedName: "Content-Type", + serializedName: "api-version", type: { name: "String" } } }; +export const scope: OperationURLParameter = { + parameterPath: "scope", + mapper: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + export const createQuotaRequest: OperationParameter = { parameterPath: "createQuotaRequest", mapper: CurrentQuotaLimitBaseMapper diff --git a/sdk/quota/arm-quota/src/operations/groupQuotaLimits.ts b/sdk/quota/arm-quota/src/operations/groupQuotaLimits.ts new file mode 100644 index 000000000000..1b19492f2290 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotaLimits.ts @@ -0,0 +1,630 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotaLimits } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + GroupQuotaLimit, + GroupQuotaLimitsListNextOptionalParams, + GroupQuotaLimitsListOptionalParams, + GroupQuotaLimitsListResponse, + GroupQuotaLimitsCreateOrUpdateOptionalParams, + GroupQuotaLimitsCreateOrUpdateResponse, + GroupQuotaLimitsUpdateOptionalParams, + GroupQuotaLimitsUpdateResponse, + GroupQuotaLimitsGetOptionalParams, + GroupQuotaLimitsGetResponse, + GroupQuotaLimitsListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotaLimits operations. */ +export class GroupQuotaLimitsImpl implements GroupQuotaLimits { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotaLimits class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/. The list elements will be same as the Get API - It + * will include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions + * from the groupQuota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + mgId, + resourceProviderScope, + groupQuotaName, + 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.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotaLimitsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + mgId, + resourceProviderScope, + groupQuotaName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + resourceProviderScope, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status can be polled periodically. The + * status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaLimitsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaLimitsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status can be polled periodically. The + * status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status will be updated periodically. + * The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + async beginUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaLimitsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaLimitsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status will be updated periodically. + * The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + async beginUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, resourceName, options }, + getOperationSpec + ); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/. The list elements will be same as the Get API - It + * will include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions + * from the groupQuota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + nextLink: string, + options?: GroupQuotaLimitsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 201: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 202: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 204: { + bodyMapper: Mappers.GroupQuotaLimit + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.groupQuotaLimitRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 201: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 202: { + bodyMapper: Mappers.GroupQuotaLimit + }, + 204: { + bodyMapper: Mappers.GroupQuotaLimit + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.groupQuotaLimitRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaLimit + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaLimitList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaLimitList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/groupQuotaLimitsRequests.ts b/sdk/quota/arm-quota/src/operations/groupQuotaLimitsRequests.ts new file mode 100644 index 000000000000..16563d774f3b --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotaLimitsRequests.ts @@ -0,0 +1,290 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotaLimitsRequests } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SubmittedResourceRequestStatus, + GroupQuotaLimitsRequestsListNextOptionalParams, + GroupQuotaLimitsRequestsListOptionalParams, + GroupQuotaLimitsRequestsListResponse, + GroupQuotaLimitsRequestsGetOptionalParams, + GroupQuotaLimitsRequestsGetResponse, + GroupQuotaLimitsRequestsListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotaLimitsRequests operations. */ +export class GroupQuotaLimitsRequestsImpl implements GroupQuotaLimitsRequests { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotaLimitsRequests class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsRequestsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + mgId, + resourceProviderScope, + groupQuotaName, + 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.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsRequestsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotaLimitsRequestsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + mgId, + resourceProviderScope, + groupQuotaName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + resourceProviderScope, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsRequestsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsRequestsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * Get API to check the status of a GroupQuota request by requestId. Use the polling API - + * OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in + * seconds to check the intermediate status. This API provides the finals status with the request + * details and status. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param requestId Request Id. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + requestId: string, + options?: GroupQuotaLimitsRequestsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, requestId, options }, + getOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + nextLink: string, + options?: GroupQuotaLimitsRequestsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubmittedResourceRequestStatusList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubmittedResourceRequestStatus + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.requestId, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubmittedResourceRequestStatusList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocation.ts b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocation.ts new file mode 100644 index 000000000000..c8ea0e32d8f1 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocation.ts @@ -0,0 +1,645 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotaSubscriptionQuotaAllocation } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + SubscriptionQuotaAllocations, + GroupQuotaSubscriptionQuotaAllocationListNextOptionalParams, + GroupQuotaSubscriptionQuotaAllocationListOptionalParams, + GroupQuotaSubscriptionQuotaAllocationListResponse, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse, + GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams, + GroupQuotaSubscriptionQuotaAllocationUpdateResponse, + GroupQuotaSubscriptionQuotaAllocationGetOptionalParams, + GroupQuotaSubscriptionQuotaAllocationGetResponse, + GroupQuotaSubscriptionQuotaAllocationListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotaSubscriptionQuotaAllocation operations. */ +export class GroupQuotaSubscriptionQuotaAllocationImpl + implements GroupQuotaSubscriptionQuotaAllocation { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotaSubscriptionQuotaAllocation class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This + * will include the GroupQuota and total quota assigned to the subscription. Only the Group quota + * assigned to the subscription can be assigned back to the MG Group Quota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + mgId, + resourceProviderScope, + groupQuotaName, + 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.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotaSubscriptionQuotaAllocationListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + mgId, + resourceProviderScope, + groupQuotaName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + resourceProviderScope, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This + * will include the GroupQuota and total quota assigned to the subscription. Only the Group quota + * assigned to the subscription can be assigned back to the MG Group Quota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * Request to assign a specific resource quota from group quota to a specific Subscription. The + * subscriptions can also reduce the quota assigned to subscription to give back the group back to MG. + * The quota assignment back to MG groupQuota is limited by the GroupQuota assigned to subscription, + * which means the maximum unused quota assigned back to MG groupQuota will be the groupQuota assigned + * to the subscriptions. So, this API can used to assign Quota to subscriptions and assign back unused + * quota, which was previously assigned from MG groupQuota to subscription. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState< + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + >, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + allocateQuotaRequest, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse, + OperationState< + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + > + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Request to assign a specific resource quota from group quota to a specific Subscription. The + * subscriptions can also reduce the quota assigned to subscription to give back the group back to MG. + * The quota assignment back to MG groupQuota is limited by the GroupQuota assigned to subscription, + * which means the maximum unused quota assigned back to MG groupQuota will be the groupQuota assigned + * to the subscriptions. So, this API can used to assign Quota to subscriptions and assign back unused + * quota, which was previously assigned from MG groupQuota to subscription. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + allocateQuotaRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce + * the quota assigned to subscription to give back the group back to MG. The quota assignment back to + * MG groupQuota is limited by the GroupQuota assigned to subscription, using this API. So, this API + * can used to assign Quota to subscriptions and assign back unused quota, which was previously + * assigned from MG groupQuota to subscription(s). + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + async beginUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionQuotaAllocationUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + allocateQuotaRequest, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaSubscriptionQuotaAllocationUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce + * the quota assigned to subscription to give back the group back to MG. The quota assignment back to + * MG groupQuota is limited by the GroupQuota assigned to subscription, using this API. So, this API + * can used to assign Quota to subscriptions and assign back unused quota, which was previously + * assigned from MG groupQuota to subscription(s). + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + async beginUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + allocateQuotaRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * This will include the GroupQuota and total quota assigned to the subscription. Only the Group quota + * assigned to the subscription can be assigned back to the MG Group Quota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaSubscriptionQuotaAllocationGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, resourceName, options }, + getOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + nextLink: string, + options?: GroupQuotaSubscriptionQuotaAllocationListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 201: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 202: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 204: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.allocateQuotaRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 201: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 202: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + 204: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.allocateQuotaRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocations + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocationRequests.ts b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocationRequests.ts new file mode 100644 index 000000000000..476dd564bbd9 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptionQuotaAllocationRequests.ts @@ -0,0 +1,289 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotaSubscriptionQuotaAllocationRequests } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SubscriptionQuotaAllocationRequest, + GroupQuotaSubscriptionQuotaAllocationRequestsListNextOptionalParams, + GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams, + GroupQuotaSubscriptionQuotaAllocationRequestsListResponse, + GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams, + GroupQuotaSubscriptionQuotaAllocationRequestsGetResponse, + GroupQuotaSubscriptionQuotaAllocationRequestsListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotaSubscriptionQuotaAllocationRequests operations. */ +export class GroupQuotaSubscriptionQuotaAllocationRequestsImpl + implements GroupQuotaSubscriptionQuotaAllocationRequests { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotaSubscriptionQuotaAllocationRequests class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * Lists all the allocation requests. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + mgId, + resourceProviderScope, + groupQuotaName, + 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.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotaSubscriptionQuotaAllocationRequestsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + mgId, + resourceProviderScope, + groupQuotaName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + resourceProviderScope, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + resourceProviderScope, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * Get the quota allocation request status for the subscriptionId by allocationId. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param allocationId Resource allocation Id. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + allocationId: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, allocationId, options }, + getOperationSpec + ); + } + + /** + * Lists all the allocation requests. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + nextLink: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, resourceProviderScope, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocationRequest + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope, + Parameters.allocationId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocationRequestList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SubscriptionQuotaAllocationRequestList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceProviderScope + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptions.ts b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptions.ts new file mode 100644 index 000000000000..d3f23a353781 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotaSubscriptions.ts @@ -0,0 +1,521 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotaSubscriptions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + GroupQuotaSubscriptionId, + GroupQuotaSubscriptionsListNextOptionalParams, + GroupQuotaSubscriptionsListOptionalParams, + GroupQuotaSubscriptionsListResponse, + GroupQuotaSubscriptionsCreateOrUpdateOptionalParams, + GroupQuotaSubscriptionsCreateOrUpdateResponse, + GroupQuotaSubscriptionsUpdateOptionalParams, + GroupQuotaSubscriptionsUpdateResponse, + GroupQuotaSubscriptionsDeleteOptionalParams, + GroupQuotaSubscriptionsGetOptionalParams, + GroupQuotaSubscriptionsGetResponse, + GroupQuotaSubscriptionsListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotaSubscriptions operations. */ +export class GroupQuotaSubscriptionsImpl implements GroupQuotaSubscriptions { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotaSubscriptions class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(mgId, groupQuotaName, 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.listPagingPage(mgId, groupQuotaName, options, settings); + } + }; + } + + private async *listPagingPage( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotaSubscriptionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(mgId, groupQuotaName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * Adds a subscription to GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { mgId, groupQuotaName, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaSubscriptionsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Adds a subscription to GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + mgId, + groupQuotaName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { mgId, groupQuotaName, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotaSubscriptionsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate(mgId, groupQuotaName, options); + return poller.pollUntilDone(); + } + + /** + * Removes the subscription from GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + delete( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + deleteOperationSpec + ); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the + * GroupQuotasEntity. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + getOperationSpec + ); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + groupQuotaName: string, + nextLink: string, + options?: GroupQuotaSubscriptionsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 201: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 202: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 204: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 201: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 202: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + 204: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionIdList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionIdList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/groupQuotas.ts b/sdk/quota/arm-quota/src/operations/groupQuotas.ts new file mode 100644 index 000000000000..bc71c54fb12c --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/groupQuotas.ts @@ -0,0 +1,509 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { GroupQuotas } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + GroupQuotasEntity, + GroupQuotasListNextOptionalParams, + GroupQuotasListOptionalParams, + GroupQuotasListResponse, + GroupQuotasCreateOrUpdateOptionalParams, + GroupQuotasCreateOrUpdateResponse, + GroupQuotasUpdateOptionalParams, + GroupQuotasUpdateResponse, + GroupQuotasGetOptionalParams, + GroupQuotasGetResponse, + GroupQuotasDeleteOptionalParams, + GroupQuotasListNextResponse +} from "../models"; + +/// +/** Class containing GroupQuotas operations. */ +export class GroupQuotasImpl implements GroupQuotas { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class GroupQuotas class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties + * only.The details on groupQuota can be access from the groupQuota APIs. + * @param mgId Management Group Id. + * @param options The options parameters. + */ + public list( + mgId: string, + options?: GroupQuotasListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(mgId, 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.listPagingPage(mgId, options, settings); + } + }; + } + + private async *listPagingPage( + mgId: string, + options?: GroupQuotasListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: GroupQuotasListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(mgId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(mgId, continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + options?: GroupQuotasListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(mgId, options)) { + yield* page; + } + } + + /** + * Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotasCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { mgId, groupQuotaName, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotasCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + mgId, + groupQuotaName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the + * Service. The status can be polled periodically. The status Async polling is using standards defined + * at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * Any change in the filters will be applicable to the future quota assignments, existing quota + * assigned to subscriptions from the GroupQuotas remains unchanged. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotasUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { mgId, groupQuotaName, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + GroupQuotasUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the + * Service. The status can be polled periodically. The status Async polling is using standards defined + * at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * Any change in the filters will be applicable to the future quota assignments, existing quota + * assigned to subscriptions from the GroupQuotas remains unchanged. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + async beginUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate(mgId, groupQuotaName, options); + return poller.pollUntilDone(); + } + + /** + * Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The + * details on groupQuota can be access from the groupQuota APIs. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + getOperationSpec + ); + } + + /** + * Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be + * lost. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + delete( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + deleteOperationSpec + ); + } + + /** + * Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties + * only.The details on groupQuota can be access from the groupQuota APIs. + * @param mgId Management Group Id. + * @param options The options parameters. + */ + private _list( + mgId: string, + options?: GroupQuotasListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + nextLink: string, + options?: GroupQuotasListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 201: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 202: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 204: { + bodyMapper: Mappers.GroupQuotasEntity + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.groupQuotaPutRequestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 201: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 202: { + bodyMapper: Mappers.GroupQuotasEntity + }, + 204: { + bodyMapper: Mappers.GroupQuotasEntity + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.groupQuotasPatchRequestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotasEntity + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/index.ts b/sdk/quota/arm-quota/src/operations/index.ts index 3c991fd4c4fa..4b69bc1ccf3b 100644 --- a/sdk/quota/arm-quota/src/operations/index.ts +++ b/sdk/quota/arm-quota/src/operations/index.ts @@ -6,6 +6,13 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +export * from "./groupQuotas"; +export * from "./groupQuotaSubscriptions"; +export * from "./subscriptionRequests"; +export * from "./groupQuotaLimits"; +export * from "./groupQuotaLimitsRequests"; +export * from "./groupQuotaSubscriptionQuotaAllocation"; +export * from "./groupQuotaSubscriptionQuotaAllocationRequests"; export * from "./usages"; export * from "./quota"; export * from "./quotaRequestStatus"; diff --git a/sdk/quota/arm-quota/src/operations/quota.ts b/sdk/quota/arm-quota/src/operations/quota.ts index 5b39907e90bb..cc7000f42d31 100644 --- a/sdk/quota/arm-quota/src/operations/quota.ts +++ b/sdk/quota/arm-quota/src/operations/quota.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { CurrentQuotaLimitBase, QuotaListNextOptionalParams, @@ -156,8 +160,8 @@ export class QuotaImpl implements Quota { createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, QuotaCreateOrUpdateResponse > > { @@ -167,7 +171,7 @@ export class QuotaImpl implements Quota { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -200,15 +204,18 @@ export class QuotaImpl implements Quota { }; }; - const lro = new LroImpl( - sendOperation, - { resourceName, scope, createQuotaRequest, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceName, scope, createQuotaRequest, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + QuotaCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "original-uri" }); await poller.poll(); return poller; @@ -274,7 +281,7 @@ export class QuotaImpl implements Quota { createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams ): Promise< - PollerLike, QuotaUpdateResponse> + SimplePollerLike, QuotaUpdateResponse> > { const directSendOperation = async ( args: coreClient.OperationArguments, @@ -282,7 +289,7 @@ export class QuotaImpl implements Quota { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -315,15 +322,18 @@ export class QuotaImpl implements Quota { }; }; - const lro = new LroImpl( - sendOperation, - { resourceName, scope, createQuotaRequest, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceName, scope, createQuotaRequest, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + QuotaUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "original-uri" }); await poller.poll(); return poller; @@ -419,8 +429,8 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.resourceName, Parameters.scope], + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.$host, Parameters.resourceName1, Parameters.scope], headerParameters: [Parameters.accept], serializer }; @@ -445,9 +455,9 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.createQuotaRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.resourceName, Parameters.scope], - headerParameters: [Parameters.accept, Parameters.contentType], + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.$host, Parameters.resourceName1, Parameters.scope], + headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer }; @@ -472,9 +482,9 @@ const updateOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.createQuotaRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.resourceName, Parameters.scope], - headerParameters: [Parameters.accept, Parameters.contentType], + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.$host, Parameters.resourceName1, Parameters.scope], + headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer }; @@ -490,7 +500,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.scope], headerParameters: [Parameters.accept], serializer @@ -507,8 +517,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/quota/arm-quota/src/operations/quotaOperation.ts b/sdk/quota/arm-quota/src/operations/quotaOperation.ts index 16e8d8ab3778..350ca58faa63 100644 --- a/sdk/quota/arm-quota/src/operations/quotaOperation.ts +++ b/sdk/quota/arm-quota/src/operations/quotaOperation.ts @@ -127,7 +127,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host], headerParameters: [Parameters.accept], serializer @@ -143,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts b/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts index 5892235f72d9..fa81696db2fd 100644 --- a/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts +++ b/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts @@ -177,7 +177,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.scope, Parameters.id], headerParameters: [Parameters.accept], serializer @@ -194,7 +194,7 @@ const listOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [ - Parameters.apiVersion, + Parameters.apiVersion1, Parameters.filter, Parameters.top, Parameters.skiptoken @@ -214,13 +214,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skiptoken - ], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/quota/arm-quota/src/operations/subscriptionRequests.ts b/sdk/quota/arm-quota/src/operations/subscriptionRequests.ts new file mode 100644 index 000000000000..a3000b8fb420 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/subscriptionRequests.ts @@ -0,0 +1,235 @@ +/* + * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { SubscriptionRequests } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPI } from "../azureQuotaExtensionAPI"; +import { + GroupQuotaSubscriptionId, + SubscriptionRequestsListNextOptionalParams, + SubscriptionRequestsListOptionalParams, + SubscriptionRequestsListResponse, + SubscriptionRequestsGetOptionalParams, + SubscriptionRequestsGetResponse, + SubscriptionRequestsListNextResponse +} from "../models"; + +/// +/** Class containing SubscriptionRequests operations. */ +export class SubscriptionRequestsImpl implements SubscriptionRequests { + private readonly client: AzureQuotaExtensionAPI; + + /** + * Initialize a new instance of the class SubscriptionRequests class. + * @param client Reference to the service client + */ + constructor(client: AzureQuotaExtensionAPI) { + this.client = client; + } + + /** + * List API to check the status of a subscriptionId requests by requestId. Request history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + public list( + mgId: string, + groupQuotaName: string, + options?: SubscriptionRequestsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(mgId, groupQuotaName, 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.listPagingPage(mgId, groupQuotaName, options, settings); + } + }; + } + + private async *listPagingPage( + mgId: string, + groupQuotaName: string, + options?: SubscriptionRequestsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: SubscriptionRequestsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(mgId, groupQuotaName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + mgId, + groupQuotaName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + mgId: string, + groupQuotaName: string, + options?: SubscriptionRequestsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + mgId, + groupQuotaName, + options + )) { + yield* page; + } + } + + /** + * List API to check the status of a subscriptionId requests by requestId. Request history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + private _list( + mgId: string, + groupQuotaName: string, + options?: SubscriptionRequestsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, options }, + listOperationSpec + ); + } + + /** + * Get API to check the status of a subscriptionIds request by requestId. Use the polling API - + * OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in + * seconds to check the intermediate status. This API provides the finals status with the request + * details and status. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param requestId Request Id. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + requestId: string, + options?: SubscriptionRequestsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, requestId, options }, + getOperationSpec + ); + } + + /** + * ListNext + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + mgId: string, + groupQuotaName: string, + nextLink: string, + options?: SubscriptionRequestsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mgId, groupQuotaName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionIdList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.mgId, Parameters.groupQuotaName], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.requestId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupQuotaSubscriptionIdList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.mgId, + Parameters.groupQuotaName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/usages.ts b/sdk/quota/arm-quota/src/operations/usages.ts index b4c6aa66c570..6928d2091977 100644 --- a/sdk/quota/arm-quota/src/operations/usages.ts +++ b/sdk/quota/arm-quota/src/operations/usages.ts @@ -177,8 +177,8 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.resourceName, Parameters.scope], + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.$host, Parameters.resourceName1, Parameters.scope], headerParameters: [Parameters.accept], serializer }; @@ -194,7 +194,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.scope], headerParameters: [Parameters.accept], serializer @@ -211,8 +211,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.nextLink], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimits.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimits.ts new file mode 100644 index 000000000000..3e43fb168341 --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimits.ts @@ -0,0 +1,187 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + GroupQuotaLimit, + GroupQuotaLimitsListOptionalParams, + GroupQuotaLimitsCreateOrUpdateOptionalParams, + GroupQuotaLimitsCreateOrUpdateResponse, + GroupQuotaLimitsUpdateOptionalParams, + GroupQuotaLimitsUpdateResponse, + GroupQuotaLimitsGetOptionalParams, + GroupQuotaLimitsGetResponse +} from "../models"; + +/// +/** Interface representing a GroupQuotaLimits. */ +export interface GroupQuotaLimits { + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/. The list elements will be same as the Get API - It + * will include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions + * from the groupQuota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status can be polled periodically. The + * status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + beginCreateOrUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaLimitsCreateOrUpdateResponse + > + >; + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status can be polled periodically. The + * status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status will be updated periodically. + * The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + beginUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaLimitsUpdateResponse + > + >; + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. A + * groupQuotaLimitRequestId will be returned by the Service. The status will be updated periodically. + * The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + beginUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsUpdateOptionalParams + ): Promise; + /** + * Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaLimitsGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimitsRequests.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimitsRequests.ts new file mode 100644 index 000000000000..86da62886eff --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaLimitsRequests.ts @@ -0,0 +1,64 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + SubmittedResourceRequestStatus, + GroupQuotaLimitsRequestsListOptionalParams, + GroupQuotaLimitsRequestsGetOptionalParams, + GroupQuotaLimitsRequestsGetResponse +} from "../models"; + +/// +/** Interface representing a GroupQuotaLimitsRequests. */ +export interface GroupQuotaLimitsRequests { + /** + * List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaLimitsRequestsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get API to check the status of a GroupQuota request by requestId. Use the polling API - + * OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in + * seconds to check the intermediate status. This API provides the finals status with the request + * details and status. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param requestId Request Id. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + requestId: string, + options?: GroupQuotaLimitsRequestsGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocation.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocation.ts new file mode 100644 index 000000000000..b4cc70af0b57 --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocation.ts @@ -0,0 +1,191 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + SubscriptionQuotaAllocations, + GroupQuotaSubscriptionQuotaAllocationListOptionalParams, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse, + GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams, + GroupQuotaSubscriptionQuotaAllocationUpdateResponse, + GroupQuotaSubscriptionQuotaAllocationGetOptionalParams, + GroupQuotaSubscriptionQuotaAllocationGetResponse +} from "../models"; + +/// +/** Interface representing a GroupQuotaSubscriptionQuotaAllocation. */ +export interface GroupQuotaSubscriptionQuotaAllocation { + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This + * will include the GroupQuota and total quota assigned to the subscription. Only the Group quota + * assigned to the subscription can be assigned back to the MG Group Quota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Request to assign a specific resource quota from group quota to a specific Subscription. The + * subscriptions can also reduce the quota assigned to subscription to give back the group back to MG. + * The quota assignment back to MG groupQuota is limited by the GroupQuota assigned to subscription, + * which means the maximum unused quota assigned back to MG groupQuota will be the groupQuota assigned + * to the subscriptions. So, this API can used to assign Quota to subscriptions and assign back unused + * quota, which was previously assigned from MG groupQuota to subscription. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState< + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + >, + GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateResponse + > + >; + /** + * Request to assign a specific resource quota from group quota to a specific Subscription. The + * subscriptions can also reduce the quota assigned to subscription to give back the group back to MG. + * The quota assignment back to MG groupQuota is limited by the GroupQuota assigned to subscription, + * which means the maximum unused quota assigned back to MG groupQuota will be the groupQuota assigned + * to the subscriptions. So, this API can used to assign Quota to subscriptions and assign back unused + * quota, which was previously assigned from MG groupQuota to subscription. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateOptionalParams + ): Promise; + /** + * Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce + * the quota assigned to subscription to give back the group back to MG. The quota assignment back to + * MG groupQuota is limited by the GroupQuota assigned to subscription, using this API. So, this API + * can used to assign Quota to subscriptions and assign back unused quota, which was previously + * assigned from MG groupQuota to subscription(s). + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginUpdate( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionQuotaAllocationUpdateResponse + > + >; + /** + * Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce + * the quota assigned to subscription to give back the group back to MG. The quota assignment back to + * MG groupQuota is limited by the GroupQuota assigned to subscription, using this API. So, this API + * can used to assign Quota to subscriptions and assign back unused quota, which was previously + * assigned from MG groupQuota to subscription(s). + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginUpdateAndWait( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + allocateQuotaRequest: SubscriptionQuotaAllocations, + options?: GroupQuotaSubscriptionQuotaAllocationUpdateOptionalParams + ): Promise; + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * This will include the GroupQuota and total quota assigned to the subscription. Only the Group quota + * assigned to the subscription can be assigned back to the MG Group Quota. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param resourceName Resource name. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + resourceName: string, + options?: GroupQuotaSubscriptionQuotaAllocationGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocationRequests.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocationRequests.ts new file mode 100644 index 000000000000..45447fa439c7 --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptionQuotaAllocationRequests.ts @@ -0,0 +1,60 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + SubscriptionQuotaAllocationRequest, + GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams, + GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams, + GroupQuotaSubscriptionQuotaAllocationRequestsGetResponse +} from "../models"; + +/// +/** Interface representing a GroupQuotaSubscriptionQuotaAllocationRequests. */ +export interface GroupQuotaSubscriptionQuotaAllocationRequests { + /** + * Lists all the allocation requests. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the quota allocation request status for the subscriptionId by allocationId. + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location + * parameter, such as CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires + * batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension + * enables to specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param allocationId Resource allocation Id. + * @param options The options parameters. + */ + get( + mgId: string, + resourceProviderScope: string, + groupQuotaName: string, + allocationId: string, + options?: GroupQuotaSubscriptionQuotaAllocationRequestsGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptions.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptions.ts new file mode 100644 index 000000000000..23d67c16b90b --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotaSubscriptions.ts @@ -0,0 +1,121 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + GroupQuotaSubscriptionId, + GroupQuotaSubscriptionsListOptionalParams, + GroupQuotaSubscriptionsCreateOrUpdateOptionalParams, + GroupQuotaSubscriptionsCreateOrUpdateResponse, + GroupQuotaSubscriptionsUpdateOptionalParams, + GroupQuotaSubscriptionsUpdateResponse, + GroupQuotaSubscriptionsDeleteOptionalParams, + GroupQuotaSubscriptionsGetOptionalParams, + GroupQuotaSubscriptionsGetResponse +} from "../models"; + +/// +/** Interface representing a GroupQuotaSubscriptions. */ +export interface GroupQuotaSubscriptions { + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Adds a subscription to GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginCreateOrUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionsCreateOrUpdateResponse + > + >; + /** + * Adds a subscription to GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotaSubscriptionsUpdateResponse + > + >; + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsUpdateOptionalParams + ): Promise; + /** + * Removes the subscription from GroupQuotas. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + delete( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsDeleteOptionalParams + ): Promise; + /** + * Returns the subscriptionId along with its provisioning state for being associated with the + * GroupQuotasEntity. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + options?: GroupQuotaSubscriptionsGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotas.ts b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotas.ts new file mode 100644 index 000000000000..1292b18d7aae --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/groupQuotas.ts @@ -0,0 +1,146 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + GroupQuotasEntity, + GroupQuotasListOptionalParams, + GroupQuotasCreateOrUpdateOptionalParams, + GroupQuotasCreateOrUpdateResponse, + GroupQuotasUpdateOptionalParams, + GroupQuotasUpdateResponse, + GroupQuotasGetOptionalParams, + GroupQuotasGetResponse, + GroupQuotasDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a GroupQuotas. */ +export interface GroupQuotas { + /** + * Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties + * only.The details on groupQuota can be access from the groupQuota APIs. + * @param mgId Management Group Id. + * @param options The options parameters. + */ + list( + mgId: string, + options?: GroupQuotasListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginCreateOrUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotasCreateOrUpdateResponse + > + >; + /** + * Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the + * Service. The status can be polled periodically. The status Async polling is using standards defined + * at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * Any change in the filters will be applicable to the future quota assignments, existing quota + * assigned to subscriptions from the GroupQuotas remains unchanged. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginUpdate( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + GroupQuotasUpdateResponse + > + >; + /** + * Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the + * Service. The status can be polled periodically. The status Async polling is using standards defined + * at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified + * in retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI + * will change to Get URI and full details can be checked. + * Any change in the filters will be applicable to the future quota assignments, existing quota + * assigned to subscriptions from the GroupQuotas remains unchanged. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + beginUpdateAndWait( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasUpdateOptionalParams + ): Promise; + /** + * Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The + * details on groupQuota can be access from the groupQuota APIs. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasGetOptionalParams + ): Promise; + /** + * Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be + * lost. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + delete( + mgId: string, + groupQuotaName: string, + options?: GroupQuotasDeleteOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/index.ts b/sdk/quota/arm-quota/src/operationsInterfaces/index.ts index 3c991fd4c4fa..4b69bc1ccf3b 100644 --- a/sdk/quota/arm-quota/src/operationsInterfaces/index.ts +++ b/sdk/quota/arm-quota/src/operationsInterfaces/index.ts @@ -6,6 +6,13 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +export * from "./groupQuotas"; +export * from "./groupQuotaSubscriptions"; +export * from "./subscriptionRequests"; +export * from "./groupQuotaLimits"; +export * from "./groupQuotaLimitsRequests"; +export * from "./groupQuotaSubscriptionQuotaAllocation"; +export * from "./groupQuotaSubscriptionQuotaAllocationRequests"; export * from "./usages"; export * from "./quota"; export * from "./quotaRequestStatus"; diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/quota.ts b/sdk/quota/arm-quota/src/operationsInterfaces/quota.ts index 0818e76ebfa2..4b3e1104770c 100644 --- a/sdk/quota/arm-quota/src/operationsInterfaces/quota.ts +++ b/sdk/quota/arm-quota/src/operationsInterfaces/quota.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { CurrentQuotaLimitBase, QuotaListOptionalParams, @@ -81,8 +81,8 @@ export interface Quota { createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, QuotaCreateOrUpdateResponse > >; @@ -137,7 +137,7 @@ export interface Quota { createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams ): Promise< - PollerLike, QuotaUpdateResponse> + SimplePollerLike, QuotaUpdateResponse> >; /** * Update the quota limit for a specific resource to the specified value: diff --git a/sdk/quota/arm-quota/src/operationsInterfaces/subscriptionRequests.ts b/sdk/quota/arm-quota/src/operationsInterfaces/subscriptionRequests.ts new file mode 100644 index 000000000000..ff2c90ef6665 --- /dev/null +++ b/sdk/quota/arm-quota/src/operationsInterfaces/subscriptionRequests.ts @@ -0,0 +1,50 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GroupQuotaSubscriptionId, + SubscriptionRequestsListOptionalParams, + SubscriptionRequestsGetOptionalParams, + SubscriptionRequestsGetResponse +} from "../models"; + +/// +/** Interface representing a SubscriptionRequests. */ +export interface SubscriptionRequests { + /** + * List API to check the status of a subscriptionId requests by requestId. Request history is + * maintained for 1 year. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param options The options parameters. + */ + list( + mgId: string, + groupQuotaName: string, + options?: SubscriptionRequestsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get API to check the status of a subscriptionIds request by requestId. Use the polling API - + * OperationsStatus URI specified in Azure-AsyncOperation header field, with retry-after duration in + * seconds to check the intermediate status. This API provides the finals status with the request + * details and status. + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context + * tenantId/MgId. + * @param requestId Request Id. + * @param options The options parameters. + */ + get( + mgId: string, + groupQuotaName: string, + requestId: string, + options?: SubscriptionRequestsGetOptionalParams + ): Promise; +} diff --git a/sdk/quota/arm-quota/src/pagingHelper.ts b/sdk/quota/arm-quota/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/quota/arm-quota/src/pagingHelper.ts +++ b/sdk/quota/arm-quota/src/pagingHelper.ts @@ -13,11 +13,11 @@ export interface PageInfo { const pageMap = new WeakMap(); /** - * Given a result page from a pageable operation, returns a - * continuation token that can be used to begin paging from + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from * that point later. - * @param page A result object from calling .byPage() on a paged operation. - * @returns The continuation token that can be passed into byPage(). + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. */ export function getContinuationToken(page: unknown): string | undefined { if (typeof page !== "object" || page === null) { diff --git a/sdk/quota/arm-quota/test/sampleTest.ts b/sdk/quota/arm-quota/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/quota/arm-quota/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/quota/arm-quota/tsconfig.json b/sdk/quota/arm-quota/tsconfig.json index 32291f85971b..3e6ae96443f3 100644 --- a/sdk/quota/arm-quota/tsconfig.json +++ b/sdk/quota/arm-quota/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-quota": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"