Skip to content

Commit

Permalink
CodeGen from PR 24395 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge b6b053ee36a5157e3f46b757ed9d3e5aecc84257 into 1b33e81bbdc28fcd6644a1315b8d7b1b6d030590
  • Loading branch information
SDKAuto committed Jun 12, 2023
1 parent a2949d1 commit e7d8877
Show file tree
Hide file tree
Showing 25 changed files with 420 additions and 109 deletions.
21 changes: 14 additions & 7 deletions common/config/rush/pnpm-lock.yaml

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

21 changes: 11 additions & 10 deletions sdk/subscription/arm-subscriptions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Release History

## 5.2.0 (2023-06-12)

**Features**

## 5.1.1 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

- Added operation group SubscriptionOperation
- Added Interface SubscriptionCreationResult
- Added Interface SubscriptionOperationGetHeaders
- Added Interface SubscriptionOperationGetOptionalParams
- Added Type Alias SubscriptionOperationGetResponse


## 5.1.0 (2022-11-11)

**Features**
Expand Down
2 changes: 1 addition & 1 deletion sdk/subscription/arm-subscriptions/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
8 changes: 4 additions & 4 deletions sdk/subscription/arm-subscriptions/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "52a770004c3019a067e9dcdbb2e95b4992d42728",
"commit": "d2727fbd936749411dc88963ef9dfd6d044a0204",
"readme": "specification/subscription/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\\subscription\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true",
"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/subscription/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.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/typescript@6.0.0-rc.3.20221108.1"
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.0",
"use": "@autorest/typescript@6.0.0-rc.10"
}
23 changes: 8 additions & 15 deletions sdk/subscription/arm-subscriptions/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 SubscriptionClient.",
"version": "5.1.1",
"version": "5.2.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": "~5.0.0",
"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/subscription/arm-subscriptions",
"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-subscriptions?view=azure-node-preview"
}
}
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/subscription/arm-subscriptions"
}
36 changes: 32 additions & 4 deletions sdk/subscription/arm-subscriptions/review/arm-subscriptions.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
export type AcceptOwnership = string;
Expand Down Expand Up @@ -42,7 +42,7 @@ export interface AcceptOwnershipStatusResponse {

// @public
export interface Alias {
beginCreate(aliasName: string, body: PutAliasRequest, options?: AliasCreateOptionalParams): Promise<PollerLike<PollOperationState<AliasCreateResponse>, AliasCreateResponse>>;
beginCreate(aliasName: string, body: PutAliasRequest, options?: AliasCreateOptionalParams): Promise<SimplePollerLike<OperationState<AliasCreateResponse>, AliasCreateResponse>>;
beginCreateAndWait(aliasName: string, body: PutAliasRequest, options?: AliasCreateOptionalParams): Promise<AliasCreateResponse>;
delete(aliasName: string, options?: AliasDeleteOptionalParams): Promise<void>;
get(aliasName: string, options?: AliasGetOptionalParams): Promise<AliasGetResponse>;
Expand Down Expand Up @@ -378,6 +378,8 @@ export class SubscriptionClient extends coreClient.ServiceClient {
// (undocumented)
operations: Operations;
// (undocumented)
subscriptionOperation: SubscriptionOperation;
// (undocumented)
subscriptionOperations: SubscriptionOperations;
// (undocumented)
subscriptionPolicy: SubscriptionPolicy;
Expand All @@ -393,6 +395,11 @@ export interface SubscriptionClientOptionalParams extends coreClient.ServiceClie
endpoint?: string;
}

// @public
export interface SubscriptionCreationResult {
subscriptionLink?: string;
}

// @public
export interface SubscriptionEnableOptionalParams extends coreClient.OperationOptions {
}
Expand All @@ -411,10 +418,31 @@ export interface SubscriptionName {
subscriptionName?: string;
}

// @public
export interface SubscriptionOperation {
beginGet(operationId: string, options?: SubscriptionOperationGetOptionalParams): Promise<SimplePollerLike<OperationState<SubscriptionOperationGetResponse>, SubscriptionOperationGetResponse>>;
beginGetAndWait(operationId: string, options?: SubscriptionOperationGetOptionalParams): Promise<SubscriptionOperationGetResponse>;
}

// @public
export interface SubscriptionOperationGetHeaders {
location?: string;
retryAfter?: number;
}

// @public
export interface SubscriptionOperationGetOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}

// @public
export type SubscriptionOperationGetResponse = SubscriptionCreationResult;

// @public
export interface SubscriptionOperations {
acceptOwnershipStatus(subscriptionId: string, options?: SubscriptionAcceptOwnershipStatusOptionalParams): Promise<SubscriptionAcceptOwnershipStatusResponse>;
beginAcceptOwnership(subscriptionId: string, body: AcceptOwnershipRequest, options?: SubscriptionAcceptOwnershipOptionalParams): Promise<PollerLike<PollOperationState<SubscriptionAcceptOwnershipResponse>, SubscriptionAcceptOwnershipResponse>>;
beginAcceptOwnership(subscriptionId: string, body: AcceptOwnershipRequest, options?: SubscriptionAcceptOwnershipOptionalParams): Promise<SimplePollerLike<OperationState<SubscriptionAcceptOwnershipResponse>, SubscriptionAcceptOwnershipResponse>>;
beginAcceptOwnershipAndWait(subscriptionId: string, body: AcceptOwnershipRequest, options?: SubscriptionAcceptOwnershipOptionalParams): Promise<SubscriptionAcceptOwnershipResponse>;
cancel(subscriptionId: string, options?: SubscriptionCancelOptionalParams): Promise<SubscriptionCancelResponse>;
enable(subscriptionId: string, options?: SubscriptionEnableOptionalParams): Promise<SubscriptionEnableResponse>;
Expand Down
54 changes: 31 additions & 23 deletions sdk/subscription/arm-subscriptions/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
});
}
};
}
26 changes: 26 additions & 0 deletions sdk/subscription/arm-subscriptions/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ export interface EnabledSubscriptionId {
readonly subscriptionId?: string;
}

/** The created subscription object. */
export interface SubscriptionCreationResult {
/** The link to the new subscription. Use this link to check the status of subscription creation operation. */
subscriptionLink?: string;
}

/** Result of the request to list operations. It contains a list of operations and a URL link to get the next set of results. */
export interface OperationListResult {
/** List of operations. */
Expand Down Expand Up @@ -546,6 +552,14 @@ export interface SubscriptionAcceptOwnershipHeaders {
retryAfter?: number;
}

/** Defines headers for SubscriptionOperation_get operation. */
export interface SubscriptionOperationGetHeaders {
/** The URL where the status of the asynchronous operation can be checked. */
location?: string;
/** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */
retryAfter?: number;
}

/** Known values of {@link Workload} that the service accepts. */
export enum KnownWorkload {
/** Production */
Expand Down Expand Up @@ -742,6 +756,18 @@ export interface SubscriptionAcceptOwnershipStatusOptionalParams
/** Contains response data for the acceptOwnershipStatus operation. */
export type SubscriptionAcceptOwnershipStatusResponse = AcceptOwnershipStatusResponse;

/** Optional parameters. */
export interface SubscriptionOperationGetOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}

/** Contains response data for the get operation. */
export type SubscriptionOperationGetResponse = SubscriptionCreationResult;

/** Optional parameters. */
export interface OperationsListOptionalParams
extends coreClient.OperationOptions {}
Expand Down
Loading

0 comments on commit e7d8877

Please sign in to comment.