Skip to content

Commit 80e8bd5

Browse files
author
SDKAuto
committed
CodeGen from PR 18996 in Azure/azure-rest-api-specs
Merge 2a781ad77e4b5072d3c6a1f5ba5462f9539fb989 into ac286e05bedd69d301e1dc94ec70f66e8536686b
1 parent 427f8e6 commit 80e8bd5

File tree

8 files changed

+72
-65
lines changed

8 files changed

+72
-65
lines changed

sdk/appconfiguration/arm-appconfiguration/CHANGELOG.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
# Release History
2+
3+
## 3.0.0 (2022-05-11)
24

3-
## 3.0.0-beta.5 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
12-
13-
## 3.0.0-beta.4 (2022-04-14)
14-
15-
The package of @azure/arm-appconfiguration is using our next generation design principles since version 3.0.0-beta.4, which contains breaking changes.
5+
The package of @azure/arm-appconfiguration is using our next generation design principles since version 3.0.0, which contains breaking changes.
166

177
To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog).
188

sdk/appconfiguration/arm-appconfiguration/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f
66

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

1212
## Getting started
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"commit": "cb00f6da00f783f26204f30ef4d57478cdccbeba",
2+
"commit": "e1f482ee1873ca7c545c7ddf0fd7a7beeb4a597c",
33
"readme": "specification/appconfiguration/resource-manager/readme.md",
4-
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\appconfiguration\\resource-manager\\readme.md --use=@autorest/[email protected].20220408.1 --generate-sample=true",
4+
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --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/appconfiguration/resource-manager/readme.md --use=@autorest/[email protected].20220425.1",
55
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6-
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.6",
7-
"use": "@autorest/[email protected].20220408.1"
6+
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.0",
7+
"use": "@autorest/[email protected].20220425.1"
88
}

sdk/appconfiguration/arm-appconfiguration/package.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"sdk-type": "mgmt",
44
"author": "Microsoft Corporation",
55
"description": "A generated SDK for AppConfigurationManagementClient.",
6-
"version": "3.0.0-beta.5",
6+
"version": "3.0.0",
77
"engines": {
88
"node": ">=12.0.0"
99
},
@@ -40,9 +40,11 @@
4040
"uglify-js": "^3.4.9",
4141
"rimraf": "^3.0.0",
4242
"@azure/identity": "^2.0.1",
43-
"@azure-tools/test-recorder": "^1.0.0",
43+
"@azure-tools/test-recorder": "^2.0.0",
44+
"@azure-tools/test-credential": "^1.0.0",
4445
"mocha": "^7.1.1",
45-
"cross-env": "^7.0.2"
46+
"cross-env": "^7.0.2",
47+
"@azure/dev-tool": "^1.0.0"
4648
},
4749
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appconfiguration/arm-appconfiguration",
4850
"repository": {
@@ -93,7 +95,7 @@
9395
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
9496
"unit-test:browser": "echo skipped",
9597
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
96-
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
98+
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
9799
"integration-test:browser": "echo skipped",
98100
"docs": "echo skipped"
99101
},
@@ -106,13 +108,5 @@
106108
}
107109
]
108110
},
109-
"autoPublish": true,
110-
"//sampleConfiguration": {
111-
"productName": "",
112-
"productSlugs": [
113-
"azure"
114-
],
115-
"disableDocsMs": true,
116-
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-appconfiguration?view=azure-node-preview"
117-
}
118-
}
111+
"autoPublish": true
112+
}

