@azure/arm-oep 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.js +135 -33
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +19 -2
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +17 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts +2 -0
- package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts.map +1 -1
- package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js +49 -18
- package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js.map +1 -1
- package/dist-esm/src/operations/energyServices.d.ts.map +1 -1
- package/dist-esm/src/operations/energyServices.js +37 -14
- package/dist-esm/src/operations/energyServices.js.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/test/sampleTest.js +11 -13
- package/dist-esm/test/sampleTest.js.map +1 -1
- package/package.json +15 -11
- package/review/arm-oep.api.md +7 -20
- package/src/index.ts +1 -0
- package/src/models/index.ts +19 -2
- package/src/openEnergyPlatformManagementServiceAPIs.ts +60 -20
- package/src/operations/energyServices.ts +45 -16
- package/src/pagingHelper.ts +39 -0
- package/types/arm-oep.d.ts +30 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
const pageMap = new WeakMap();
|
|
9
|
+
/**
|
|
10
|
+
* Given a result page from a pageable operation, returns a
|
|
11
|
+
* continuation token that can be used to begin paging from
|
|
12
|
+
* that point later.
|
|
13
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
14
|
+
* @returns The continuation token that can be passed into byPage().
|
|
15
|
+
*/
|
|
16
|
+
export function getContinuationToken(page) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (typeof page !== "object" || page === null) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
|
|
22
|
+
}
|
|
23
|
+
export function setContinuationToken(page, continuationToken) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
|
|
29
|
+
pageInfo.continuationToken = continuationToken;
|
|
30
|
+
pageMap.set(page, pageInfo);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=pagingHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagingHelper.js","sourceRoot":"","sources":["../../src/pagingHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;QAC7C,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAE,iBAAiB,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,iBAAqC;;IAErC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,iBAAiB,EAAE;QACnE,OAAO;KACR;IACD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -6,24 +6,22 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
import { __awaiter } from "tslib";
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(recording) => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`)
|
|
19
|
-
],
|
|
20
|
-
queryParametersToSkip: []
|
|
9
|
+
import { Recorder } from "@azure-tools/test-recorder";
|
|
10
|
+
const replaceableVariables = {
|
|
11
|
+
AZURE_CLIENT_ID: "azure_client_id",
|
|
12
|
+
AZURE_CLIENT_SECRET: "azure_client_secret",
|
|
13
|
+
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
|
|
14
|
+
SUBSCRIPTION_ID: "azure_subscription_id"
|
|
15
|
+
};
|
|
16
|
+
const recorderOptions = {
|
|
17
|
+
envSetupForPlayback: replaceableVariables
|
|
21
18
|
};
|
|
22
19
|
describe("My test", () => {
|
|
23
20
|
let recorder;
|
|
24
21
|
beforeEach(function () {
|
|
25
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
recorder =
|
|
23
|
+
recorder = new Recorder(this.currentTest);
|
|
24
|
+
yield recorder.start(recorderOptions);
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
27
|
afterEach(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAIpC,MAAM,oBAAoB,GAA2B;IACnD,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,sCAAsC;IACvD,eAAe,EAAE,uBAAuB;CACzC,CAAC;AAEF,MAAM,eAAe,GAAyB;IAC5C,mBAAmB,EAAE,oBAAoB;CAC1C,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,QAAkB,CAAC;IAEvB,UAAU,CAAC;;YACT,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC;KAAA,CAAC,CAAC;IAEH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"sdk-type": "mgmt",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "A generated SDK for OpenEnergyPlatformManagementServiceAPIs.",
|
|
6
|
-
"version": "1.0.0-beta.
|
|
6
|
+
"version": "1.0.0-beta.3",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=
|
|
8
|
+
"node": ">=14.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@azure/core-lro": "^2.2.0",
|
|
12
12
|
"@azure/abort-controller": "^1.0.0",
|
|
13
13
|
"@azure/core-paging": "^1.2.0",
|
|
14
|
-
"@azure/core-client": "^1.
|
|
14
|
+
"@azure/core-client": "^1.6.1",
|
|
15
15
|
"@azure/core-auth": "^1.3.0",
|
|
16
16
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
17
17
|
"tslib": "^2.2.0"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"module": "./dist-esm/src/index.js",
|
|
29
29
|
"types": "./types/arm-oep.d.ts",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@microsoft/api-extractor": "7.
|
|
31
|
+
"@microsoft/api-extractor": "^7.31.1",
|
|
32
32
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
33
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
34
34
|
"@rollup/plugin-multi-entry": "^4.1.0",
|
|
@@ -36,13 +36,18 @@
|
|
|
36
36
|
"mkdirp": "^1.0.4",
|
|
37
37
|
"rollup": "^2.66.1",
|
|
38
38
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
39
|
-
"typescript": "~4.
|
|
39
|
+
"typescript": "~4.8.0",
|
|
40
40
|
"uglify-js": "^3.4.9",
|
|
41
41
|
"rimraf": "^3.0.0",
|
|
42
42
|
"@azure/identity": "^2.0.1",
|
|
43
|
-
"@azure-tools/test-recorder": "^
|
|
43
|
+
"@azure-tools/test-recorder": "^2.0.0",
|
|
44
|
+
"@azure-tools/test-credential": "^1.0.0",
|
|
44
45
|
"mocha": "^7.1.1",
|
|
45
|
-
"
|
|
46
|
+
"@types/chai": "^4.2.8",
|
|
47
|
+
"chai": "^4.2.0",
|
|
48
|
+
"cross-env": "^7.0.2",
|
|
49
|
+
"@types/node": "^14.0.0",
|
|
50
|
+
"@azure/dev-tool": "^1.0.0"
|
|
46
51
|
},
|
|
47
52
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/oep/arm-oep",
|
|
48
53
|
"repository": {
|
|
@@ -93,9 +98,8 @@
|
|
|
93
98
|
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
|
|
94
99
|
"unit-test:browser": "echo skipped",
|
|
95
100
|
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
96
|
-
"integration-test:node": "
|
|
97
|
-
"integration-test:browser": "echo skipped"
|
|
98
|
-
"docs": "echo skipped"
|
|
101
|
+
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
|
|
102
|
+
"integration-test:browser": "echo skipped"
|
|
99
103
|
},
|
|
100
104
|
"sideEffects": false,
|
|
101
105
|
"//metadata": {
|
|
@@ -115,4 +119,4 @@
|
|
|
115
119
|
"disableDocsMs": true,
|
|
116
120
|
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-oep?view=azure-node-preview"
|
|
117
121
|
}
|
|
118
|
-
}
|
|
122
|
+
}
|
package/review/arm-oep.api.md
CHANGED
|
@@ -46,13 +46,14 @@ export interface EnergyResourceUpdate {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// @public (undocumented)
|
|
49
|
-
export
|
|
49
|
+
export interface EnergyService extends Resource {
|
|
50
|
+
location: string;
|
|
51
|
+
// (undocumented)
|
|
50
52
|
properties?: EnergyServiceProperties;
|
|
51
53
|
tags?: {
|
|
52
54
|
[propertyName: string]: string;
|
|
53
55
|
};
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
+
}
|
|
56
57
|
|
|
57
58
|
// @public
|
|
58
59
|
export interface EnergyServiceList {
|
|
@@ -162,57 +163,43 @@ export interface ErrorResponse {
|
|
|
162
163
|
error?: ErrorDetail;
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
// @public
|
|
167
|
+
export function getContinuationToken(page: unknown): string | undefined;
|
|
168
|
+
|
|
165
169
|
// @public
|
|
166
170
|
export enum KnownActionType {
|
|
167
|
-
// (undocumented)
|
|
168
171
|
Internal = "Internal"
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
// @public
|
|
172
175
|
export enum KnownCheckNameAvailabilityReason {
|
|
173
|
-
// (undocumented)
|
|
174
176
|
AlreadyExists = "AlreadyExists",
|
|
175
|
-
// (undocumented)
|
|
176
177
|
Invalid = "Invalid"
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
// @public
|
|
180
181
|
export enum KnownCreatedByType {
|
|
181
|
-
// (undocumented)
|
|
182
182
|
Application = "Application",
|
|
183
|
-
// (undocumented)
|
|
184
183
|
Key = "Key",
|
|
185
|
-
// (undocumented)
|
|
186
184
|
ManagedIdentity = "ManagedIdentity",
|
|
187
|
-
// (undocumented)
|
|
188
185
|
User = "User"
|
|
189
186
|
}
|
|
190
187
|
|
|
191
188
|
// @public
|
|
192
189
|
export enum KnownOrigin {
|
|
193
|
-
// (undocumented)
|
|
194
190
|
System = "system",
|
|
195
|
-
// (undocumented)
|
|
196
191
|
User = "user",
|
|
197
|
-
// (undocumented)
|
|
198
192
|
UserSystem = "user,system"
|
|
199
193
|
}
|
|
200
194
|
|
|
201
195
|
// @public
|
|
202
196
|
export enum KnownProvisioningState {
|
|
203
|
-
// (undocumented)
|
|
204
197
|
Canceled = "Canceled",
|
|
205
|
-
// (undocumented)
|
|
206
198
|
Creating = "Creating",
|
|
207
|
-
// (undocumented)
|
|
208
199
|
Deleting = "Deleting",
|
|
209
|
-
// (undocumented)
|
|
210
200
|
Failed = "Failed",
|
|
211
|
-
// (undocumented)
|
|
212
201
|
Succeeded = "Succeeded",
|
|
213
|
-
// (undocumented)
|
|
214
202
|
Unknown = "Unknown",
|
|
215
|
-
// (undocumented)
|
|
216
203
|
Updating = "Updating"
|
|
217
204
|
}
|
|
218
205
|
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/// <reference lib="esnext.asynciterable" />
|
|
10
|
+
export { getContinuationToken } from "./pagingHelper";
|
|
10
11
|
export * from "./models";
|
|
11
12
|
export { OpenEnergyPlatformManagementServiceAPIs } from "./openEnergyPlatformManagementServiceAPIs";
|
|
12
13
|
export * from "./operationsInterfaces";
|
package/src/models/index.ts
CHANGED
|
@@ -207,17 +207,19 @@ export interface OperationDisplay {
|
|
|
207
207
|
readonly description?: string;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
export
|
|
210
|
+
export interface EnergyService extends Resource {
|
|
211
211
|
properties?: EnergyServiceProperties;
|
|
212
212
|
/** Resource tags. */
|
|
213
213
|
tags?: { [propertyName: string]: string };
|
|
214
214
|
/** Geo-location where the resource lives. */
|
|
215
215
|
location: string;
|
|
216
|
-
}
|
|
216
|
+
}
|
|
217
217
|
|
|
218
218
|
/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */
|
|
219
219
|
export enum KnownCheckNameAvailabilityReason {
|
|
220
|
+
/** Invalid */
|
|
220
221
|
Invalid = "Invalid",
|
|
222
|
+
/** AlreadyExists */
|
|
221
223
|
AlreadyExists = "AlreadyExists"
|
|
222
224
|
}
|
|
223
225
|
|
|
@@ -233,12 +235,19 @@ export type CheckNameAvailabilityReason = string;
|
|
|
233
235
|
|
|
234
236
|
/** Known values of {@link ProvisioningState} that the service accepts. */
|
|
235
237
|
export enum KnownProvisioningState {
|
|
238
|
+
/** Unknown */
|
|
236
239
|
Unknown = "Unknown",
|
|
240
|
+
/** Succeeded */
|
|
237
241
|
Succeeded = "Succeeded",
|
|
242
|
+
/** Failed */
|
|
238
243
|
Failed = "Failed",
|
|
244
|
+
/** Canceled */
|
|
239
245
|
Canceled = "Canceled",
|
|
246
|
+
/** Creating */
|
|
240
247
|
Creating = "Creating",
|
|
248
|
+
/** Deleting */
|
|
241
249
|
Deleting = "Deleting",
|
|
250
|
+
/** Updating */
|
|
242
251
|
Updating = "Updating"
|
|
243
252
|
}
|
|
244
253
|
|
|
@@ -259,9 +268,13 @@ export type ProvisioningState = string;
|
|
|
259
268
|
|
|
260
269
|
/** Known values of {@link CreatedByType} that the service accepts. */
|
|
261
270
|
export enum KnownCreatedByType {
|
|
271
|
+
/** User */
|
|
262
272
|
User = "User",
|
|
273
|
+
/** Application */
|
|
263
274
|
Application = "Application",
|
|
275
|
+
/** ManagedIdentity */
|
|
264
276
|
ManagedIdentity = "ManagedIdentity",
|
|
277
|
+
/** Key */
|
|
265
278
|
Key = "Key"
|
|
266
279
|
}
|
|
267
280
|
|
|
@@ -279,8 +292,11 @@ export type CreatedByType = string;
|
|
|
279
292
|
|
|
280
293
|
/** Known values of {@link Origin} that the service accepts. */
|
|
281
294
|
export enum KnownOrigin {
|
|
295
|
+
/** User */
|
|
282
296
|
User = "user",
|
|
297
|
+
/** System */
|
|
283
298
|
System = "system",
|
|
299
|
+
/** UserSystem */
|
|
284
300
|
UserSystem = "user,system"
|
|
285
301
|
}
|
|
286
302
|
|
|
@@ -297,6 +313,7 @@ export type Origin = string;
|
|
|
297
313
|
|
|
298
314
|
/** Known values of {@link ActionType} that the service accepts. */
|
|
299
315
|
export enum KnownActionType {
|
|
316
|
+
/** Internal */
|
|
300
317
|
Internal = "Internal"
|
|
301
318
|
}
|
|
302
319
|
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
|
10
10
|
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
11
|
+
import {
|
|
12
|
+
PipelineRequest,
|
|
13
|
+
PipelineResponse,
|
|
14
|
+
SendRequest
|
|
15
|
+
} from "@azure/core-rest-pipeline";
|
|
11
16
|
import * as coreAuth from "@azure/core-auth";
|
|
12
17
|
import {
|
|
13
18
|
LocationsImpl,
|
|
@@ -49,47 +54,53 @@ export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceC
|
|
|
49
54
|
credential: credentials
|
|
50
55
|
};
|
|
51
56
|
|
|
52
|
-
const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.
|
|
57
|
+
const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.3`;
|
|
53
58
|
const userAgentPrefix =
|
|
54
59
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
55
60
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
56
61
|
: `${packageDetails}`;
|
|
57
62
|
|
|
58
|
-
if (!options.credentialScopes) {
|
|
59
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
60
|
-
}
|
|
61
63
|
const optionsWithDefaults = {
|
|
62
64
|
...defaults,
|
|
63
65
|
...options,
|
|
64
66
|
userAgentOptions: {
|
|
65
67
|
userAgentPrefix
|
|
66
68
|
},
|
|
67
|
-
|
|
69
|
+
endpoint:
|
|
68
70
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
69
71
|
};
|
|
70
72
|
super(optionsWithDefaults);
|
|
71
73
|
|
|
74
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
72
75
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
73
76
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
74
|
-
|
|
77
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
75
78
|
(pipelinePolicy) =>
|
|
76
79
|
pipelinePolicy.name ===
|
|
77
80
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
78
81
|
);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
}
|
|
83
|
+
if (
|
|
84
|
+
!options ||
|
|
85
|
+
!options.pipeline ||
|
|
86
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
87
|
+
!bearerTokenAuthenticationPolicyFound
|
|
88
|
+
) {
|
|
89
|
+
this.pipeline.removePolicy({
|
|
90
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
91
|
+
});
|
|
92
|
+
this.pipeline.addPolicy(
|
|
93
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
94
|
+
credential: credentials,
|
|
95
|
+
scopes:
|
|
96
|
+
optionsWithDefaults.credentialScopes ??
|
|
97
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
98
|
+
challengeCallbacks: {
|
|
99
|
+
authorizeRequestOnChallenge:
|
|
100
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
);
|
|
93
104
|
}
|
|
94
105
|
// Parameter assignments
|
|
95
106
|
this.subscriptionId = subscriptionId;
|
|
@@ -100,6 +111,35 @@ export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceC
|
|
|
100
111
|
this.locations = new LocationsImpl(this);
|
|
101
112
|
this.energyServices = new EnergyServicesImpl(this);
|
|
102
113
|
this.operations = new OperationsImpl(this);
|
|
114
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
118
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
119
|
+
if (!apiVersion) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const apiVersionPolicy = {
|
|
123
|
+
name: "CustomApiVersionPolicy",
|
|
124
|
+
async sendRequest(
|
|
125
|
+
request: PipelineRequest,
|
|
126
|
+
next: SendRequest
|
|
127
|
+
): Promise<PipelineResponse> {
|
|
128
|
+
const param = request.url.split("?");
|
|
129
|
+
if (param.length > 1) {
|
|
130
|
+
const newParams = param[1].split("&").map((item) => {
|
|
131
|
+
if (item.indexOf("api-version") > -1) {
|
|
132
|
+
return "api-version=" + apiVersion;
|
|
133
|
+
} else {
|
|
134
|
+
return item;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
138
|
+
}
|
|
139
|
+
return next(request);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
103
143
|
}
|
|
104
144
|
|
|
105
145
|
locations: Locations;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
9
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
|
10
|
+
import { setContinuationToken } from "../pagingHelper";
|
|
10
11
|
import { EnergyServices } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -18,9 +19,9 @@ import {
|
|
|
18
19
|
EnergyService,
|
|
19
20
|
EnergyServicesListByResourceGroupNextOptionalParams,
|
|
20
21
|
EnergyServicesListByResourceGroupOptionalParams,
|
|
22
|
+
EnergyServicesListByResourceGroupResponse,
|
|
21
23
|
EnergyServicesListBySubscriptionNextOptionalParams,
|
|
22
24
|
EnergyServicesListBySubscriptionOptionalParams,
|
|
23
|
-
EnergyServicesListByResourceGroupResponse,
|
|
24
25
|
EnergyServicesListBySubscriptionResponse,
|
|
25
26
|
EnergyServicesGetOptionalParams,
|
|
26
27
|
EnergyServicesGetResponse,
|
|
@@ -63,19 +64,33 @@ export class EnergyServicesImpl implements EnergyServices {
|
|
|
63
64
|
[Symbol.asyncIterator]() {
|
|
64
65
|
return this;
|
|
65
66
|
},
|
|
66
|
-
byPage: () => {
|
|
67
|
-
|
|
67
|
+
byPage: (settings?: PageSettings) => {
|
|
68
|
+
if (settings?.maxPageSize) {
|
|
69
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
70
|
+
}
|
|
71
|
+
return this.listByResourceGroupPagingPage(
|
|
72
|
+
resourceGroupName,
|
|
73
|
+
options,
|
|
74
|
+
settings
|
|
75
|
+
);
|
|
68
76
|
}
|
|
69
77
|
};
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
private async *listByResourceGroupPagingPage(
|
|
73
81
|
resourceGroupName: string,
|
|
74
|
-
options?: EnergyServicesListByResourceGroupOptionalParams
|
|
82
|
+
options?: EnergyServicesListByResourceGroupOptionalParams,
|
|
83
|
+
settings?: PageSettings
|
|
75
84
|
): AsyncIterableIterator<EnergyService[]> {
|
|
76
|
-
let result
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
let result: EnergyServicesListByResourceGroupResponse;
|
|
86
|
+
let continuationToken = settings?.continuationToken;
|
|
87
|
+
if (!continuationToken) {
|
|
88
|
+
result = await this._listByResourceGroup(resourceGroupName, options);
|
|
89
|
+
let page = result.value || [];
|
|
90
|
+
continuationToken = result.nextLink;
|
|
91
|
+
setContinuationToken(page, continuationToken);
|
|
92
|
+
yield page;
|
|
93
|
+
}
|
|
79
94
|
while (continuationToken) {
|
|
80
95
|
result = await this._listByResourceGroupNext(
|
|
81
96
|
resourceGroupName,
|
|
@@ -83,7 +98,9 @@ export class EnergyServicesImpl implements EnergyServices {
|
|
|
83
98
|
options
|
|
84
99
|
);
|
|
85
100
|
continuationToken = result.nextLink;
|
|
86
|
-
|
|
101
|
+
let page = result.value || [];
|
|
102
|
+
setContinuationToken(page, continuationToken);
|
|
103
|
+
yield page;
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
106
|
|
|
@@ -114,22 +131,34 @@ export class EnergyServicesImpl implements EnergyServices {
|
|
|
114
131
|
[Symbol.asyncIterator]() {
|
|
115
132
|
return this;
|
|
116
133
|
},
|
|
117
|
-
byPage: () => {
|
|
118
|
-
|
|
134
|
+
byPage: (settings?: PageSettings) => {
|
|
135
|
+
if (settings?.maxPageSize) {
|
|
136
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
137
|
+
}
|
|
138
|
+
return this.listBySubscriptionPagingPage(options, settings);
|
|
119
139
|
}
|
|
120
140
|
};
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
private async *listBySubscriptionPagingPage(
|
|
124
|
-
options?: EnergyServicesListBySubscriptionOptionalParams
|
|
144
|
+
options?: EnergyServicesListBySubscriptionOptionalParams,
|
|
145
|
+
settings?: PageSettings
|
|
125
146
|
): AsyncIterableIterator<EnergyService[]> {
|
|
126
|
-
let result
|
|
127
|
-
|
|
128
|
-
|
|
147
|
+
let result: EnergyServicesListBySubscriptionResponse;
|
|
148
|
+
let continuationToken = settings?.continuationToken;
|
|
149
|
+
if (!continuationToken) {
|
|
150
|
+
result = await this._listBySubscription(options);
|
|
151
|
+
let page = result.value || [];
|
|
152
|
+
continuationToken = result.nextLink;
|
|
153
|
+
setContinuationToken(page, continuationToken);
|
|
154
|
+
yield page;
|
|
155
|
+
}
|
|
129
156
|
while (continuationToken) {
|
|
130
157
|
result = await this._listBySubscriptionNext(continuationToken, options);
|
|
131
158
|
continuationToken = result.nextLink;
|
|
132
|
-
|
|
159
|
+
let page = result.value || [];
|
|
160
|
+
setContinuationToken(page, continuationToken);
|
|
161
|
+
yield page;
|
|
133
162
|
}
|
|
134
163
|
}
|
|
135
164
|
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export interface PageInfo {
|
|
10
|
+
continuationToken?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const pageMap = new WeakMap<object, PageInfo>();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Given a result page from a pageable operation, returns a
|
|
17
|
+
* continuation token that can be used to begin paging from
|
|
18
|
+
* that point later.
|
|
19
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
20
|
+
* @returns The continuation token that can be passed into byPage().
|
|
21
|
+
*/
|
|
22
|
+
export function getContinuationToken(page: unknown): string | undefined {
|
|
23
|
+
if (typeof page !== "object" || page === null) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return pageMap.get(page)?.continuationToken;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function setContinuationToken(
|
|
30
|
+
page: unknown,
|
|
31
|
+
continuationToken: string | undefined
|
|
32
|
+
): void {
|
|
33
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const pageInfo = pageMap.get(page) ?? {};
|
|
37
|
+
pageInfo.continuationToken = continuationToken;
|
|
38
|
+
pageMap.set(page, pageInfo);
|
|
39
|
+
}
|