@azure/arm-extendedlocation 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 (61) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +143 -58
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/customLocationsDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/customLocationsDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js +11 -3
  13. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js.map +1 -1
  14. package/dist-esm/samples-dev/customLocationsGetSample.js +11 -3
  15. package/dist-esm/samples-dev/customLocationsGetSample.js.map +1 -1
  16. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js +11 -3
  17. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js.map +1 -1
  18. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js +10 -2
  19. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js.map +1 -1
  20. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js +11 -3
  21. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js.map +1 -1
  22. package/dist-esm/samples-dev/customLocationsListOperationsSample.js +10 -2
  23. package/dist-esm/samples-dev/customLocationsListOperationsSample.js.map +1 -1
  24. package/dist-esm/samples-dev/customLocationsUpdateSample.js +11 -3
  25. package/dist-esm/samples-dev/customLocationsUpdateSample.js.map +1 -1
  26. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js +11 -3
  27. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js.map +1 -1
  28. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js +11 -3
  29. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js.map +1 -1
  30. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js +11 -3
  31. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js.map +1 -1
  32. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js +11 -3
  33. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js.map +1 -1
  34. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js +11 -3
  35. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js.map +1 -1
  36. package/dist-esm/src/customLocationsManagementClient.d.ts.map +1 -1
  37. package/dist-esm/src/customLocationsManagementClient.js +20 -18
  38. package/dist-esm/src/customLocationsManagementClient.js.map +1 -1
  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/operations/customLocations.d.ts.map +1 -1
  44. package/dist-esm/src/operations/customLocations.js +73 -32
  45. package/dist-esm/src/operations/customLocations.js.map +1 -1
  46. package/dist-esm/src/operations/resourceSyncRules.d.ts.map +1 -1
  47. package/dist-esm/src/operations/resourceSyncRules.js +19 -8
  48. package/dist-esm/src/operations/resourceSyncRules.js.map +1 -1
  49. package/dist-esm/src/pagingHelper.d.ts +13 -0
  50. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  51. package/dist-esm/src/pagingHelper.js +32 -0
  52. package/dist-esm/src/pagingHelper.js.map +1 -0
  53. package/package.json +8 -6
  54. package/review/arm-extendedlocation.api.md +3 -0
  55. package/src/customLocationsManagementClient.ts +26 -20
  56. package/src/index.ts +1 -0
  57. package/src/operations/customLocations.ts +91 -41
  58. package/src/operations/resourceSyncRules.ts +26 -13
  59. package/src/pagingHelper.ts +39 -0
  60. package/types/arm-extendedlocation.d.ts +9 -0
  61. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
-
2
+
3
+ ## 1.0.0-beta.3 (2023-01-10)
4
+
5
+ **Features**
6
+
7
+ - Exposes `getContinuationToken` helper function to extract continuation token
8
+
9
+ **Bugs Fixed**
10
+
11
+ - A series of small bug fixs relevant to authentication and apiVersion policy
12
+
3
13
  ## 1.0.0-beta.2 (2022-07-20)
4
14
 
5
15
  **Features**
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Microsoft
3
+ Copyright (c) 2023 Microsoft
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,7 +13,7 @@ The customLocations Rest API spec.
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
@@ -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 the last `.value` produced by the `byPage` iterator,
41
+ * returns a continuation token that can be used to begin paging from
42
+ * that point later.
43
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
44
+ * @returns The continuation token that can be passed into byPage() during future calls.
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.
@@ -1057,20 +1089,31 @@ class CustomLocationsImpl {
1057
1089
  [Symbol.asyncIterator]() {
1058
1090
  return this;
1059
1091
  },
1060
- byPage: () => {
1061
- return this.listOperationsPagingPage(options);
1092
+ byPage: (settings) => {
1093
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1094
+ throw new Error("maxPageSize is not supported by this operation.");
1095
+ }
1096
+ return this.listOperationsPagingPage(options, settings);
1062
1097
  }
1063
1098
  };
1064
1099
  }
