@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.js +135 -33
  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/src/index.d.ts +1 -0
  8. package/dist-esm/src/index.d.ts.map +1 -1
  9. package/dist-esm/src/index.js +1 -0
  10. package/dist-esm/src/index.js.map +1 -1
  11. package/dist-esm/src/models/index.d.ts +19 -2
  12. package/dist-esm/src/models/index.d.ts.map +1 -1
  13. package/dist-esm/src/models/index.js +17 -0
  14. package/dist-esm/src/models/index.js.map +1 -1
  15. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts +2 -0
  16. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.d.ts.map +1 -1
  17. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js +49 -18
  18. package/dist-esm/src/openEnergyPlatformManagementServiceAPIs.js.map +1 -1
  19. package/dist-esm/src/operations/energyServices.d.ts.map +1 -1
  20. package/dist-esm/src/operations/energyServices.js +37 -14
  21. package/dist-esm/src/operations/energyServices.js.map +1 -1
  22. package/dist-esm/src/pagingHelper.d.ts +13 -0
  23. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  24. package/dist-esm/src/pagingHelper.js +32 -0
  25. package/dist-esm/src/pagingHelper.js.map +1 -0
  26. package/dist-esm/test/sampleTest.js +11 -13
  27. package/dist-esm/test/sampleTest.js.map +1 -1
  28. package/package.json +15 -11
  29. package/review/arm-oep.api.md +7 -20
  30. package/src/index.ts +1 -0
  31. package/src/models/index.ts +19 -2
  32. package/src/openEnergyPlatformManagementServiceAPIs.ts +60 -20
  33. package/src/operations/energyServices.ts +45 -16
  34. package/src/pagingHelper.ts +39 -0
  35. package/types/arm-oep.d.ts +30 -2
  36. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
+
3
+ ## 1.0.0-beta.3 (2022-12-01)
4
+
5
+ **Features**
2
6
 
7
+ - Added Interface EnergyService
8
+
3
9
  ## 1.0.0-beta.2 (2022-04-27)
4
10
 
5
11
  **Features**
package/README.md CHANGED
@@ -13,7 +13,7 @@ Open Energy Platform Management Service APIs
13
13
 
14
14
  ### Currently supported environments
15
15
 
