Skip to content

Commit 17cc871

Browse files
author
SDKAuto
committed
CodeGen from PR 18304 in Azure/azure-rest-api-specs
Merge 94b8920a2d2efa72e5b0cfd099fd00c46ca00c9e into 19a632e2a2061888ce87446948e6b497dc835f5b
1 parent 1f574ef commit 17cc871

File tree

9 files changed

+144
-64
lines changed

9 files changed

+144
-64
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/batch/arm-batch/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 7.1.0 (2022-03-02)
3+
## 7.1.0 (2022-03-17)
44

55
**Features**
66

sdk/batch/arm-batch/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Batch Client
1616
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
1717
- Latest versions of Safari, Chrome, Edge and Firefox.
1818

19-
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
20-
2119
### Prerequisites
2220

2321
- An [Azure subscription][azure_sub].
@@ -51,17 +49,8 @@ For more information about how to create an Azure AD Application check out [this
5149
```javascript
5250
const { BatchManagementClient } = require("@azure/arm-batch");
5351
const { DefaultAzureCredential } = require("@azure/identity");
54-
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
55-
5652
const subscriptionId = "00000000-0000-0000-0000-000000000000";
5753
const client = new BatchManagementClient(new DefaultAzureCredential(), subscriptionId);
58-
59-
// For client-side applications running in the browser, use this code instead:
60-
// const credential = new InteractiveBrowserCredential({
61-
// tenantId: "<YOUR_TENANT_ID>",
62-
// clientId: "<YOUR_CLIENT_ID>"
63-
// });
64-
// const client = new BatchManagementClient(credential, subscriptionId);
6554
```
6655

6756

sdk/batch/arm-batch/_meta.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"commit": "4042a47cff72c950d35dd72149895b044ed79713",
2+
"commit": "f62e24abdf1eda35411e63e20c919360c907c87a",
33
"readme": "specification/batch/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:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\batch\\resource-manager\\readme.md --use=@autorest/[email protected]beta.16 --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=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/batch/resource-manager/readme.md --use=@autorest/[email protected]alpha.16.20220105.1",
55
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6-
"use": "@autorest/[email protected]"
6+
"release_tool": "@azure-tools/[email protected]",
7+
"use": "@autorest/[email protected]"
78
}

sdk/batch/arm-batch/package.json

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,20 @@
2929
"types": "./types/arm-batch.d.ts",
3030
"devDependencies": {
3131
"@microsoft/api-extractor": "^7.18.11",
32-
"@rollup/plugin-commonjs": "^21.0.1",
33-
"@rollup/plugin-json": "^4.1.0",
34-
"@rollup/plugin-multi-entry": "^4.1.0",
35-
"@rollup/plugin-node-resolve": "^13.1.3",
32+
"@rollup/plugin-commonjs": "11.0.2",
33+
"@rollup/plugin-json": "^4.0.0",
34+
"@rollup/plugin-multi-entry": "^3.0.0",
35+
"@rollup/plugin-node-resolve": "^8.0.0",
3636
"mkdirp": "^1.0.4",
37-
"rollup": "^2.66.1",
38-
"rollup-plugin-sourcemaps": "^0.6.3",
37+
"rollup": "^1.16.3",
38+
"rollup-plugin-sourcemaps": "^0.4.2",
3939
"typescript": "~4.2.0",
4040
"uglify-js": "^3.4.9",
4141
"rimraf": "^3.0.0",
4242
"@azure/identity": "^2.0.1",
4343
"@azure-tools/test-recorder": "^1.0.0",
4444
"mocha": "^7.1.1",
45-
"cross-env": "^7.0.2",
46-
"@azure/arm-storage": "^17.1.0"
45+
"cross-env": "^7.0.2"
4746
},
4847
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/batch/arm-batch",
4948
"repository": {
@@ -99,21 +98,5 @@
9998
"docs": "echo skipped"
10099
},
101100
"sideEffects": false,
102-
"//metadata": {
103-
"constantPaths": [
104-
{
105-
"path": "src/batchManagementClient.ts",
106-
"prefix": "packageDetails"
107-
}
108-
]
109-
},
110-
"autoPublish": true,
111-
"//sampleConfiguration": {
112-
"productName": "",
113-
"productSlugs": [
114-
"azure"
115-
],
116-
"disableDocsMs": true,
117-
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-batch?view=azure-node-preview"
118-
}
119-
}
101+
"autoPublish": true
102+
}

sdk/batch/arm-batch/rollup.config.js

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,62 @@ import json from "@rollup/plugin-json";
1414

1515
import nodeBuiltins from "builtin-modules";
1616

