@azure/arm-oep 1.0.0-beta.1 → 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.
Files changed (70) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +12 -1
  3. package/dist/index.js +183 -28
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist-esm/samples-dev/energyServicesCreateSample.d.ts +2 -0
  8. package/dist-esm/samples-dev/energyServicesCreateSample.d.ts.map +1 -0
  9. package/dist-esm/samples-dev/energyServicesCreateSample.js +31 -0
  10. package/dist-esm/samples-dev/energyServicesCreateSample.js.map +1 -0
  11. package/dist-esm/samples-dev/energyServicesDeleteSample.d.ts +2 -0
  12. package/dist-esm/samples-dev/energyServicesDeleteSample.d.ts.map +1 -0
  13. package/dist-esm/samples-dev/energyServicesDeleteSample.js +31 -0
  14. package/dist-esm/samples-dev/energyServicesDeleteSample.js.map +1 -0
  15. package/dist-esm/samples-dev/energyServicesGetSample.d.ts +2 -0
  16. package/dist-esm/samples-dev/energyServicesGetSample.d.ts.map +1 -0
  17. package/dist-esm/samples-dev/energyServicesGetSample.js +31 -0
  18. package/dist-esm/samples-dev/energyServicesGetSample.js.map +1 -0
  19. package/dist-esm/samples-dev/energyServicesListByResourceGroupSample.d.ts +2 -0
  20. package/dist-esm/samples-dev/energyServicesListByResourceGroupSample.d.ts.map +1 -0
  21. package/dist-esm/samples-dev/energyServicesListByResourceGroupSample.js +44 -0
  22. package/dist-esm/samples-dev/energyServicesListByResourceGroupSample.js.map +1 -0
  23. package/dist-esm/samples-dev/energyServicesListBySubscriptionSample.d.ts +2 -0
  24. package/dist-esm/samples-dev/energyServicesListBySubscriptionSample.d.ts.map +1 -0
  25. package/dist-esm/samples-dev/energyServicesListBySubscriptionSample.js +43 -0
  26. package/dist-esm/samples-dev/energyServicesListBySubscriptionSample.js.map +1 -0
  27. package/dist-esm/samples-dev/energyServicesUpdateSample.d.ts +2 -0
  28. package/dist-esm/samples-dev/energyServicesUpdateSample.d.ts.map +1 -0
  29. package/dist-esm/samples-dev/energyServicesUpdateSample.js +31 -0
  30. package/dist-esm/samples-dev/energyServicesUpdateSample.js.map +1 -0
  31. package/dist-esm/samples-dev/locationsCheckNameAvailabilitySample.d.ts +2 -0
  32. package/dist-esm/samples-dev/locationsCheckNameAvailabilitySample.d.ts.map +1 -0
  33. package/dist-esm/samples-dev/locationsCheckNameAvailabilitySample.js +33 -0
  34. package/dist-esm/samples-dev/locationsCheckNameAvailabilitySample.js.map +1 -0
  35. package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
  36. package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
  37. package/dist-esm/samples-dev/operationsListSample.js +29 -0
  38. package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
  39. package/dist-esm/src/index.d.ts +1 -0
  40. package/dist-esm/src/index.d.ts.map +1 -1
  41. package/dist-esm/src/index.js +1 -0
  42. package/dist-esm/src/index.js.map +1 -1
  43. package/dist-esm/src/models/index.d.ts +19 -2
  44. package/dist-esm/src/models/index.d.ts.map +1 -1
  45. package/dist-esm/src/models/index.js +17 -0
  46. package/dist-esm/src/models/index.js.map +1 -1
  47. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts +2 -0
  48. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts.map +1 -1
  49. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js +54 -5
  50. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js.map +1 -1
  51. package/dist-esm/src/operations/energyServices.d.ts.map +1 -1
  52. package/dist-esm/src/operations/energyServices.js +43 -16
  53. package/dist-esm/src/operations/energyServices.js.map +1 -1
  54. package/dist-esm/src/pagingHelper.d.ts +13 -0
  55. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  56. package/dist-esm/src/pagingHelper.js +32 -0
  57. package/dist-esm/src/pagingHelper.js.map +1 -0
  58. package/dist-esm/test/sampleTest.js +11 -13
  59. package/dist-esm/test/sampleTest.js.map +1 -1
  60. package/package.json +38 -22
  61. package/review/arm-oep.api.md +7 -20
  62. package/rollup.config.js +6 -72
  63. package/src/index.ts +1 -0
  64. package/src/models/index.ts +19 -2
  65. package/src/openEnergyPlatformManagementServiceAPIs.ts +70 -5
  66. package/src/operations/energyServices.ts +51 -18
  67. package/src/pagingHelper.ts +39 -0
  68. package/tsconfig.json +18 -5
  69. package/types/arm-oep.d.ts +30 -2
  70. package/types/tsdoc-metadata.json +1 -1
@@ -46,13 +46,14 @@ export interface EnergyResourceUpdate {
46
46
  }
47
47
 
48
48
  // @public (undocumented)