16
- - [LTS versions of Node.js](https://nodejs.org/about/releases/)
16
+ - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
17
17
  - Latest versions of Safari, Chrome, Edge and Firefox.
18
18
 
19
19
  See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  var coreClient = require('@azure/core-client');
6
7
  var coreRestPipeline = require('@azure/core-rest-pipeline');
7
- var tslib = require('tslib');
8
8
  var coreLro = require('@azure/core-lro');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -28,6 +28,38 @@ function _interopNamespace(e) {
28
28
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
29
29
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
30
30
 
31
+ /*
32
+ * Copyright (c) Microsoft Corporation.
33
+ * Licensed under the MIT License.
34
+ *
35
+ * Code generated by Microsoft (R) AutoRest Code Generator.
36
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
37
+ */
38
+ const pageMap = new WeakMap();
39
+ /**
40
+ * Given a result page from a pageable operation, returns a
41
+ * continuation token that can be used to begin paging from
42
+ * that point later.
43
+ * @param page A result object from calling .byPage() on a paged operation.
44
+ * @returns The continuation token that can be passed into byPage().
45
+ */
46
+ function getContinuationToken(page) {
47
+ var _a;
48
+ if (typeof page !== "object" || page === null) {
49
+ return undefined;
50
+ }
51
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
52
+ }
53
+ function setContinuationToken(page, continuationToken) {
54
+ var _a;
55
+ if (typeof page !== "object" || page === null || !continuationToken) {
56
+ return;
57
+ }
58
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
59
+ pageInfo.continuationToken = continuationToken;
60
+ pageMap.set(page, pageInfo);
61
+ }
62
+
31
63
  /*
32
64
  * Copyright (c) Microsoft Corporation.
33
65
  * Licensed under the MIT License.
@@ -38,38 +70,55 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
38
70
  /** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */
39
71
  exports.KnownCheckNameAvailabilityReason = void 0;
40
72
  (function (KnownCheckNameAvailabilityReason) {
73
+ /** Invalid */
41
74
  KnownCheckNameAvailabilityReason["Invalid"] = "Invalid";
75
+ /** AlreadyExists */
42
76
  KnownCheckNameAvailabilityReason["AlreadyExists"] = "AlreadyExists";
43
77
  })(exports.KnownCheckNameAvailabilityReason || (exports.KnownCheckNameAvailabilityReason = {}));
44
78
  /** Known values of {@link ProvisioningState} that the service accepts. */
45
79
  exports.KnownProvisioningState = void 0;
46
80
  (function (KnownProvisioningState) {
81
+ /** Unknown */
47
82
  KnownProvisioningState["Unknown"] = "Unknown";
83
+ /** Succeeded */
48
84
  KnownProvisioningState["Succeeded"] = "Succeeded";
85
+ /** Failed */
49
86
  KnownProvisioningState["Failed"] = "Failed";
87
+ /** Canceled */
50
88
  KnownProvisioningState["Canceled"] = "Canceled";
89
+ /** Creating */
51
90
  KnownProvisioningState["Creating"] = "Creating";
91
+ /** Deleting */
52
92
  KnownProvisioningState["Deleting"] = "Deleting";
93
+ /** Updating */
53
94
  KnownProvisioningState["Updating"] = "Updating";
54
95
  })(exports.KnownProvisioningState || (exports.KnownProvisioningState = {}));
55
96
  /** Known values of {@link CreatedByType} that the service accepts. */
56
97
  exports.KnownCreatedByType = void 0;
57
98
  (function (KnownCreatedByType) {
99
+ /** User */
58
100
  KnownCreatedByType["User"] = "User";
101
+ /** Application */
59
102
  KnownCreatedByType["Application"] = "Application";
103
+ /** ManagedIdentity */
60
104
  KnownCreatedByType["ManagedIdentity"] = "ManagedIdentity";
105
+ /** Key */
61
106
  KnownCreatedByType["Key"] = "Key";
62
107
  })(exports.KnownCreatedByType || (exports.KnownCreatedByType = {}));
63
108
  /** Known values of {@link Origin} that the service accepts. */
64
109
  exports.KnownOrigin = void 0;
65
110
  (function (KnownOrigin) {
111
+ /** User */
66
112
  KnownOrigin["User"] = "user";
113
+ /** System */
67
114
  KnownOrigin["System"] = "system";
115
+ /** UserSystem */
68
116
  KnownOrigin["UserSystem"] = "user,system";
69
117
  })(exports.KnownOrigin || (exports.KnownOrigin = {}));
70
118
  /** Known values of {@link ActionType} that the service accepts. */
71
119
  exports.KnownActionType = void 0;
72
120
  (function (KnownActionType) {
121
+ /** Internal */
73
122
  KnownActionType["Internal"] = "Internal";
74
123
  })(exports.KnownActionType || (exports.KnownActionType = {}));
75
124
 
@@ -762,20 +811,31 @@ class EnergyServicesImpl {
762
811
  [Symbol.asyncIterator]() {
763
812
  return this;
764
813
  },
765
- byPage: () => {
766
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
814
+ byPage: (settings) => {
815
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
816
+ throw new Error("maxPageSize is not supported by this operation.");
817
+ }
818
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
767
819
  }
768
820
  };
769
821
  }
770
- listByResourceGroupPagingPage(resourceGroupName, options) {
822
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
771
823
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
772
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
773
- yield yield tslib.__await(result.value || []);
774
- let continuationToken = result.nextLink;
824
+ let result;
825
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
826
+ if (!continuationToken) {
827
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
828
+ let page = result.value || [];
829
+ continuationToken = result.nextLink;
830
+ setContinuationToken(page, continuationToken);
831
+ yield yield tslib.__await(page);
832
+ }
775
833
  while (continuationToken) {
776
834
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
777
835
  continuationToken = result.nextLink;
778
- yield yield tslib.__await(result.value || []);
836
+ let page = result.value || [];
837
+ setContinuationToken(page, continuationToken);
838
+ yield yield tslib.__await(page);
779
839
  }
780
840
  });
781
841
  }
@@ -810,20 +870,31 @@ class EnergyServicesImpl {
810
870
  [Symbol.asyncIterator]() {
811
871
  return this;
812
872
  },
813
- byPage: () => {
814
- return this.listBySubscriptionPagingPage(options);
873
+ byPage: (settings) => {
874
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
875
+ throw new Error("maxPageSize is not supported by this operation.");
876
+ }
877
+ return this.listBySubscriptionPagingPage(options, settings);
815
878
  }
816
879
  };
817
880
  }