1065
- listOperationsPagingPage(options) {
1100
+ listOperationsPagingPage(options, settings) {
1066
1101
  return tslib.__asyncGenerator(this, arguments, function* listOperationsPagingPage_1() {
1067
- let result = yield tslib.__await(this._listOperations(options));
1068
- yield yield tslib.__await(result.value || []);
1069
- let continuationToken = result.nextLink;
1102
+ let result;
1103
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1104
+ if (!continuationToken) {
1105
+ result = yield tslib.__await(this._listOperations(options));
1106
+ let page = result.value || [];
1107
+ continuationToken = result.nextLink;
1108
+ setContinuationToken(page, continuationToken);
1109
+ yield yield tslib.__await(page);
1110
+ }
1070
1111
  while (continuationToken) {
1071
1112
  result = yield tslib.__await(this._listOperationsNext(continuationToken, options));
1072
1113
  continuationToken = result.nextLink;
1073
- yield yield tslib.__await(result.value || []);
1114
+ let page = result.value || [];
1115
+ setContinuationToken(page, continuationToken);
1116
+ yield yield tslib.__await(page);
1074
1117
  }
1075
1118
  });
1076
1119
  }
@@ -1106,20 +1149,31 @@ class CustomLocationsImpl {
1106
1149
  [Symbol.asyncIterator]() {
1107
1150
  return this;
1108
1151
  },
1109
- byPage: () => {
1110
- return this.listBySubscriptionPagingPage(options);
1152
+ byPage: (settings) => {
1153
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1154
+ throw new Error("maxPageSize is not supported by this operation.");
1155
+ }
1156
+ return this.listBySubscriptionPagingPage(options, settings);
1111
1157
  }
1112
1158
  };
1113
1159
  }
1114
- listBySubscriptionPagingPage(options) {
1160
+ listBySubscriptionPagingPage(options, settings) {
1115
1161
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
1116
- let result = yield tslib.__await(this._listBySubscription(options));
1117
- yield yield tslib.__await(result.value || []);
1118
- let continuationToken = result.nextLink;
1162
+ let result;
1163
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1164
+ if (!continuationToken) {
1165
+ result = yield tslib.__await(this._listBySubscription(options));
1166
+ let page = result.value || [];
1167
+ continuationToken = result.nextLink;
1168
+ setContinuationToken(page, continuationToken);
1169
+ yield yield tslib.__await(page);
1170
+ }
1119
1171
  while (continuationToken) {
1120
1172
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
1121
1173
  continuationToken = result.nextLink;
1122
- yield yield tslib.__await(result.value || []);
1174
+ let page = result.value || [];
1175
+ setContinuationToken(page, continuationToken);
1176
+ yield yield tslib.__await(page);
1123
1177
  }
1124
1178
  });
1125
1179
  }
@@ -1156,20 +1210,31 @@ class CustomLocationsImpl {
1156
1210
  [Symbol.asyncIterator]() {
1157
1211
  return this;
1158
1212
  },
1159
- byPage: () => {
1160
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
1213
+ byPage: (settings) => {
1214
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1215
+ throw new Error("maxPageSize is not supported by this operation.");
1216
+ }
1217
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
1161
1218
  }
1162
1219
  };
1163
1220
  }
1164
- listByResourceGroupPagingPage(resourceGroupName, options) {
1221
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
1165
1222
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
1166
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1167
- yield yield tslib.__await(result.value || []);
1168
- let continuationToken = result.nextLink;
1223
+ let result;
1224
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1225
+ if (!continuationToken) {
1226
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1227
+ let page = result.value || [];
1228
+ continuationToken = result.nextLink;
1229
+ setContinuationToken(page, continuationToken);
1230
+ yield yield tslib.__await(page);
1231
+ }
1169
1232
  while (continuationToken) {
1170
1233
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
1171
1234
  continuationToken = result.nextLink;
1172
- yield yield tslib.__await(result.value || []);
1235
+ let page = result.value || [];
1236
+ setContinuationToken(page, continuationToken);
1237
+ yield yield tslib.__await(page);
1173
1238
  }
1174
1239
  });
1175
1240
  }
