Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR @azure/arm-synapse] Added final state-async operation #5177

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions common/config/rush/pnpm-lock.yaml

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

14 changes: 2 additions & 12 deletions sdk/synapse/arm-synapse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Release History

## 9.0.0-beta.2 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 9.0.0-beta.1 (2023-02-08)

## 9.0.0-beta.2 (2023-05-24)

**Features**

Expand Down
10 changes: 5 additions & 5 deletions sdk/synapse/arm-synapse/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "340d577969b7bff5ad0488d79543314bc17daa50",
"readme": "specification\\synapse\\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=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\synapse\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --generate-sample=true",
"commit": "3456516f536b45826e4074516bb4a1657edf5f76",
"readme": "specification/synapse/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/synapse/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.6.1",
"use": "@autorest/typescript@6.0.0-rc.7"
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.0",
"use": "@autorest/typescript@6.0.0-rc.10"
}
22 changes: 7 additions & 15 deletions sdk/synapse/arm-synapse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"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,13 +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": "^8.2.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 Down Expand Up @@ -111,13 +111,5 @@
]
},
"autoPublish": true,
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/synapse/arm-synapse",
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-synapse?view=azure-node-preview"
}
}
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/synapse/arm-synapse"
}
144 changes: 72 additions & 72 deletions sdk/synapse/arm-synapse/review/arm-synapse.api.md

Large diffs are not rendered by default.

54 changes: 31 additions & 23 deletions sdk/synapse/arm-synapse/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
});
}
};
}
36 changes: 25 additions & 11 deletions sdk/synapse/arm-synapse/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,11 @@ export interface LibraryInfo {
path?: string;
/** Storage blob container name. */
containerName?: string;
/** The last update time of the library. */
uploadedTimestamp?: Date;
/**
* The last update time of the library.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly uploadedTimestamp?: Date;
/** Type of the library. */
type?: string;
/**
Expand Down Expand Up @@ -2643,6 +2646,10 @@ export interface SelfHostedIntegrationRuntimeStatus
serviceRegion?: string;
/** The newer versions on download center. */
newerVersions?: string[];
/** NOTE: This property will not be serialized. It can only be populated by the server. */
readonly osType?: number;
/** NOTE: This property will not be serialized. It can only be populated by the server. */
readonly targetFramework?: number;
}

/** Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls. */
Expand Down Expand Up @@ -4143,8 +4150,11 @@ export interface Workspace extends TrackedResource {
sqlAdministratorLogin?: string;
/** Virtual Network profile */
virtualNetworkProfile?: VirtualNetworkProfile;
/** Connectivity endpoints */
connectivityEndpoints?: { [propertyName: string]: string };
/**
* Connectivity endpoints
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly connectivityEndpoints?: { [propertyName: string]: string };
/** Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user. */
managedVirtualNetwork?: string;
/** Private endpoint connections to the workspace */
Expand All @@ -4160,9 +4170,7 @@ export interface Workspace extends TrackedResource {
* Workspace level configs and feature flags
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly extraProperties?: {
[propertyName: string]: Record<string, unknown>;
};
readonly extraProperties?: Record<string, unknown>;
/** Managed Virtual Network Settings */
managedVirtualNetworkSettings?: ManagedVirtualNetworkSettings;
/** Git integration settings */
Expand Down Expand Up @@ -4208,8 +4216,11 @@ export interface BigDataPoolResourceInfo extends TrackedResource {
isAutotuneEnabled?: boolean;
/** Whether session level packages enabled. */
sessionLevelPackagesEnabled?: boolean;
/** The cache size */
cacheSize?: number;
/**
* The cache size
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly cacheSize?: number;
/** Dynamic Executor Allocation */
dynamicExecutorAllocation?: DynamicExecutorAllocation;
/** The Spark events folder */
Expand Down Expand Up @@ -4444,8 +4455,11 @@ export interface LibraryResource extends SubResource {
path?: string;
/** Storage blob container name. */
containerName?: string;
/** The last update time of the library. */
uploadedTimestamp?: Date;
/**
* The last update time of the library.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly uploadedTimestamp?: Date;
/** Type of the library. */
typePropertiesType?: string;
/**
Expand Down
22 changes: 19 additions & 3 deletions sdk/synapse/arm-synapse/src/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,7 @@ export const LibraryInfo: coreClient.CompositeMapper = {
},
uploadedTimestamp: {
serializedName: "uploadedTimestamp",
readOnly: true,
type: {
name: "DateTime"
}
Expand Down Expand Up @@ -6229,6 +6230,20 @@ export const SelfHostedIntegrationRuntimeStatus: coreClient.CompositeMapper = {
}
}
}
},
osType: {
serializedName: "typeProperties.osType",
readOnly: true,
type: {
name: "Number"
}
},
targetFramework: {
serializedName: "typeProperties.targetFramework",
readOnly: true,
type: {
name: "Number"
}
}
}
}
Expand Down Expand Up @@ -8835,6 +8850,7 @@ export const Workspace: coreClient.CompositeMapper = {
},
connectivityEndpoints: {
serializedName: "properties.connectivityEndpoints",
readOnly: true,
type: {
name: "Dictionary",
value: { type: { name: "String" } }
Expand Down Expand Up @@ -8877,9 +8893,7 @@ export const Workspace: coreClient.CompositeMapper = {
readOnly: true,
type: {
name: "Dictionary",
value: {
type: { name: "Dictionary", value: { type: { name: "any" } } }
}
value: { type: { name: "any" } }
}
},
managedVirtualNetworkSettings: {
Expand Down Expand Up @@ -9003,6 +9017,7 @@ export const BigDataPoolResourceInfo: coreClient.CompositeMapper = {
},
cacheSize: {
serializedName: "properties.cacheSize",
readOnly: true,
type: {
name: "Number"
}
Expand Down Expand Up @@ -9538,6 +9553,7 @@ export const LibraryResource: coreClient.CompositeMapper = {
},
uploadedTimestamp: {
serializedName: "properties.uploadedTimestamp",
readOnly: true,
type: {
name: "DateTime"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SynapseManagementClient } from "../synapseManagementClient";
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
import { LroImpl } from "../lroImpl";
import {
SimplePollerLike,
OperationState,
createHttpPoller
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
AzureADOnlyAuthentication,
AzureADOnlyAuthenticationsListNextOptionalParams,
Expand Down Expand Up @@ -157,8 +161,8 @@ export class AzureADOnlyAuthenticationsImpl
azureADOnlyAuthenticationInfo: AzureADOnlyAuthentication,
options?: AzureADOnlyAuthenticationsCreateOptionalParams
): Promise<
PollerLike<
PollOperationState<AzureADOnlyAuthenticationsCreateResponse>,
SimplePollerLike<
OperationState<AzureADOnlyAuthenticationsCreateResponse>,
AzureADOnlyAuthenticationsCreateResponse
>
> {
Expand All @@ -168,7 +172,7 @@ export class AzureADOnlyAuthenticationsImpl
): Promise<AzureADOnlyAuthenticationsCreateResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperation = async (
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
Expand Down Expand Up @@ -201,21 +205,24 @@ export class AzureADOnlyAuthenticationsImpl
};
};

const lro = new LroImpl(
sendOperation,
{
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
workspaceName,
azureADOnlyAuthenticationName,
azureADOnlyAuthenticationInfo,
options
},
createOperationSpec
);
const poller = new LroEngine(lro, {
resumeFrom: options?.resumeFrom,
spec: createOperationSpec
});
const poller = await createHttpPoller<
AzureADOnlyAuthenticationsCreateResponse,
OperationState<AzureADOnlyAuthenticationsCreateResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
lroResourceLocationConfig: "location"
resourceLocationConfig: "location"
});
await poller.poll();
return poller;
Expand Down
Loading