Skip to content

Commit

Permalink
CodeGen from PR 22367 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.Quota to add version stable/2023-02-01 (Azure#22367)

* Adds base for updating Microsoft.Quota from version preview/2021-03-15-preview to version 2023-02-01

* Updates readme

* Updates API version in new specs and examples

* Fix version in readme

* Remove stale version, update readme

* Mark parameter as optional
  • Loading branch information
SDKAuto committed Mar 22, 2023
1 parent 941ecc0 commit 8d86d4d
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 184 deletions.
21 changes: 11 additions & 10 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 2 additions & 52 deletions sdk/quota/arm-quota/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
# Release History

## 1.0.0-beta.6 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 1.0.0-beta.5 (2022-12-05)

**Features**

- Added Interface LimitObject

## 1.0.0-beta.4 (2022-04-28)

**Features**

- Bug fix

## 1.0.0-beta.3 (2021-12-22)

**Features**

- Class AzureQuotaExtensionAPI has a new parameter $host
- Class AzureQuotaExtensionAPI has a new parameter apiVersion

**Breaking Changes**

- Deleted Class AzureQuotaExtensionAPIContext

## 1.0.0-beta.2 (2021-11-01)

**Features**

- Added operation group QuotaOperation
- Added Interface QuotaOperationListNextOptionalParams
- Added Interface QuotaOperationListOptionalParams
- Added Type Alias LimitObject
- Added Type Alias QuotaOperationListNextResponse
- Added Type Alias QuotaOperationListResponse
- Class AzureQuotaExtensionAPI has a new parameter quotaOperation

**Breaking Changes**

- Removed operation group Operation
- Class AzureQuotaExtensionAPI no longer has parameter operation

## 1.0.0-beta.1 (2021-09-28)
## 1.0.0 (2023-03-22)

- Initial Release
The package of @azure/arm-quota is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
2 changes: 1 addition & 1 deletion sdk/quota/arm-quota/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Microsoft
Copyright (c) 2023 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion sdk/quota/arm-quota/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Microsoft Azure Quota Resource Provider

[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-quota) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-quota?view=azure-node-preview) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-quota) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)

## Getting started
Expand Down
10 changes: 5 additions & 5 deletions sdk/quota/arm-quota/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf",
"readme": "specification\\quota\\resource-manager\\readme.md",
"autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\quota\\resource-manager\\readme.md --use=@autorest/[email protected].3.20221108.1 --generate-sample=true",
"commit": "806d1616c2ce4c0a93fda266bd020903733ac326",
"readme": "specification/quota/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/quota/resource-manager/readme.md --use=@autorest/[email protected].10",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.2",
"use": "@autorest/[email protected].3.20221108.1"
"release_tool": "@azure-tools/js-sdk-release-tools@2.6.2",
"use": "@autorest/[email protected].10"
}
21 changes: 7 additions & 14 deletions sdk/quota/arm-quota/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for AzureQuotaExtensionAPI.",
"version": "1.0.0-beta.6",
"version": "1.0.0",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@azure/core-lro": "^2.2.0",
"@azure/core-lro": "^2.5.0",
"@azure/abort-controller": "^1.0.0",
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.6.1",
"@azure/core-client": "^1.7.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.8.0",
"tslib": "^2.2.0"
Expand All @@ -33,12 +33,13 @@
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-multi-entry": "^6.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"mkdirp": "^1.0.4",
"mkdirp": "^2.1.2",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"typescript": "~4.8.0",
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"dotenv": "^16.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.0.0",
Expand All @@ -49,7 +50,6 @@
"@types/node": "^14.0.0",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down Expand Up @@ -111,12 +111,5 @@
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-quota?view=azure-node-preview"
}
}
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quota/arm-quota"
}
11 changes: 4 additions & 7 deletions sdk/quota/arm-quota/review/arm-quota.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import * as coreAuth from '@azure/core-auth';
import * as coreClient from '@azure/core-client';
import { OperationState } from '@azure/core-lro';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { PollerLike } from '@azure/core-lro';
import { PollOperationState } from '@azure/core-lro';
import { SimplePollerLike } from '@azure/core-lro';