@@ -1206,20 +1271,31 @@ class CustomLocationsImpl {
1206
1271
  [Symbol.asyncIterator]() {
1207
1272
  return this;
1208
1273
  },
1209
- byPage: () => {
1210
- return this.listEnabledResourceTypesPagingPage(resourceGroupName, resourceName, options);
1274
+ byPage: (settings) => {
1275
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1276
+ throw new Error("maxPageSize is not supported by this operation.");
1277
+ }
1278
+ return this.listEnabledResourceTypesPagingPage(resourceGroupName, resourceName, options, settings);
1211
1279
  }
1212
1280
  };
1213
1281
  }
1214
- listEnabledResourceTypesPagingPage(resourceGroupName, resourceName, options) {
1282
+ listEnabledResourceTypesPagingPage(resourceGroupName, resourceName, options, settings) {
1215
1283
  return tslib.__asyncGenerator(this, arguments, function* listEnabledResourceTypesPagingPage_1() {
1216
- let result = yield tslib.__await(this._listEnabledResourceTypes(resourceGroupName, resourceName, options));
1217
- yield yield tslib.__await(result.value || []);
1218
- let continuationToken = result.nextLink;
1284
+ let result;
1285
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1286
+ if (!continuationToken) {
1287
+ result = yield tslib.__await(this._listEnabledResourceTypes(resourceGroupName, resourceName, options));
1288
+ let page = result.value || [];
1289
+ continuationToken = result.nextLink;
1290
+ setContinuationToken(page, continuationToken);
1291
+ yield yield tslib.__await(page);
1292
+ }
1219
1293
  while (continuationToken) {
1220
1294
  result = yield tslib.__await(this._listEnabledResourceTypesNext(resourceGroupName, resourceName, continuationToken, options));
1221
1295
  continuationToken = result.nextLink;
1222
- yield yield tslib.__await(result.value || []);
1296
+ let page = result.value || [];
1297
+ setContinuationToken(page, continuationToken);
1298
+ yield yield tslib.__await(page);
1223
1299
  }
1224
1300
  });
1225
1301
  }
@@ -1668,7 +1744,6 @@ const listOperationsNextOperationSpec = {
1668
1744
  bodyMapper: ErrorResponse
1669
1745
  }
1670
1746
  },
1671
- queryParameters: [apiVersion],
1672
1747
  urlParameters: [$host, nextLink],
1673
1748
  headerParameters: [accept],
1674
1749
  serializer: serializer$1
@@ -1684,7 +1759,6 @@ const listBySubscriptionNextOperationSpec = {
1684
1759
  bodyMapper: ErrorResponse
1685
1760
  }
1686
1761
  },
1687
- queryParameters: [apiVersion],
1688
1762
  urlParameters: [
1689
1763
  $host,
1690
1764
  subscriptionId,
@@ -1704,7 +1778,6 @@ const listByResourceGroupNextOperationSpec = {
1704
1778
  bodyMapper: ErrorResponse
1705
1779
  }
1706
1780
  },
1707
- queryParameters: [apiVersion],
1708
1781
  urlParameters: [
1709
1782
  $host,
1710
1783
  subscriptionId,
@@ -1725,7 +1798,6 @@ const listEnabledResourceTypesNextOperationSpec = {
1725
1798
  bodyMapper: ErrorResponse
1726
1799
  }
1727
1800
  },
1728
- queryParameters: [apiVersion],
1729
1801
  urlParameters: [
1730
1802
  $host,
1731
1803
  subscriptionId,
@@ -1770,20 +1842,31 @@ class ResourceSyncRulesImpl {
1770
1842
  [Symbol.asyncIterator]() {
1771
1843
  return this;
1772
1844
  },
1773
- byPage: () => {
1774
- return this.listByCustomLocationIDPagingPage(resourceGroupName, resourceName, options);
1845
+ byPage: (settings) => {
1846
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1847
+ throw new Error("maxPageSize is not supported by this operation.");
1848
+ }
1849
+ return this.listByCustomLocationIDPagingPage(resourceGroupName, resourceName, options, settings);
1775
1850
  }
1776
1851
  };
1777
1852
  }