818
- listBySubscriptionPagingPage(options) {
881
+ listBySubscriptionPagingPage(options, settings) {
819
882
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
820
- let result = yield tslib.__await(this._listBySubscription(options));
821
- yield yield tslib.__await(result.value || []);
822
- let continuationToken = result.nextLink;
883
+ let result;
884
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
885
+ if (!continuationToken) {
886
+ result = yield tslib.__await(this._listBySubscription(options));
887
+ let page = result.value || [];
888
+ continuationToken = result.nextLink;
889
+ setContinuationToken(page, continuationToken);
890
+ yield yield tslib.__await(page);
891
+ }
823
892
  while (continuationToken) {
824
893
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
825
894
  continuationToken = result.nextLink;
826
- yield yield tslib.__await(result.value || []);
895
+ let page = result.value || [];
896
+ setContinuationToken(page, continuationToken);
897
+ yield yield tslib.__await(page);
827
898
  }
828
899
  });
829
900
  }
@@ -1212,7 +1283,7 @@ class OpenEnergyPlatformManagementServiceAPIs extends coreClient__namespace.Serv
1212
1283
  * @param options The parameter options
1213
1284
  */
1214
1285
  constructor(credentials, subscriptionId, options) {
1215
- var _a, _b;
1286
+ var _a, _b, _c;
1216
1287
  if (credentials === undefined) {
1217
1288
  throw new Error("'credentials' cannot be null");
1218
1289
  }
@@ -1227,32 +1298,34 @@ class OpenEnergyPlatformManagementServiceAPIs extends coreClient__namespace.Serv
1227
1298
  requestContentType: "application/json; charset=utf-8",
1228
1299
  credential: credentials
1229
1300
  };
1230
- const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.2`;
1301
+ const packageDetails = `azsdk-js-arm-oep/1.0.0-beta.3`;
1231
1302
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1232
1303
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1233
1304
  : `${packageDetails}`;
1234
- if (!options.credentialScopes) {
1235
- options.credentialScopes = ["https://management.azure.com/.default"];
1236
- }
1237
1305
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1238
1306
  userAgentPrefix
1239
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1307
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1240
1308
  super(optionsWithDefaults);
1309
+ let bearerTokenAuthenticationPolicyFound = false;
1241
1310
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1242
1311
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
1243
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1312
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1244
1313
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1245
- if (!bearerTokenAuthenticationPolicyFound) {
1246
- this.pipeline.removePolicy({
1247
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1248
- });
1249
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1250
- scopes: `${optionsWithDefaults.baseUri}/.default`,
1251
- challengeCallbacks: {
1252
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1253
- }
1254
- }));
1255
- }
1314
+ }
1315
+ if (!options ||
1316
+ !options.pipeline ||
1317
+ options.pipeline.getOrderedPolicies().length == 0 ||
1318
+ !bearerTokenAuthenticationPolicyFound) {
1319
+ this.pipeline.removePolicy({
1320
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1321
+ });
1322
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1323
+ credential: credentials,
1324
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1325
+ challengeCallbacks: {
1326
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1327
+ }
1328
+ }));
1256
1329
  }
1257
1330
  // Parameter assignments
1258
1331
  this.subscriptionId = subscriptionId;
@@ -1262,8 +1335,37 @@ class OpenEnergyPlatformManagementServiceAPIs extends coreClient__namespace.Serv
1262
1335
  this.locations = new LocationsImpl(this);
1263
1336
  this.energyServices = new EnergyServicesImpl(this);
1264
1337
  this.operations = new OperationsImpl(this);
1338
+ this.addCustomApiVersionPolicy(options.apiVersion);
1339
+ }
1340
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1341
+ addCustomApiVersionPolicy(apiVersion) {
1342
+ if (!apiVersion) {
1343
+ return;
1344
+ }
1345
+ const apiVersionPolicy = {
1346
+ name: "CustomApiVersionPolicy",
1347
+ sendRequest(request, next) {
1348
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1349
+ const param = request.url.split("?");
1350
+ if (param.length > 1) {
1351
+ const newParams = param[1].split("&").map((item) => {
1352
+ if (item.indexOf("api-version") > -1) {
1353
+ return "api-version=" + apiVersion;
1354
+ }
1355
+ else {
1356
+ return item;
1357
+ }
1358
+ });
1359
+ request.url = param[0] + "?" + newParams.join("&");
1360
+ }
1361
+ return next(request);
1362
+ });
1363
+ }
1364
+ };
1365
+ this.pipeline.addPolicy(apiVersionPolicy);
1265
1366
  }
1266
1367
  }
1267
1368
 
1268
1369
  exports.OpenEnergyPlatformManagementServiceAPIs = OpenEnergyPlatformManagementServiceAPIs;
1370
+ exports.getContinuationToken = getContinuationToken;
1269
1371
  //# sourceMappingURL=index.js.map