diff --git a/sdk/quota/arm-quota/LICENSE.txt b/sdk/quota/arm-quota/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/quota/arm-quota/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/quota/arm-quota/README.md b/sdk/quota/arm-quota/README.md new file mode 100644 index 000000000000..13d59ea74d19 --- /dev/null +++ b/sdk/quota/arm-quota/README.md @@ -0,0 +1,110 @@ +## Azure AzureQuotaExtensionAPI SDK for JavaScript + +This package contains an isomorphic SDK (runs both in node.js and in browsers) for AzureQuotaExtensionAPI. + +### Currently supported environments + +- Node.js version 8.x.x or higher +- Browser JavaScript + +### Prerequisites + +You must have an [Azure subscription](https://azure.microsoft.com/free/). + +### How to install + +To use this SDK in your project, you will need to install two packages. +- `@azure/arm-quota` that contains the client. +- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. + +Install both packages using the below command: +```bash +npm install --save @azure/arm-quota @azure/identity +``` +> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. +If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. + +### How to use + +- If you are writing a client side browser application, + - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. + - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. +- If you are writing a server side application, + - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) + - Complete the set up steps required by the credential if any. + - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. + +In the below samples, we pass the credential and the Azure subscription id to instantiate the client. +Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +#### nodejs - Authentication, client creation, and get quota as an example written in JavaScript. + +##### Sample code + +```javascript +const { DefaultAzureCredential } = require("@azure/identity"); +const { AzureQuotaExtensionAPI } = require("@azure/arm-quota"); +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples +// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. +const creds = new DefaultAzureCredential(); +const client = new AzureQuotaExtensionAPI(creds, subscriptionId); +const resourceName = "testresourceName"; +const scope = "testscope"; +client.quota.get(resourceName, scope).then((result) => { + console.log("The result is:"); + console.log(result); +}).catch((err) => { + console.log("An error occurred:"); + console.error(err); +}); +``` + +#### browser - Authentication, client creation, and get quota as an example written in JavaScript. + +In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. + - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. + - Note down the client Id from the previous step and use it in the browser sample below. + +##### Sample code + +- index.html + +```html + + + + @azure/arm-quota sample + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/quota/arm-quota/README.png) diff --git a/sdk/quota/arm-quota/package.json b/sdk/quota/arm-quota/package.json new file mode 100644 index 000000000000..94d14bd25947 --- /dev/null +++ b/sdk/quota/arm-quota/package.json @@ -0,0 +1,59 @@ +{ + "name": "@azure/arm-quota", + "author": "Microsoft Corporation", + "description": "AzureQuotaExtensionAPI Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^2.1.0", + "@azure/ms-rest-js": "^2.2.0", + "@azure/core-auth": "^1.1.4", + "tslib": "^1.10.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-quota.js", + "module": "./esm/azureQuotaExtensionAPI.js", + "types": "./esm/azureQuotaExtensionAPI.d.ts", + "devDependencies": { + "typescript": "^3.6.0", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/quota/arm-quota", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-quota.js.map'\" -o ./dist/arm-quota.min.js ./dist/arm-quota.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/quota/arm-quota/rollup.config.js b/sdk/quota/arm-quota/rollup.config.js new file mode 100644 index 000000000000..b131983d04f1 --- /dev/null +++ b/sdk/quota/arm-quota/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/azureQuotaExtensionAPI.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-quota.js", + format: "umd", + name: "Azure.ArmQuota", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * 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. + */` + }, + plugins: [ + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts b/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts new file mode 100644 index 000000000000..e0cde8d3f503 --- /dev/null +++ b/sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts @@ -0,0 +1,52 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import { TokenCredential } from "@azure/core-auth"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { AzureQuotaExtensionAPIContext } from "./azureQuotaExtensionAPIContext"; + + +class AzureQuotaExtensionAPI extends AzureQuotaExtensionAPIContext { + // Operation groups + quota: operations.Quota; + quotaRequestStatus: operations.QuotaRequestStatus; + quotaResourceProviders: operations.QuotaResourceProviders; + operation: operations.Operation; + + /** + * Initializes a new instance of the AzureQuotaExtensionAPI class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.AzureQuotaExtensionAPIOptions) { + super(credentials, options); + this.quota = new operations.Quota(this); + this.quotaRequestStatus = new operations.QuotaRequestStatus(this); + this.quotaResourceProviders = new operations.QuotaResourceProviders(this); + this.operation = new operations.Operation(this); + } +} + +// Operation Specifications + +export { + AzureQuotaExtensionAPI, + AzureQuotaExtensionAPIContext, + Models as AzureQuotaExtensionAPIModels, + Mappers as AzureQuotaExtensionAPIMappers +}; +export * from "./operations"; diff --git a/sdk/quota/arm-quota/src/azureQuotaExtensionAPIContext.ts b/sdk/quota/arm-quota/src/azureQuotaExtensionAPIContext.ts new file mode 100644 index 000000000000..aa1d4e8fe4c0 --- /dev/null +++ b/sdk/quota/arm-quota/src/azureQuotaExtensionAPIContext.ts @@ -0,0 +1,61 @@ +/* + * 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 * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import { TokenCredential } from "@azure/core-auth"; + +const packageName = "@azure/arm-quota"; +const packageVersion = "1.0.0"; + +export class AzureQuotaExtensionAPIContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials | TokenCredential; + apiVersion?: string; + + /** + * Initializes a new instance of the AzureQuotaExtensionAPI class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.AzureQuotaExtensionAPIOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if (!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2021-03-15-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/quota/arm-quota/src/models/index.ts b/sdk/quota/arm-quota/src/models/index.ts new file mode 100644 index 000000000000..2908a6d2ede2 --- /dev/null +++ b/sdk/quota/arm-quota/src/models/index.ts @@ -0,0 +1,1047 @@ +/* + * 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + +/** + * An interface representing OperationDisplay. + */ +export interface OperationDisplay { + /** + * Provider name. + */ + provider?: string; + /** + * Resource name. + */ + resource?: string; + /** + * Operation name. + */ + operation?: string; + /** + * Operation description. + */ + description?: string; +} + +/** + * An interface representing OperationResponse. + */ +export interface OperationResponse { + name?: string; + display?: OperationDisplay; + origin?: string; +} + +/** + * Resource properties. + */ +export interface CommonResourceProperties { + /** + * Resource ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Resource name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Resource type. "Microsoft.Quota/quotaLimits" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * Name of the resource provided by the resource Provider. When requesting quota, use this property + * name. + */ +export interface ResourceName { + /** + * Resource name. + */ + value?: string; + /** + * Resource display name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly localizedValue?: string; +} + +/** + * Quota properties for the specified resource. + */ +export interface QuotaProperties { + /** + * Quota limit. + */ + limit?: number; + /** + * Usage information for the current resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly currentValue?: number; + /** + * The quota limit 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; + /** + * Resource name provided by the resource provider. Use this property name when requesting quota. + */ + name?: ResourceName; + /** + * Resource type name. Possible values include: 'standard', 'dedicated', 'lowPriority', 'shared', + * 'serviceSpecific' + */ + resourceType?: ResourceType; + /** + * The time period over which the quota usage values are summarized. For example: + * *P1D (per one day) + * *PT1M (per one minute) + * *PT1S (per one second). + * This parameter is optional because, for some resources like compute, the period is irrelevant. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly quotaPeriod?: string; + /** + * States if quota can be requested for this resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly isQuotaApplicable?: boolean; + /** + * Additional properties for the specific resource provider. + */ + properties?: any; +} + +/** + * Quota limit. + */ +export interface CurrentQuotaLimitBase extends BaseResource { + /** + * The resource Id. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The resource type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The resource name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Quota properties for the specified resource. + */ + properties?: QuotaProperties; +} + +/** + * Quota limits request response. + */ +export interface QuotaLimitsResponse { + /** + * List of quota limits with the quota request status. + */ + value?: CurrentQuotaLimitBase[]; + /** + * The URI used to fetch the next page of quota limits. When there are no more pages, this is + * null. + */ + nextLink?: string; +} + +/** + * Quota change requests information. + */ +export interface CreateGenericQuotaRequestParameters { + /** + * Quota change requests. + */ + value?: CurrentQuotaLimitBase[]; +} + +/** + * Request property. + */ +export interface SubRequest { + /** + * Resource quota limit. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly limit?: number; + /** + * Resource name. + */ + name?: ResourceName; + /** + * Resource type for which the quota check was made. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly resourceType?: string; + /** + * Quota limit 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. + */ + unit?: string; + /** + * The quota request status. Possible values include: 'Accepted', 'Invalid', 'Succeeded', + * 'Failed', 'InProgress' + */ + provisioningState?: QuotaRequestState; + /** + * User-friendly status message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * Quota request ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly subRequestId?: string; +} + +/** + * Quota request response. + */ +export interface QuotaRequestOneResourceSubmitResponse extends BaseResource { + /** + * Quota request ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The name of the quota request. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Resource type. "Microsoft.Quota/ServiceLimitRequests" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * Quota request status. Possible values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + * 'InProgress' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provisioningState?: QuotaRequestState; + /** + * User-friendly status message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * Quota request submission time. The date conforms to the following ISO 8601 standard format: + * yyyy-MM-ddTHH:mm:ssZ. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requestSubmitTime?: Date; + /** + * Quota limit. + */ + limit?: number; + /** + * Usage information for the current resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly currentValue?: number; + /** + * The quota limit 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. + */ + unit?: string; + /** + * Resource name provided by the resource provider. Use this property name when requesting quota. + */ + name1?: ResourceName; + /** + * Resource type name. Possible values include: 'standard', 'dedicated', 'lowPriority', 'shared', + * 'serviceSpecific' + */ + resourceType?: ResourceType; + /** + * The time period over which the quota usage values are summarized. For example: + * *P1D (per one day) + * *PT1M (per one minute) + * *PT1S (per one second). + * This parameter is optional because, for some resources like compute, the period is irrelevant. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly quotaPeriod?: string; + /** + * States if quota can be requested for this resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly isQuotaApplicable?: boolean; + /** + * Additional properties for the specific resource provider. + */ + properties?: any; +} + +/** + * Quota request properties. + */ +export interface QuotaRequestProperties { + /** + * The quota request status. Possible values include: 'Accepted', 'Invalid', 'Succeeded', + * 'Failed', 'InProgress' + */ + provisioningState?: QuotaRequestState; + /** + * User-friendly status message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * The quota request submission time. The date conforms to the following format specified by the + * ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requestSubmitTime?: Date; + /** + * Quota request details. + */ + value?: SubRequest[]; +} + +/** + * Quota request response. + */ +export interface QuotaRequestSubmitResponse extends BaseResource { + /** + * Quota request ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Quota request name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The quota request details. + */ + properties?: QuotaRequestProperties; + /** + * Resource type. "Microsoft.Quota/quotaLimits" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * The quota request response with the quota request ID. + */ +export interface QuotaRequestSubmitResponse202 { + /** + * The quota request ID. To check the request status, use the **id** value in a [Quota Request + * Status](https://docs.microsoft.com/en-us/rest/api/reserved-vm-instances/quotarequeststatus/get) + * GET operation. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Operation ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Resource type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * Quota request status. Possible values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + * 'InProgress' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provisioningState?: QuotaRequestState; + /** + * User-friendly message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * Quota limit. + */ + limit?: number; + /** + * Usage information for the current resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly currentValue?: number; + /** + * The quota limit 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. + */ + unit?: string; + /** + * Resource name provided by the resource provider. Use this property name when requesting quota. + */ + name1?: ResourceName; + /** + * Resource type name. Possible values include: 'standard', 'dedicated', 'lowPriority', 'shared', + * 'serviceSpecific' + */ + resourceType?: ResourceType; + /** + * The time period over which the quota usage values are summarized. For example: + * *P1D (per one day) + * *PT1M (per one minute) + * *PT1S (per one second). + * This parameter is optional because, for some resources like compute, the period is irrelevant. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly quotaPeriod?: string; + /** + * Additional properties for the specific resource provider. + */ + properties?: any; +} + +/** + * List of quota requests with details. + */ +export interface QuotaRequestDetails { + /** + * Quota request ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Quota request name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Resource type. "Microsoft.Quota/quotaLimits" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The quota request status. Possible values include: 'Accepted', 'Invalid', 'Succeeded', + * 'Failed', 'InProgress' + */ + provisioningState?: QuotaRequestState; + /** + * User-friendly status message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * The quota request submission time. The date conforms to the following format specified by the + * ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requestSubmitTime?: Date; + /** + * Quota request details. + */ + value?: SubRequest[]; +} + +/** + * Error details. + */ +export interface ServiceErrorDetail { + /** + * Error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * Error message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; +} + +/** + * API error details. + */ +export interface ServiceError { + /** + * Error code. + */ + code?: string; + /** + * Error message. + */ + message?: string; + /** + * List of error details. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly details?: ServiceErrorDetail[]; +} + +/** + * Error. + */ +export interface ExceptionResponse { + /** + * API error details. + */ + error?: ServiceError; +} + +/** + * quotaBucket provider properties. + */ +export interface QuotaBucketProperties { + /** + * Property name. + */ + name?: string; + /** + * Display name. + */ + displayName?: string; +} + +/** + * Resource provider resource dimension. + */ +export interface ResourceProviderDimension { + /** + * Resource dimension name. + */ + name?: string; + /** + * Display name. + */ + displayName?: string; +} + +/** + * Resource query details. + */ +export interface ResourceQueryDetails { + /** + * Resource query type. Possible values include: 'ARG', 'RestAPI' + */ + resourceQueryType?: ResourceQueryType; + /** + * Resource query method. Possible values include: 'GET', 'POST' + */ + resourceQueryMethod?: ResourceQueryMethod; + /** + * Base URI for for resource query. + */ + resourceQueryUri?: string; + /** + * Template to create the resource query. + */ + resourceQueryPostTemplate?: string; +} + +/** + * Resource template details for the resource provider. + */ +export interface ResourceProviderTemplate { + /** + * Resource type. + */ + resourceType?: string; + /** + * Resource query for dimension values. + */ + resourceQuery?: ResourceQueryDetails; + /** + * Resource usages query. + */ + resourceUsagesQuery?: ResourceQueryDetails; + /** + * Resource provider dimensions. + */ + dimensions?: ResourceProviderDimension[]; +} + +/** + * Resource provider information. + */ +export interface ResourceProviderInformation { + /** + * Resource provider name. + */ + resourceProviderName?: string; + /** + * The resource provider templates + */ + value?: ResourceProviderTemplate[]; +} + +/** + * Resource providers list. + */ +export interface ResourceProvidersList { + /** + * Resource provider information. + */ + value?: ResourceProviderInformation[]; +} + +/** + * Quota type information. + */ +export interface QuotaTypeDimensionInformation { + /** + * Property name. + */ + name?: string; + /** + * Display name. + */ + displayName?: string; + /** + * Dimension ID. + */ + id?: string; +} + +/** + * Quota template details. + */ +export interface QuotaTemplateDetails { + /** + * Resource type. + */ + resourceType?: string; + /** + * Resource type + */ + resourceType1?: string; + /** + * Quota type information. + */ + value?: QuotaTypeDimensionInformation[]; +} + +/** + * Quota templates details. + */ +export interface QuotaTemplatesDetails { + /** + * Quota templates information. + */ + value?: QuotaTemplateDetails[]; +} + +/** + * Optional Parameters. + */ +export interface QuotaRequestStatusListOptionalParams extends msRest.RequestOptionsBase { + /** + * | 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, the value of the **nextLink** element + * includes a **skiptoken** parameter that specifies a starting point to use for subsequent + * calls. + */ + skiptoken?: string; +} + +/** + * Optional Parameters. + */ +export interface QuotaRequestStatusListNextOptionalParams extends msRest.RequestOptionsBase { + /** + * | 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, the value of the **nextLink** element + * includes a **skiptoken** parameter that specifies a starting point to use for subsequent + * calls. + */ + skiptoken?: string; +} + +/** + * An interface representing AzureQuotaExtensionAPIOptions. + */ +export interface AzureQuotaExtensionAPIOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * Defines headers for Get operation. + */ +export interface QuotaGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to make conditional HTTP + * requests. + */ + eTag: string; +} + +/** + * Defines headers for List operation. + */ +export interface QuotaListHeaders { + /** + * Current entity state version. Should be treated as opaque and used to make conditional HTTP + * requests. + */ + eTag: string; +} + +/** + * @interface + * Quota limits. + * @extends Array + */ +export interface QuotaLimits extends Array { + /** + * The URI used to fetch the next page of quota limits. When there are no more pages, this is + * null. + */ + nextLink?: string; +} + +/** + * @interface + * Quota request information. + * @extends Array + */ +export interface QuotaRequestDetailsList extends Array { + /** + * The URI for fetching the next page of quota limits. When there are no more pages, this is + * null. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the OperationList. + * @extends Array + */ +export interface OperationList extends Array { + /** + * URL to get the next page of items. + */ + nextLink?: string; +} + +/** + * Defines values for ResourceType. + * Possible values include: 'standard', 'dedicated', 'lowPriority', 'shared', 'serviceSpecific' + * @readonly + * @enum {string} + */ +export type ResourceType = 'standard' | 'dedicated' | 'lowPriority' | 'shared' | 'serviceSpecific'; + +/** + * Defines values for QuotaRequestState. + * Possible values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', 'InProgress' + * @readonly + * @enum {string} + */ +export type QuotaRequestState = 'Accepted' | 'Invalid' | 'Succeeded' | 'Failed' | 'InProgress'; + +/** + * Defines values for ResourceQueryType. + * Possible values include: 'ARG', 'RestAPI' + * @readonly + * @enum {string} + */ +export type ResourceQueryType = 'ARG' | 'RestAPI'; + +/** + * Defines values for ResourceQueryMethod. + * Possible values include: 'GET', 'POST' + * @readonly + * @enum {string} + */ +export type ResourceQueryMethod = 'GET' | 'POST'; + +/** + * Contains response data for the get operation. + */ +export type QuotaGetResponse = CurrentQuotaLimitBase & QuotaGetHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: QuotaGetHeaders; + + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CurrentQuotaLimitBase; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type QuotaCreateOrUpdateResponse = CurrentQuotaLimitBase & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CurrentQuotaLimitBase; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type QuotaUpdateResponse = CurrentQuotaLimitBase & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CurrentQuotaLimitBase; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type QuotaListResponse = QuotaLimits & QuotaListHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: QuotaListHeaders; + + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: QuotaLimits; + }; +}; + +/** + * Contains response data for the beginCreateOrUpdate operation. + */ +export type QuotaBeginCreateOrUpdateResponse = CurrentQuotaLimitBase & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CurrentQuotaLimitBase; + }; +}; + +/** + * Contains response data for the beginUpdate operation. + */ +export type QuotaBeginUpdateResponse = CurrentQuotaLimitBase & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CurrentQuotaLimitBase; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type QuotaRequestStatusGetResponse = QuotaRequestDetails & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: QuotaRequestDetails; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type QuotaRequestStatusListResponse = QuotaRequestDetailsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: QuotaRequestDetailsList; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: QuotaRequestDetailsList; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type QuotaResourceProvidersListResponse = ResourceProvidersList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ResourceProvidersList; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationListResponse = OperationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationList; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationListNextResponse = OperationList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationList; + }; +}; diff --git a/sdk/quota/arm-quota/src/models/mappers.ts b/sdk/quota/arm-quota/src/models/mappers.ts new file mode 100644 index 000000000000..2769f1afe97a --- /dev/null +++ b/sdk/quota/arm-quota/src/models/mappers.ts @@ -0,0 +1,1121 @@ +/* + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "OperationDisplay", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResponse: msRest.CompositeMapper = { + serializedName: "OperationResponse", + type: { + name: "Composite", + className: "OperationResponse", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + } + } + } +}; + +export const CommonResourceProperties: msRest.CompositeMapper = { + serializedName: "CommonResourceProperties", + type: { + name: "Composite", + className: "CommonResourceProperties", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceName: msRest.CompositeMapper = { + serializedName: "ResourceName", + type: { + name: "Composite", + className: "ResourceName", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + localizedValue: { + readOnly: true, + serializedName: "localizedValue", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaProperties: msRest.CompositeMapper = { + serializedName: "QuotaProperties", + type: { + name: "Composite", + className: "QuotaProperties", + modelProperties: { + limit: { + serializedName: "limit", + type: { + name: "Number" + } + }, + currentValue: { + readOnly: true, + serializedName: "currentValue", + type: { + name: "Number" + } + }, + unit: { + readOnly: true, + serializedName: "unit", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + quotaPeriod: { + readOnly: true, + serializedName: "quotaPeriod", + type: { + name: "String" + } + }, + isQuotaApplicable: { + readOnly: true, + serializedName: "isQuotaApplicable", + type: { + name: "Boolean" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + } + } + } +}; + +export const CurrentQuotaLimitBase: msRest.CompositeMapper = { + serializedName: "CurrentQuotaLimitBase", + type: { + name: "Composite", + className: "CurrentQuotaLimitBase", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "QuotaProperties" + } + } + } + } +}; + +export const QuotaLimitsResponse: msRest.CompositeMapper = { + serializedName: "QuotaLimitsResponse", + type: { + name: "Composite", + className: "QuotaLimitsResponse", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CurrentQuotaLimitBase" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CreateGenericQuotaRequestParameters: msRest.CompositeMapper = { + serializedName: "CreateGenericQuotaRequestParameters", + type: { + name: "Composite", + className: "CreateGenericQuotaRequestParameters", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CurrentQuotaLimitBase" + } + } + } + } + } + } +}; + +export const SubRequest: msRest.CompositeMapper = { + serializedName: "SubRequest", + type: { + name: "Composite", + className: "SubRequest", + modelProperties: { + limit: { + readOnly: true, + serializedName: "limit", + type: { + name: "Number" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + readOnly: true, + serializedName: "resourceType", + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + subRequestId: { + readOnly: true, + serializedName: "subRequestId", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestOneResourceSubmitResponse: msRest.CompositeMapper = { + serializedName: "QuotaRequestOneResourceSubmitResponse", + type: { + name: "Composite", + className: "QuotaRequestOneResourceSubmitResponse", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "properties.message", + type: { + name: "String" + } + }, + requestSubmitTime: { + readOnly: true, + serializedName: "properties.requestSubmitTime", + type: { + name: "DateTime" + } + }, + limit: { + serializedName: "properties.limit", + type: { + name: "Number" + } + }, + currentValue: { + readOnly: true, + serializedName: "properties.currentValue", + type: { + name: "Number" + } + }, + unit: { + serializedName: "properties.unit", + type: { + name: "String" + } + }, + name1: { + serializedName: "properties.name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + serializedName: "properties.resourceType", + type: { + name: "String" + } + }, + quotaPeriod: { + readOnly: true, + serializedName: "properties.quotaPeriod", + type: { + name: "String" + } + }, + isQuotaApplicable: { + readOnly: true, + serializedName: "properties.isQuotaApplicable", + type: { + name: "Boolean" + } + }, + properties: { + serializedName: "properties.properties", + type: { + name: "Object" + } + } + } + } +}; + +export const QuotaRequestProperties: msRest.CompositeMapper = { + serializedName: "QuotaRequestProperties", + type: { + name: "Composite", + className: "QuotaRequestProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + requestSubmitTime: { + readOnly: true, + serializedName: "requestSubmitTime", + type: { + name: "DateTime" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } + } + } + } + } +}; + +export const QuotaRequestSubmitResponse: msRest.CompositeMapper = { + serializedName: "QuotaRequestSubmitResponse", + type: { + name: "Composite", + className: "QuotaRequestSubmitResponse", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "QuotaRequestProperties" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestSubmitResponse202: msRest.CompositeMapper = { + serializedName: "QuotaRequestSubmitResponse202", + type: { + name: "Composite", + className: "QuotaRequestSubmitResponse202", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "properties.message", + type: { + name: "String" + } + }, + limit: { + serializedName: "properties.limit", + type: { + name: "Number" + } + }, + currentValue: { + readOnly: true, + serializedName: "properties.currentValue", + type: { + name: "Number" + } + }, + unit: { + serializedName: "properties.unit", + type: { + name: "String" + } + }, + name1: { + serializedName: "properties.name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + serializedName: "properties.resourceType", + type: { + name: "String" + } + }, + quotaPeriod: { + readOnly: true, + serializedName: "properties.quotaPeriod", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties.properties", + type: { + name: "Object" + } + } + } + } +}; + +export const QuotaRequestDetails: msRest.CompositeMapper = { + serializedName: "QuotaRequestDetails", + type: { + name: "Composite", + className: "QuotaRequestDetails", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "properties.message", + type: { + name: "String" + } + }, + requestSubmitTime: { + readOnly: true, + serializedName: "properties.requestSubmitTime", + type: { + name: "DateTime" + } + }, + value: { + serializedName: "properties.value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } + } + } + } + } +}; + +export const ServiceErrorDetail: msRest.CompositeMapper = { + serializedName: "ServiceErrorDetail", + type: { + name: "Composite", + className: "ServiceErrorDetail", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ServiceError: msRest.CompositeMapper = { + serializedName: "ServiceError", + type: { + name: "Composite", + className: "ServiceError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + details: { + readOnly: true, + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServiceErrorDetail" + } + } + } + } + } + } +}; + +export const ExceptionResponse: msRest.CompositeMapper = { + serializedName: "ExceptionResponse", + type: { + name: "Composite", + className: "ExceptionResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ServiceError" + } + } + } + } +}; + +export const QuotaBucketProperties: msRest.CompositeMapper = { + serializedName: "quotaBucketProperties", + type: { + name: "Composite", + className: "QuotaBucketProperties", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceProviderDimension: msRest.CompositeMapper = { + serializedName: "ResourceProviderDimension", + type: { + name: "Composite", + className: "ResourceProviderDimension", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceQueryDetails: msRest.CompositeMapper = { + serializedName: "resourceQueryDetails", + type: { + name: "Composite", + className: "ResourceQueryDetails", + modelProperties: { + resourceQueryType: { + serializedName: "resourceQueryType", + type: { + name: "String" + } + }, + resourceQueryMethod: { + serializedName: "resourceQueryMethod", + type: { + name: "String" + } + }, + resourceQueryUri: { + serializedName: "resourceQueryUri", + type: { + name: "String" + } + }, + resourceQueryPostTemplate: { + serializedName: "resourceQueryPostTemplate", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceProviderTemplate: msRest.CompositeMapper = { + serializedName: "ResourceProviderTemplate", + type: { + name: "Composite", + className: "ResourceProviderTemplate", + modelProperties: { + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + resourceQuery: { + serializedName: "resourceQuery", + type: { + name: "Composite", + className: "ResourceQueryDetails" + } + }, + resourceUsagesQuery: { + serializedName: "resourceUsagesQuery", + type: { + name: "Composite", + className: "ResourceQueryDetails" + } + }, + dimensions: { + serializedName: "dimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceProviderDimension" + } + } + } + } + } + } +}; + +export const ResourceProviderInformation: msRest.CompositeMapper = { + serializedName: "ResourceProviderInformation", + type: { + name: "Composite", + className: "ResourceProviderInformation", + modelProperties: { + resourceProviderName: { + serializedName: "resourceProviderName", + type: { + name: "String" + } + }, + value: { + serializedName: "properties.value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceProviderTemplate" + } + } + } + } + } + } +}; + +export const ResourceProvidersList: msRest.CompositeMapper = { + serializedName: "resourceProvidersList", + type: { + name: "Composite", + className: "ResourceProvidersList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceProviderInformation" + } + } + } + } + } + } +}; + +export const QuotaTypeDimensionInformation: msRest.CompositeMapper = { + serializedName: "QuotaTypeDimensionInformation", + type: { + name: "Composite", + className: "QuotaTypeDimensionInformation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaTemplateDetails: msRest.CompositeMapper = { + serializedName: "QuotaTemplateDetails", + type: { + name: "Composite", + className: "QuotaTemplateDetails", + modelProperties: { + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + resourceType1: { + serializedName: "properties.resourceType", + type: { + name: "String" + } + }, + value: { + serializedName: "properties.value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaTypeDimensionInformation" + } + } + } + } + } + } +}; + +export const QuotaTemplatesDetails: msRest.CompositeMapper = { + serializedName: "QuotaTemplatesDetails", + type: { + name: "Composite", + className: "QuotaTemplatesDetails", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaTemplateDetails" + } + } + } + } + } + } +}; + +export const QuotaGetHeaders: msRest.CompositeMapper = { + serializedName: "quota-get-headers", + type: { + name: "Composite", + className: "QuotaGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaListHeaders: msRest.CompositeMapper = { + serializedName: "quota-list-headers", + type: { + name: "Composite", + className: "QuotaListHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaLimits: msRest.CompositeMapper = { + serializedName: "QuotaLimits", + type: { + name: "Composite", + className: "QuotaLimits", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CurrentQuotaLimitBase" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestDetailsList: msRest.CompositeMapper = { + serializedName: "QuotaRequestDetailsList", + type: { + name: "Composite", + className: "QuotaRequestDetailsList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaRequestDetails" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationList: msRest.CompositeMapper = { + serializedName: "OperationList", + type: { + name: "Composite", + className: "OperationList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/quota/arm-quota/src/models/operationMappers.ts b/sdk/quota/arm-quota/src/models/operationMappers.ts new file mode 100644 index 000000000000..f7c5061d29bf --- /dev/null +++ b/sdk/quota/arm-quota/src/models/operationMappers.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +export { + ExceptionResponse, + OperationDisplay, + OperationList, + OperationResponse, + ServiceError, + ServiceErrorDetail +} from "../models/mappers"; diff --git a/sdk/quota/arm-quota/src/models/parameters.ts b/sdk/quota/arm-quota/src/models/parameters.ts new file mode 100644 index 000000000000..9272fc0707a8 --- /dev/null +++ b/sdk/quota/arm-quota/src/models/parameters.ts @@ -0,0 +1,115 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; +export const filter: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "filter" + ], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; +export const id: msRest.OperationURLParameter = { + parameterPath: "id", + mapper: { + required: true, + serializedName: "id", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceName: msRest.OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + required: true, + serializedName: "resourceName", + type: { + name: "String" + } + } +}; +export const scope: msRest.OperationURLParameter = { + parameterPath: "scope", + mapper: { + required: true, + serializedName: "scope", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const skiptoken: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "skiptoken" + ], + mapper: { + serializedName: "$skiptoken", + type: { + name: "String" + } + } +}; +export const top: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "top" + ], + mapper: { + serializedName: "$top", + constraints: { + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + } +}; diff --git a/sdk/quota/arm-quota/src/models/quotaMappers.ts b/sdk/quota/arm-quota/src/models/quotaMappers.ts new file mode 100644 index 000000000000..8243d1bec79e --- /dev/null +++ b/sdk/quota/arm-quota/src/models/quotaMappers.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export { + BaseResource, + CurrentQuotaLimitBase, + ExceptionResponse, + QuotaGetHeaders, + QuotaLimits, + QuotaListHeaders, + QuotaProperties, + QuotaRequestOneResourceSubmitResponse, + QuotaRequestProperties, + QuotaRequestSubmitResponse, + ResourceName, + ServiceError, + ServiceErrorDetail, + SubRequest +} from "../models/mappers"; diff --git a/sdk/quota/arm-quota/src/models/quotaRequestStatusMappers.ts b/sdk/quota/arm-quota/src/models/quotaRequestStatusMappers.ts new file mode 100644 index 000000000000..9352fa30ea6d --- /dev/null +++ b/sdk/quota/arm-quota/src/models/quotaRequestStatusMappers.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export { + ExceptionResponse, + QuotaRequestDetails, + QuotaRequestDetailsList, + ResourceName, + ServiceError, + ServiceErrorDetail, + SubRequest +} from "../models/mappers"; diff --git a/sdk/quota/arm-quota/src/models/quotaResourceProvidersMappers.ts b/sdk/quota/arm-quota/src/models/quotaResourceProvidersMappers.ts new file mode 100644 index 000000000000..087fc42abc30 --- /dev/null +++ b/sdk/quota/arm-quota/src/models/quotaResourceProvidersMappers.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { + ExceptionResponse, + ResourceProviderDimension, + ResourceProviderInformation, + ResourceProvidersList, + ResourceProviderTemplate, + ResourceQueryDetails, + ServiceError, + ServiceErrorDetail +} from "../models/mappers"; diff --git a/sdk/quota/arm-quota/src/operations/index.ts b/sdk/quota/arm-quota/src/operations/index.ts new file mode 100644 index 000000000000..7d4d04252422 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export * from "./quota"; +export * from "./quotaRequestStatus"; +export * from "./quotaResourceProviders"; +export * from "./operation"; diff --git a/sdk/quota/arm-quota/src/operations/operation.ts b/sdk/quota/arm-quota/src/operations/operation.ts new file mode 100644 index 000000000000..ad31f13f447d --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/operation.ts @@ -0,0 +1,127 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationMappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPIContext } from "../azureQuotaExtensionAPIContext"; + +/** Class representing a Operation. */ +export class Operation { + private readonly client: AzureQuotaExtensionAPIContext; + + /** + * Create a Operation. + * @param {AzureQuotaExtensionAPIContext} client Reference to the service client. + */ + constructor(client: AzureQuotaExtensionAPIContext) { + this.client = client; + } + + /** + * List all GET operations. + * @summary GET operations. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * List all GET operations. + * @summary GET operations. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Quota/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/quota.ts b/sdk/quota/arm-quota/src/operations/quota.ts new file mode 100644 index 000000000000..36813757f31f --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/quota.ts @@ -0,0 +1,405 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/quotaMappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPIContext } from "../azureQuotaExtensionAPIContext"; + +/** Class representing a Quota. */ +export class Quota { + private readonly client: AzureQuotaExtensionAPIContext; + + /** + * Create a Quota. + * @param {AzureQuotaExtensionAPIContext} client Reference to the service client. + */ + constructor(client: AzureQuotaExtensionAPIContext) { + this.client = client; + } + + /** + * Gets the quota limit and current quota usage of a resource. The response can be used to + * determine the remaining quota and calculate a new quota limit that can be submitted with a PUT + * request. + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceName: string, scope: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param callback The callback + */ + get(resourceName: string, scope: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceName: string, scope: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceName: string, scope: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceName, + scope, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update the quota limit for the specified resource to the requested value. To update + * the quota, follow these steps: + * 1. Use the GET operation to determine how much quota remains for the specific resource and to + * calculate the new quota limit. These steps are detailed in [this + * example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + * 2. Use this PUT operation to update the quota limit. + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param createQuotaRequest Quota requests payload. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(resourceName: string, scope: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateOrUpdate(resourceName,scope,createQuotaRequest,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Update the quota limit for a specific resource to the specified value: + * 1. Use the GET operation to determine how much quota remains for the specific resource and to + * calculate the new quota limit. These steps are detailed in [this + * example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + * 2. Use this PUT operation to update the quota limit. + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param createQuotaRequest Quota requests payload. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceName: string, scope: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { + return this.beginUpdate(resourceName,scope,createQuotaRequest,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Get a list of current quota limits and usages of all resources. The response from this GET + * operation can be leveraged to submit requests to update a quota. + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param [options] The optional parameters + * @returns Promise + */ + list(scope: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param callback The callback + */ + list(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param options The optional parameters + * @param callback The callback + */ + list(scope: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(scope: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Create or update the quota limit for the specified resource to the requested value. To update + * the quota, follow these steps: + * 1. Use the GET operation to determine how much quota remains for the specific resource and to + * calculate the new quota limit. These steps are detailed in [this + * example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + * 2. Use this PUT operation to update the quota limit. + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param createQuotaRequest Quota requests payload. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateOrUpdate(resourceName: string, scope: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceName, + scope, + createQuotaRequest, + options + }, + beginCreateOrUpdateOperationSpec, + options); + } + + /** + * Update the quota limit for a specific resource to the specified value: + * 1. Use the GET operation to determine how much quota remains for the specific resource and to + * calculate the new quota limit. These steps are detailed in [this + * example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + * 2. Use this PUT operation to update the quota limit. + * @param resourceName Resource name for a given resource provider. For example: + * - SKU name for Microsoft.Compute + * - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param createQuotaRequest Quota requests payload. + * @param [options] The optional parameters + * @returns Promise + */ + beginUpdate(resourceName: string, scope: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceName, + scope, + createQuotaRequest, + options + }, + beginUpdateOperationSpec, + options); + } + + /** + * Get a list of current quota limits and usages of all resources. The response from this GET + * operation can be leveraged to submit requests to update a quota. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}", + urlParameters: [ + Parameters.resourceName, + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CurrentQuotaLimitBase, + headersMapper: Mappers.QuotaGetHeaders + }, + default: { + bodyMapper: Mappers.ExceptionResponse, + headersMapper: Mappers.QuotaGetHeaders + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Quota/quotaLimits", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.QuotaLimits, + headersMapper: Mappers.QuotaListHeaders + }, + default: { + bodyMapper: Mappers.ExceptionResponse, + headersMapper: Mappers.QuotaListHeaders + } + }, + serializer +}; + +const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}", + urlParameters: [ + Parameters.resourceName, + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "createQuotaRequest", + mapper: { + ...Mappers.CurrentQuotaLimitBase, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CurrentQuotaLimitBase + }, + 202: { + bodyMapper: Mappers.CurrentQuotaLimitBase + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; + +const beginUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}", + urlParameters: [ + Parameters.resourceName, + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "createQuotaRequest", + mapper: { + ...Mappers.CurrentQuotaLimitBase, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CurrentQuotaLimitBase + }, + 202: { + bodyMapper: Mappers.CurrentQuotaLimitBase + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.QuotaLimits, + headersMapper: Mappers.QuotaListHeaders + }, + default: { + bodyMapper: Mappers.ExceptionResponse, + headersMapper: Mappers.QuotaListHeaders + } + }, + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts b/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts new file mode 100644 index 000000000000..55a083687484 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/quotaRequestStatus.ts @@ -0,0 +1,224 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/quotaRequestStatusMappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPIContext } from "../azureQuotaExtensionAPIContext"; + +/** Class representing a QuotaRequestStatus. */ +export class QuotaRequestStatus { + private readonly client: AzureQuotaExtensionAPIContext; + + /** + * Create a QuotaRequestStatus. + * @param {AzureQuotaExtensionAPIContext} client Reference to the service client. + */ + constructor(client: AzureQuotaExtensionAPIContext) { + this.client = client; + } + + /** + * Gets the quota request details and status by quota request ID for the resources of the resource + * provider at a specific location. The quota request ID **id** is returned in the response of the + * PUT operation. + * @param id Quota request ID. + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param [options] The optional parameters + * @returns Promise + */ + get(id: string, scope: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param id Quota request ID. + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param callback The callback + */ + get(id: string, scope: string, callback: msRest.ServiceCallback): void; + /** + * @param id Quota request ID. + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param options The optional parameters + * @param callback The callback + */ + get(id: string, scope: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(id: string, scope: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + id, + scope, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * For the specified location and resource provider, gets the current quota requests under the + * subscription for a one year period ending at the time is made. Use the **oData** filter can be + * used to select quota requests. + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param [options] The optional parameters + * @returns Promise + */ + list(scope: string, options?: Models.QuotaRequestStatusListOptionalParams): Promise; + /** + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param callback The callback + */ + list(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The target Azure resource URI. For example, + * `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + * This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added + * after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the + * specific resource. + * @param options The optional parameters + * @param callback The callback + */ + list(scope: string, options: Models.QuotaRequestStatusListOptionalParams, callback: msRest.ServiceCallback): void; + list(scope: string, options?: Models.QuotaRequestStatusListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * For the specified location and resource provider, gets the current quota requests under the + * subscription for a one year period ending at the time is made. Use the **oData** filter can be + * used to select quota requests. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: Models.QuotaRequestStatusListNextOptionalParams, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Quota/quotaLimitsRequests/{id}", + urlParameters: [ + Parameters.id, + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestDetails + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.Quota/quotaLimitsRequests", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skiptoken + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestDetailsList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skiptoken + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestDetailsList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; diff --git a/sdk/quota/arm-quota/src/operations/quotaResourceProviders.ts b/sdk/quota/arm-quota/src/operations/quotaResourceProviders.ts new file mode 100644 index 000000000000..1d4c4ed8d3e3 --- /dev/null +++ b/sdk/quota/arm-quota/src/operations/quotaResourceProviders.ts @@ -0,0 +1,82 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/quotaResourceProvidersMappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuotaExtensionAPIContext } from "../azureQuotaExtensionAPIContext"; + +/** Class representing a QuotaResourceProviders. */ +export class QuotaResourceProviders { + private readonly client: AzureQuotaExtensionAPIContext; + + /** + * Create a QuotaResourceProviders. + * @param {AzureQuotaExtensionAPIContext} client Reference to the service client. + */ + constructor(client: AzureQuotaExtensionAPIContext) { + this.client = client; + } + + /** + * Gets the list of current resource providers supported by the Microsoft.Quota resource provider. + * For each resource provider, the resource templates the resource provider supports are be + * provided. + * For each resource template, the resource dimensions are listed. The resource dimensions are the + * name-value pairs in the resource URI. + * Example: Microsoft.Compute Resource Provider + * The URI template is + * '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + * The actual dimensions vary depending on the resource provider. + * The resource dimensions are {subscriptions},{locations},{quotaBucket}. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Quota/quotaLimitProviders", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ResourceProvidersList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + serializer +}; diff --git a/sdk/quota/arm-quota/tsconfig.json b/sdk/quota/arm-quota/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/quota/arm-quota/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}