1778
- listByCustomLocationIDPagingPage(resourceGroupName, resourceName, options) {
1853
+ listByCustomLocationIDPagingPage(resourceGroupName, resourceName, options, settings) {
1779
1854
  return tslib.__asyncGenerator(this, arguments, function* listByCustomLocationIDPagingPage_1() {
1780
- let result = yield tslib.__await(this._listByCustomLocationID(resourceGroupName, resourceName, options));
1781
- yield yield tslib.__await(result.value || []);
1782
- let continuationToken = result.nextLink;
1855
+ let result;
1856
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1857
+ if (!continuationToken) {
1858
+ result = yield tslib.__await(this._listByCustomLocationID(resourceGroupName, resourceName, options));
1859
+ let page = result.value || [];
1860
+ continuationToken = result.nextLink;
1861
+ setContinuationToken(page, continuationToken);
1862
+ yield yield tslib.__await(page);
1863
+ }
1783
1864
  while (continuationToken) {
1784
1865
  result = yield tslib.__await(this._listByCustomLocationIDNext(resourceGroupName, resourceName, continuationToken, options));
1785
1866
  continuationToken = result.nextLink;
1786
- yield yield tslib.__await(result.value || []);
1867
+ let page = result.value || [];
1868
+ setContinuationToken(page, continuationToken);
1869
+ yield yield tslib.__await(page);
1787
1870
  }
1788
1871
  });
1789
1872
  }
@@ -2119,7 +2202,6 @@ const listByCustomLocationIDNextOperationSpec = {
2119
2202
  bodyMapper: ErrorResponse
2120
2203
  }
2121
2204
  },
2122
- queryParameters: [apiVersion],
2123
2205
  urlParameters: [
2124
2206
  $host,
2125
2207
  subscriptionId,
@@ -2146,7 +2228,7 @@ class CustomLocationsManagementClient extends coreClient__namespace.ServiceClien
2146
2228
  * @param options The parameter options
2147
2229
  */
2148
2230
  constructor(credentials, subscriptionId, options) {
2149
- var _a, _b;
2231
+ var _a, _b, _c;
2150
2232
  if (credentials === undefined) {
2151
2233
  throw new Error("'credentials' cannot be null");
2152
2234
  }
@@ -2161,32 +2243,34 @@ class CustomLocationsManagementClient extends coreClient__namespace.ServiceClien
2161
2243
  requestContentType: "application/json; charset=utf-8",
2162
2244
  credential: credentials
2163
2245
  };
2164
- const packageDetails = `azsdk-js-arm-extendedlocation/1.0.0-beta.2`;
2246
+ const packageDetails = `azsdk-js-arm-extendedlocation/1.0.0-beta.3`;
2165
2247
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2166
2248
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2167
2249
  : `${packageDetails}`;
2168
- if (!options.credentialScopes) {
2169
- options.credentialScopes = ["https://management.azure.com/.default"];
2170
- }
2171
2250
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2172
2251
  userAgentPrefix
2173
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
2252
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
2174
2253
  super(optionsWithDefaults);
2254
+ let bearerTokenAuthenticationPolicyFound = false;
2175
2255
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
2176
2256
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
2177
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2257
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2178
2258
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
2179
- if (!bearerTokenAuthenticationPolicyFound) {
2180
- this.pipeline.removePolicy({
2181
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2182
- });
2183
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2184
- scopes: `${optionsWithDefaults.baseUri}/.default`,
2185
- challengeCallbacks: {
2186
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2187
- }
2188
- }));
2189
- }
2259
+ }
2260
+ if (!options ||
2261
+ !options.pipeline ||
2262
+ options.pipeline.getOrderedPolicies().length == 0 ||
2263
+ !bearerTokenAuthenticationPolicyFound) {
2264
+ this.pipeline.removePolicy({
2265
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2266
+ });
2267
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2268
+ credential: credentials,
2269
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
2270
+ challengeCallbacks: {
2271
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2272
+ }
2273
+ }));
2190
2274
  }
2191
2275
  // Parameter assignments
2192
2276
  this.subscriptionId = subscriptionId;
@@ -2227,4 +2311,5 @@ class CustomLocationsManagementClient extends coreClient__namespace.ServiceClien
2227
2311
  }
2228
2312
 
2229
2313
  exports.CustomLocationsManagementClient = CustomLocationsManagementClient;
2314
+ exports.getContinuationToken = getContinuationToken;
2230
2315
  //# sourceMappingURL=index.js.map