sdk/appconfiguration/arm-appconfiguration/src/appConfigurationManagementClient.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
import * as coreClient from "@azure/core-client";
1010
import * as coreRestPipeline from "@azure/core-rest-pipeline";
11+
import {
12+
PipelineRequest,
13+
PipelineResponse,
14+
SendRequest
15+
} from "@azure/core-rest-pipeline";
1116
import * as coreAuth from "@azure/core-auth";
1217
import {
1318
ConfigurationStoresImpl,
@@ -57,7 +62,7 @@ export class AppConfigurationManagementClient extends coreClient.ServiceClient {
5762
credential: credentials
5863
};
5964

60-
const packageDetails = `azsdk-js-arm-appconfiguration/3.0.0-beta.5`;
65+
const packageDetails = `azsdk-js-arm-appconfiguration/3.0.0`;
6166
const userAgentPrefix =
6267
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
6368
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -104,12 +109,41 @@ export class AppConfigurationManagementClient extends coreClient.ServiceClient {
104109

105110
// Assigning values to Constant parameters
106111
this.$host = options.$host || "https://management.azure.com";
107-
this.apiVersion = options.apiVersion || "2021-10-01-preview";
112+
this.apiVersion = options.apiVersion || "2022-05-01";
108113
this.configurationStores = new ConfigurationStoresImpl(this);
109114
this.operations = new OperationsImpl(this);
110115
this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this);
111116
this.privateLinkResources = new PrivateLinkResourcesImpl(this);
112117
this.keyValues = new KeyValuesImpl(this);
118+
this.addCustomApiVersionPolicy(options.apiVersion);
119+
}
120+
121+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
122+
private addCustomApiVersionPolicy(apiVersion?: string) {
123+
if (!apiVersion) {
124+
return;
125+
}
126+
const apiVersionPolicy = {
127+
name: "CustomApiVersionPolicy",
128+
async sendRequest(
129+
request: PipelineRequest,
130+
next: SendRequest
131+
): Promise<PipelineResponse> {
132+
const param = request.url.split("?");
133+
if (param.length > 1) {
134+
const newParams = param[1].split("&").map((item) => {
135+
if (item.indexOf("api-version") > -1) {
136+
return item.replace(/(?<==).*$/, apiVersion);
137+
} else {
138+
return item;
139+
}
140+
});
141+
request.url = param[0] + "?" + newParams.join("&");
142+
}
143+
return next(request);
144+
}
145+
};
146+
this.pipeline.addPolicy(apiVersionPolicy);
113147
}
114148

115149
configurationStores: ConfigurationStores;

sdk/appconfiguration/arm-appconfiguration/src/models/parameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const subscriptionId: OperationURLParameter = {
5858
export const apiVersion: OperationQueryParameter = {
5959
parameterPath: "apiVersion",
6060
mapper: {
61-
defaultValue: "2021-10-01-preview",
61+
defaultValue: "2022-05-01",
6262
isConstant: true,
6363
serializedName: "api-version",
6464
type: {

sdk/appconfiguration/arm-appconfiguration/test/sampleTest.ts

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,30 @@
77
*/
88

99
import {
10-
env,
11-
record,
12-
RecorderEnvironmentSetup,
13-
Recorder
10+
Recorder,
11+
RecorderStartOptions,
12+
env
1413
} from "@azure-tools/test-recorder";
15-
import * as assert from "assert";
14+
import { assert } from "chai";
15+
import { Context } from "mocha";
1616

17-
const recorderEnvSetup: RecorderEnvironmentSetup = {
18-
replaceableVariables: {
19-
AZURE_CLIENT_ID: "azure_client_id",
20-
AZURE_CLIENT_SECRET: "azure_client_secret",
21-
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
22-
SUBSCRIPTION_ID: "azure_subscription_id"
23-
},
24-
customizationsOnRecordings: [
25-
(recording: any): any =>
26-
recording.replace(
27-
/"access_token":"[^"]*"/g,
28-
`"access_token":"access_token"`
29-
)
30-
],
31-
queryParametersToSkip: []
17+
const replaceableVariables: Record<string, string> = {
18+
AZURE_CLIENT_ID: "azure_client_id",
19+
AZURE_CLIENT_SECRET: "azure_client_secret",
20+
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
21+
SUBSCRIPTION_ID: "azure_subscription_id"
22+
};
23+
24+
const recorderOptions: RecorderStartOptions = {
25+
envSetupForPlayback: replaceableVariables
3226
};
3327

3428
describe("My test", () => {
3529
let recorder: Recorder;
3630

37-
beforeEach(async function() {
38-
recorder = record(this, recorderEnvSetup);
31+
beforeEach(async function(this: Context) {
32+
recorder = new Recorder(this.currentTest);
33+
await recorder.start(recorderOptions);
3934
});
4035

4136
afterEach(async function() {

sdk/appconfiguration/arm-appconfiguration/tsconfig.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@
1515
],
1616
"declaration": true,
1717
"outDir": "./dist-esm",
18-
"importHelpers": true,
19-
"paths": {
20-
"@azure/arm-appconfiguration": [
21-
"./src/index"
22-
]
23-
}
18+
"importHelpers": true
2419
},
2520
"include": [
2621
"./src/**/*.ts",
27-
"./test/**/*.ts",
28-
"samples-dev/**/*.ts"
22+
"./test/**/*.ts"
2923
],
3024
"exclude": [
3125
"node_modules"

0 commit comments

Comments
 (0)