17+
/**
18+
* Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19+
*
20+
* NOTE: this manual configuration is only needed because OpenTelemetry uses an
21+
* __exportStar downleveled helper function to declare its exports which confuses
22+
* rollup's automatic discovery mechanism.
23+
*
24+
* @returns an object reference that can be `...`'d into your cjs() configuration.
25+
*/
26+
export function openTelemetryCommonJs() {
27+
const namedExports = {};
28+
29+
for (const key of [
30+
"@opentelemetry/api",
31+
"@azure/core-tracing/node_modules/@opentelemetry/api"
32+
]) {
33+
namedExports[key] = [
34+
"SpanKind",
35+
"TraceFlags",
36+
"getSpan",
37+
"setSpan",
38+
"SpanStatusCode",
39+
"getSpanContext",
40+
"setSpanContext"
41+
];
42+
}
43+
44+
const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45+
46+
for (const version of releasedOpenTelemetryVersions) {
47+
namedExports[
48+
// working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49+
`../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50+
] = [
51+
"SpanKind",
52+
"TraceFlags",
53+
"getSpan",
54+
"setSpan",
55+
"StatusCode",
56+
"CanonicalCode",
57+
"getSpanContext",
58+
"setSpanContext"
59+
];
60+
}
61+
62+
return namedExports;
63+
}
64+
1765
// #region Warning Handler
1866

1967
/**
20-
* A function that can determine whether a rollup warning should be ignored. If
68+
* A function that can determine whether a rollupwarning should be ignored. If
2169
* the function returns `true`, then the warning will not be displayed.
2270
*/
2371

24-
function ignoreNiseSinonEval(warning) {
72+
function ignoreNiseSinonEvalWarnings(warning) {
2573
return (
2674
warning.code === "EVAL" &&
2775
warning.id &&
@@ -30,14 +78,17 @@ function ignoreNiseSinonEval(warning) {
3078
);
3179
}
3280

33-
function ignoreChaiCircularDependency(warning) {
81+
function ignoreChaiCircularDependencyWarnings(warning) {
3482
return (
3583
warning.code === "CIRCULAR_DEPENDENCY" &&
3684
warning.importer && warning.importer.includes("node_modules/chai") === true
3785
);
3886
}
3987

40-
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
88+
const warningInhibitors = [
89+
ignoreChaiCircularDependencyWarnings,
90+
ignoreNiseSinonEvalWarnings
91+
];
4192

4293
/**
4394
* Construct a warning handler for the shared rollup configuration
@@ -71,7 +122,22 @@ function makeBrowserTestConfig() {
71122
nodeResolve({
72123
mainFields: ["module", "browser"]
73124
}),
74-
cjs(),
125+
cjs({
126+
namedExports: {
127+
// Chai's strange internal architecture makes it impossible to statically
128+
// analyze its exports.
129+
chai: [
130+
"version",
131+
"use",
132+
"util",
133+
"config",
134+
"expect",
135+
"should",
136+
"assert"
137+
],
138+
...openTelemetryCommonJs()
139+
}
140+
}),
75141
json(),
76142
sourcemaps()
77143
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
@@ -107,7 +173,7 @@ export function makeConfig(pkg, options) {
107173
],
108174
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
109175
preserveSymlinks: false,
110-
plugins: [sourcemaps(), nodeResolve()]
176+
plugins: [sourcemaps(), nodeResolve(), cjs()]
111177
};
112178

113179
const config = [baseConfig];

sdk/batch/arm-batch/src/models/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ export interface StartTask {
771771
environmentSettings?: EnvironmentSetting[];
772772
/** If omitted, the task runs as a non-administrative user unique to the task. */
773773
userIdentity?: UserIdentity;
774-
/** The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. */
774+
/** The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit, however this is not recommended for a start task or any task. The default value is 0 (no retries). */
775775
maxTaskRetryCount?: number;
776776
/** If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. */
777777
waitForSuccess?: boolean;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
import {
10+
env,
11+
record,
12+
RecorderEnvironmentSetup,
13+
Recorder
14+
} from "@azure-tools/test-recorder";
15+
import * as assert from "assert";
16+
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: []
32+
};
33+
34+
describe("My test", () => {
35+
let recorder: Recorder;
36+
37+
beforeEach(async function() {
38+
recorder = record(this, recorderEnvSetup);
39+
});
40+
41+
afterEach(async function() {
42+
await recorder.stop();
43+
});
44+
45+
it("sample test", async function() {
46+
console.log("Hi, I'm a test!");
47+
});
48+
});

sdk/batch/arm-batch/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-batch": [
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)