49
- export type EnergyService = Resource & {
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
- location: string;
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/rollup.config.js CHANGED
@@ -14,62 +14,14 @@ import json from "@rollup/plugin-json";
14
14
 
15
15
  import nodeBuiltins from "builtin-modules";
16
16
 
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
-
65
17
  // #region Warning Handler
66
18
 
67
19
  /**
68
- * A function that can determine whether a rollupwarning should be ignored. If
20
+ * A function that can determine whether a rollup warning should be ignored. If
69
21
  * the function returns `true`, then the warning will not be displayed.
70
22
  */
71
23
 
72
- function ignoreNiseSinonEvalWarnings(warning) {
24
+ function ignoreNiseSinonEval(warning) {
73
25
  return (
74
26
  warning.code === "EVAL" &&
75
27
  warning.id &&
@@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) {
78
30
  );
79
31
  }
80
32
 
81
- function ignoreChaiCircularDependencyWarnings(warning) {
33
+ function ignoreChaiCircularDependency(warning) {
82
34
  return (
83
35
  warning.code === "CIRCULAR_DEPENDENCY" &&
84
36
  warning.importer && warning.importer.includes("node_modules/chai") === true
85
37
  );
86
38
  }
87
39
 
88
- const warningInhibitors = [
89
- ignoreChaiCircularDependencyWarnings,
90
- ignoreNiseSinonEvalWarnings
91
- ];
40
+ const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
92
41
 
93
42
  /**
94
43
  * Construct a warning handler for the shared rollup configuration
@@ -122,22 +71,7 @@ function makeBrowserTestConfig() {
122
71
  nodeResolve({
123
72
  mainFields: ["module", "browser"]
124
73
  }),
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
- }),
74
+ cjs(),
141
75
  json(),
142
76
  sourcemaps()
143
77
  //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
@@ -173,7 +107,7 @@ export function makeConfig(pkg, options) {
173
107
  ],
174
108
  output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
109
  preserveSymlinks: false,
176
- plugins: [sourcemaps(), nodeResolve(), cjs()]
110
+ plugins: [sourcemaps(), nodeResolve()]
177
111
  };
178
112
 
179
113
  const config = [baseConfig];
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";
@@ -207,17 +207,19 @@ export interface OperationDisplay {
207
207
  readonly description?: string;
208
208
  }
209
209
 
210
- export type EnergyService = Resource & {
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
 
@@ -7,6 +7,12 @@
7
7
  */
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
10
16
  import * as coreAuth from "@azure/core-auth";
11
17
  import {
12
18
  LocationsImpl,
@@ -48,24 +54,54 @@ export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceC
48
54
  credential: credentials
49
55
  };
50
56
 
51
- const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.1`;
57
+ const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.3`;
52
58
  const userAgentPrefix =
53
59
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
54
60
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
55
61
  : `${packageDetails}`;
56
62
 
57
- if (!options.credentialScopes) {
58
- options.credentialScopes = ["https://management.azure.com/.default"];
59
- }
60
63
  const optionsWithDefaults = {
61
64
  ...defaults,
62
65
  ...options,
63
66
  userAgentOptions: {
64
67
  userAgentPrefix
65
68
  },
66
- baseUri: options.endpoint || "https://management.azure.com"
69
+ endpoint:
70
+ options.endpoint ?? options.baseUri ?? "https://management.azure.com"
67
71
  };
68
72
  super(optionsWithDefaults);
73
+
74
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
75
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
76
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
77
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
78
+ (pipelinePolicy) =>
79
+ pipelinePolicy.name ===
80
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
81
+ );
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
+ );
104
+ }
69
105
  // Parameter assignments
70
106
  this.subscriptionId = subscriptionId;
71
107
 
@@ -75,6 +111,35 @@ export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceC
75
111
  this.locations = new LocationsImpl(this);
76
112
  this.energyServices = new EnergyServicesImpl(this);
77
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);
78
143
  }
79
144
 
80
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
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
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 = await this._listByResourceGroup(resourceGroupName, options);
77
- yield result.value || [];
78
- let continuationToken = result.nextLink;
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
- yield result.value || [];
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
- return this.listBySubscriptionPagingPage(options);
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 = await this._listBySubscription(options);
127
- yield result.value || [];
128
- let continuationToken = result.nextLink;
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
- yield result.value || [];
159
+ let page = result.value || [];
160
+ setContinuationToken(page, continuationToken);
161
+ yield page;
133
162
  }
134
163
  }
135
164
 
@@ -246,11 +275,13 @@ export class EnergyServicesImpl implements EnergyServices {
246
275
  { resourceGroupName, resourceName, options },
247
276
  createOperationSpec
248
277
  );