// @public (undocumented)
export class AzureQuotaExtensionAPI extends coreClient.ServiceClient {
Expand Down Expand Up @@ -141,9 +141,9 @@ export interface OperationResponse {

// @public
export interface Quota {
beginCreateOrUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise<PollerLike<PollOperationState<QuotaCreateOrUpdateResponse>, QuotaCreateOrUpdateResponse>>;
beginCreateOrUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise<SimplePollerLike<OperationState<QuotaCreateOrUpdateResponse>, QuotaCreateOrUpdateResponse>>;
beginCreateOrUpdateAndWait(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise<QuotaCreateOrUpdateResponse>;
beginUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise<PollerLike<PollOperationState<QuotaUpdateResponse>, QuotaUpdateResponse>>;
beginUpdate(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise<SimplePollerLike<OperationState<QuotaUpdateResponse>, QuotaUpdateResponse>>;
beginUpdateAndWait(resourceName: string, scope: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise<QuotaUpdateResponse>;
get(resourceName: string, scope: string, options?: QuotaGetOptionalParams): Promise<QuotaGetResponse>;
list(scope: string, options?: QuotaListOptionalParams): PagedAsyncIterableIterator<CurrentQuotaLimitBase>;
Expand Down Expand Up @@ -303,9 +303,6 @@ export type QuotaRequestStatusGetResponse = QuotaRequestDetails;

// @public
export interface QuotaRequestStatusListNextOptionalParams extends coreClient.OperationOptions {
filter?: string;
skiptoken?: string;
top?: number;
}

// @public
Expand Down
4 changes: 2 additions & 2 deletions sdk/quota/arm-quota/src/azureQuotaExtensionAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class AzureQuotaExtensionAPI extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-quota/1.0.0-beta.6`;
const packageDetails = `azsdk-js-arm-quota/1.0.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down Expand Up @@ -105,7 +105,7 @@ export class AzureQuotaExtensionAPI extends coreClient.ServiceClient {

// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2021-03-15-preview";
this.apiVersion = options.apiVersion || "2023-02-01";
this.usages = new UsagesImpl(this);
this.quota = new QuotaImpl(this);
this.quotaRequestStatus = new QuotaRequestStatusImpl(this);
Expand Down
54 changes: 31 additions & 23 deletions sdk/quota/arm-quota/src/lroImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,37 @@
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AbortSignalLike } from "@azure/abort-controller";
import { LongRunningOperation, LroResponse } from "@azure/core-lro";

export class LroImpl<T> implements LongRunningOperation<T> {
constructor(
private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
private args: Record<string, unknown>,
private spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>,
public requestPath: string = spec.path!,
public requestMethod: string = spec.httpMethod
) {}
public async sendInitialRequest(): Promise<LroResponse<T>> {
return this.sendOperationFn(this.args, this.spec);
}
public async sendPollRequest(path: string): Promise<LroResponse<T>> {
const { requestBody, ...restSpec } = this.spec;
return this.sendOperationFn(this.args, {
...restSpec,
path,
httpMethod: "GET"
});
}
export function createLroSpec<T>(inputs: {
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
args: Record<string, unknown>;
spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>;
}): LongRunningOperation<T> {
const { args, spec, sendOperationFn } = inputs;
return {
requestMethod: spec.httpMethod,
requestPath: spec.path!,
sendInitialRequest: () => sendOperationFn(args, spec),
sendPollRequest: (
path: string,
options?: { abortSignal?: AbortSignalLike }
) => {
const { requestBody, ...restSpec } = spec;
return sendOperationFn(args, {
...restSpec,
httpMethod: "GET",
path,
abortSignal: options?.abortSignal
});
}
};
}
Loading

0 comments on commit 8d86d4d

Please sign in to comment.