249
- return new LroEngine(lro, {
278
+ const poller = new LroEngine(lro, {
250
279
  resumeFrom: options?.resumeFrom,
251
280
  intervalInMs: options?.updateIntervalInMs,
252
281
  lroResourceLocationConfig: "azure-async-operation"
253
282
  });
283
+ await poller.poll();
284
+ return poller;
254
285
  }
255
286
 
256
287
  /**
@@ -343,10 +374,12 @@ export class EnergyServicesImpl implements EnergyServices {
343
374
  { resourceGroupName, resourceName, options },
344
375
  deleteOperationSpec
345
376
  );
346
- return new LroEngine(lro, {
377
+ const poller = new LroEngine(lro, {
347
378
  resumeFrom: options?.resumeFrom,
348
379
  intervalInMs: options?.updateIntervalInMs
349
380
  });
381
+ await poller.poll();
382
+ return poller;
350
383
  }
351
384
 
352
385
  /**
@@ -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
+ }
package/tsconfig.json CHANGED
@@ -9,12 +9,25 @@
9
9
  "esModuleInterop": true,
10
10
  "allowSyntheticDefaultImports": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
- "lib": ["es6", "dom"],
12
+ "lib": [
13
+ "es6",
14
+ "dom"
15
+ ],
13
16
  "declaration": true,
14
17
  "outDir": "./dist-esm",
15
18
  "importHelpers": true,
16
- "paths": { "@azure/arm-oep": ["./src/index"] }
19
+ "paths": {
20
+ "@azure/arm-oep": [
21
+ "./src/index"
22
+ ]
23
+ }
17
24
  },
18
- "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"],
19
- "exclude": ["node_modules"]
20
- }
25
+ "include": [
26
+ "./src/**/*.ts",
27
+ "./test/**/*.ts",
28
+ "samples-dev/**/*.ts"
29
+ ],
30
+ "exclude": [
31
+ "node_modules"
32
+ ]
33
+ }
@@ -66,7 +66,7 @@ export declare interface EnergyResourceUpdate {
66
66
  };
67
67
  }
68
68
 
69
- export declare type EnergyService = Resource & {
69
+ export declare interface EnergyService extends Resource {
70
70
  properties?: EnergyServiceProperties;
71
71
  /** Resource tags. */
72
72
  tags?: {
@@ -74,7 +74,7 @@ export declare type EnergyService = Resource & {
74
74
  };
75
75
  /** Geo-location where the resource lives. */
76
76
  location: string;
77
- };
77
+ }
78
78
 
79
79
  /** The list of oep resources. */
80
80
  export declare interface EnergyServiceList {
@@ -263,40 +263,66 @@ export declare interface ErrorResponse {
263
263
  error?: ErrorDetail;
264
264
  }
265
265
 
266
+ /**
267
+ * Given a result page from a pageable operation, returns a
268
+ * continuation token that can be used to begin paging from
269
+ * that point later.
270
+ * @param page A result object from calling .byPage() on a paged operation.
271
+ * @returns The continuation token that can be passed into byPage().
272
+ */
273
+ export declare function getContinuationToken(page: unknown): string | undefined;
274
+
266
275
  /** Known values of {@link ActionType} that the service accepts. */
267
276
  export declare enum KnownActionType {
277
+ /** Internal */
268
278
  Internal = "Internal"
269
279
  }
270
280
 
271
281
  /** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */
272
282
  export declare enum KnownCheckNameAvailabilityReason {
283
+ /** Invalid */
273
284
  Invalid = "Invalid",
285
+ /** AlreadyExists */
274
286
  AlreadyExists = "AlreadyExists"
275
287
  }
276
288
 
277
289
  /** Known values of {@link CreatedByType} that the service accepts. */
278
290
  export declare enum KnownCreatedByType {
291
+ /** User */
279
292
  User = "User",
293
+ /** Application */
280
294
  Application = "Application",
295
+ /** ManagedIdentity */
281
296
  ManagedIdentity = "ManagedIdentity",
297
+ /** Key */
282
298
  Key = "Key"
283
299
  }
284
300
 
285
301
  /** Known values of {@link Origin} that the service accepts. */
286
302
  export declare enum KnownOrigin {
303
+ /** User */
287
304
  User = "user",
305
+ /** System */
288
306
  System = "system",
307
+ /** UserSystem */
289
308
  UserSystem = "user,system"
290
309
  }
291
310
 
292
311
  /** Known values of {@link ProvisioningState} that the service accepts. */
293
312
  export declare enum KnownProvisioningState {
313
+ /** Unknown */
294
314
  Unknown = "Unknown",
315
+ /** Succeeded */
295
316
  Succeeded = "Succeeded",
317
+ /** Failed */
296
318
  Failed = "Failed",
319
+ /** Canceled */
297
320
  Canceled = "Canceled",
321
+ /** Creating */
298
322
  Creating = "Creating",
323
+ /** Deleting */
299
324
  Deleting = "Deleting",
325
+ /** Updating */
300
326
  Updating = "Updating"
301
327
  }
302
328
 
@@ -328,6 +354,8 @@ export declare class OpenEnergyPlatformManagementServiceAPIs extends coreClient.
328
354
  * @param options The parameter options
329
355
  */
330
356
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: OpenEnergyPlatformManagementServiceAPIsOptionalParams);
357
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
358
+ private addCustomApiVersionPolicy;
331
359
  locations: Locations;
332
360
  energyServices: EnergyServices;
333
361
  operations: Operations;