@azure/arm-policy 5.0.3-alpha.20221102.1 → 5.0.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 (44) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/dist/index.js +322 -122
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/src/index.d.ts +1 -0
  7. package/dist-esm/src/index.d.ts.map +1 -1
  8. package/dist-esm/src/index.js +1 -0
  9. package/dist-esm/src/index.js.map +1 -1
  10. package/dist-esm/src/operations/dataPolicyManifests.d.ts.map +1 -1
  11. package/dist-esm/src/operations/dataPolicyManifests.js +19 -7
  12. package/dist-esm/src/operations/dataPolicyManifests.js.map +1 -1
  13. package/dist-esm/src/operations/policyAssignments.d.ts.map +1 -1
  14. package/dist-esm/src/operations/policyAssignments.js +73 -28
  15. package/dist-esm/src/operations/policyAssignments.js.map +1 -1
  16. package/dist-esm/src/operations/policyDefinitions.d.ts.map +1 -1
  17. package/dist-esm/src/operations/policyDefinitions.js +55 -21
  18. package/dist-esm/src/operations/policyDefinitions.js.map +1 -1
  19. package/dist-esm/src/operations/policyExemptions.d.ts.map +1 -1
  20. package/dist-esm/src/operations/policyExemptions.js +73 -28
  21. package/dist-esm/src/operations/policyExemptions.js.map +1 -1
  22. package/dist-esm/src/operations/policySetDefinitions.d.ts.map +1 -1
  23. package/dist-esm/src/operations/policySetDefinitions.js +55 -21
  24. package/dist-esm/src/operations/policySetDefinitions.js.map +1 -1
  25. package/dist-esm/src/pagingHelper.d.ts +13 -0
  26. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  27. package/dist-esm/src/pagingHelper.js +32 -0
  28. package/dist-esm/src/pagingHelper.js.map +1 -0
  29. package/dist-esm/src/policyClient.d.ts.map +1 -1
  30. package/dist-esm/src/policyClient.js +19 -17
  31. package/dist-esm/src/policyClient.js.map +1 -1
  32. package/dist-esm/test/policy_examples.js +4 -7
  33. package/dist-esm/test/policy_examples.js.map +1 -1
  34. package/package.json +7 -5
  35. package/review/arm-policy.api.md +3 -0
  36. package/src/index.ts +1 -0
  37. package/src/operations/dataPolicyManifests.ts +22 -9
  38. package/src/operations/policyAssignments.ts +95 -40
  39. package/src/operations/policyDefinitions.ts +66 -25
  40. package/src/operations/policyExemptions.ts +95 -40
  41. package/src/operations/policySetDefinitions.ts +66 -25
  42. package/src/pagingHelper.ts +39 -0
  43. package/src/policyClient.ts +25 -19
  44. package/types/arm-policy.d.ts +9 -0
package/dist/index.js CHANGED
@@ -27,6 +27,38 @@ function _interopNamespace(e) {
27
27
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
28
28
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
29
29
 
30
+ /*
31
+ * Copyright (c) Microsoft Corporation.
32
+ * Licensed under the MIT License.
33
+ *
34
+ * Code generated by Microsoft (R) AutoRest Code Generator.
35
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
36
+ */
37
+ const pageMap = new WeakMap();
38
+ /**
39
+ * Given a result page from a pageable operation, returns a
40
+ * continuation token that can be used to begin paging from
41
+ * that point later.
42
+ * @param page A result object from calling .byPage() on a paged operation.
43
+ * @returns The continuation token that can be passed into byPage().
44
+ */
45
+ function getContinuationToken(page) {
46
+ var _a;
47
+ if (typeof page !== "object" || page === null) {
48
+ return undefined;
49
+ }
50
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
51
+ }
52
+ function setContinuationToken(page, continuationToken) {
53
+ var _a;
54
+ if (typeof page !== "object" || page === null || !continuationToken) {
55
+ return;
56
+ }
57
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
58
+ pageInfo.continuationToken = continuationToken;
59
+ pageMap.set(page, pageInfo);
60
+ }
61
+
30
62
  /*
31
63
  * Copyright (c) Microsoft Corporation.
32
64
  * Licensed under the MIT License.
@@ -1724,20 +1756,31 @@ class DataPolicyManifestsImpl {
1724
1756
  [Symbol.asyncIterator]() {
1725
1757
  return this;
1726
1758
  },
1727
- byPage: () => {
1728
- return this.listPagingPage(options);
1759
+ byPage: (settings) => {
1760
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1761
+ throw new Error("maxPageSize is not supported by this operation.");
1762
+ }
1763
+ return this.listPagingPage(options, settings);
1729
1764
  }
1730
1765
  };
1731
1766
  }
1732
- listPagingPage(options) {
1767
+ listPagingPage(options, settings) {
1733
1768
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1734
- let result = yield tslib.__await(this._list(options));
1735
- yield yield tslib.__await(result.value || []);
1736
- let continuationToken = result.nextLink;
1769
+ let result;
1770
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1771
+ if (!continuationToken) {
1772
+ result = yield tslib.__await(this._list(options));
1773
+ let page = result.value || [];
1774
+ continuationToken = result.nextLink;
1775
+ setContinuationToken(page, continuationToken);
1776
+ yield yield tslib.__await(page);
1777
+ }
1737
1778
  while (continuationToken) {
1738
1779
  result = yield tslib.__await(this._listNext(continuationToken, options));
1739
1780
  continuationToken = result.nextLink;
1740
- yield yield tslib.__await(result.value || []);
1781
+ let page = result.value || [];
1782
+ setContinuationToken(page, continuationToken);
1783
+ yield yield tslib.__await(page);
1741
1784
  }
1742
1785
  });
1743
1786
  }
@@ -1879,20 +1922,31 @@ class PolicyAssignmentsImpl {
1879
1922
  [Symbol.asyncIterator]() {
1880
1923
  return this;
1881
1924
  },
1882
- byPage: () => {
1883
- return this.listForResourceGroupPagingPage(resourceGroupName, options);
1925
+ byPage: (settings) => {
1926
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1927
+ throw new Error("maxPageSize is not supported by this operation.");
1928
+ }
1929
+ return this.listForResourceGroupPagingPage(resourceGroupName, options, settings);
1884
1930
  }
1885
1931
  };
1886
1932
  }
1887
- listForResourceGroupPagingPage(resourceGroupName, options) {
1933
+ listForResourceGroupPagingPage(resourceGroupName, options, settings) {
1888
1934
  return tslib.__asyncGenerator(this, arguments, function* listForResourceGroupPagingPage_1() {
1889
- let result = yield tslib.__await(this._listForResourceGroup(resourceGroupName, options));
1890
- yield yield tslib.__await(result.value || []);
1891
- let continuationToken = result.nextLink;
1935
+ let result;
1936
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1937
+ if (!continuationToken) {
1938
+ result = yield tslib.__await(this._listForResourceGroup(resourceGroupName, options));
1939
+ let page = result.value || [];
1940
+ continuationToken = result.nextLink;
1941
+ setContinuationToken(page, continuationToken);
1942
+ yield yield tslib.__await(page);
1943
+ }
1892
1944
  while (continuationToken) {
1893
1945
  result = yield tslib.__await(this._listForResourceGroupNext(resourceGroupName, continuationToken, options));
1894
1946
  continuationToken = result.nextLink;
1895
- yield yield tslib.__await(result.value || []);
1947
+ let page = result.value || [];
1948
+ setContinuationToken(page, continuationToken);
1949
+ yield yield tslib.__await(page);
1896
1950
  }
1897
1951
  });
1898
1952
  }
@@ -1955,20 +2009,31 @@ class PolicyAssignmentsImpl {
1955
2009
  [Symbol.asyncIterator]() {
1956
2010
  return this;
1957
2011
  },
1958
- byPage: () => {
1959
- return this.listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options);
2012
+ byPage: (settings) => {
2013
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2014
+ throw new Error("maxPageSize is not supported by this operation.");
2015
+ }
2016
+ return this.listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings);
1960
2017
  }
1961
2018
  };
1962
2019
  }
1963
- listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) {
2020
+ listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings) {
1964
2021
  return tslib.__asyncGenerator(this, arguments, function* listForResourcePagingPage_1() {
1965
- let result = yield tslib.__await(this._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options));
1966
- yield yield tslib.__await(result.value || []);
1967
- let continuationToken = result.nextLink;
2022
+ let result;
2023
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2024
+ if (!continuationToken) {
2025
+ result = yield tslib.__await(this._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options));
2026
+ let page = result.value || [];
2027
+ continuationToken = result.nextLink;
2028
+ setContinuationToken(page, continuationToken);
2029
+ yield yield tslib.__await(page);
2030
+ }
1968
2031
  while (continuationToken) {
1969
2032
  result = yield tslib.__await(this._listForResourceNext(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, continuationToken, options));
1970
2033
  continuationToken = result.nextLink;
1971
- yield yield tslib.__await(result.value || []);
2034
+ let page = result.value || [];
2035
+ setContinuationToken(page, continuationToken);
2036
+ yield yield tslib.__await(page);
1972
2037
  }
1973
2038
  });
1974
2039
  }
@@ -2011,20 +2076,31 @@ class PolicyAssignmentsImpl {
2011
2076
  [Symbol.asyncIterator]() {
2012
2077
  return this;
2013
2078
  },
2014
- byPage: () => {
2015
- return this.listForManagementGroupPagingPage(managementGroupId, options);
2079
+ byPage: (settings) => {
2080
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2081
+ throw new Error("maxPageSize is not supported by this operation.");
2082
+ }
2083
+ return this.listForManagementGroupPagingPage(managementGroupId, options, settings);
2016
2084
  }
2017
2085
  };
2018
2086
  }
2019
- listForManagementGroupPagingPage(managementGroupId, options) {
2087
+ listForManagementGroupPagingPage(managementGroupId, options, settings) {
2020
2088
  return tslib.__asyncGenerator(this, arguments, function* listForManagementGroupPagingPage_1() {
2021
- let result = yield tslib.__await(this._listForManagementGroup(managementGroupId, options));
2022
- yield yield tslib.__await(result.value || []);
2023
- let continuationToken = result.nextLink;
2089
+ let result;
2090
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2091
+ if (!continuationToken) {
2092
+ result = yield tslib.__await(this._listForManagementGroup(managementGroupId, options));
2093
+ let page = result.value || [];
2094
+ continuationToken = result.nextLink;
2095
+ setContinuationToken(page, continuationToken);
2096
+ yield yield tslib.__await(page);
2097
+ }
2024
2098
  while (continuationToken) {
2025
2099
  result = yield tslib.__await(this._listForManagementGroupNext(managementGroupId, continuationToken, options));
2026
2100
  continuationToken = result.nextLink;
2027
- yield yield tslib.__await(result.value || []);
2101
+ let page = result.value || [];
2102
+ setContinuationToken(page, continuationToken);
2103
+ yield yield tslib.__await(page);
2028
2104
  }
2029
2105
  });
2030
2106
  }
@@ -2069,20 +2145,31 @@ class PolicyAssignmentsImpl {
2069
2145
  [Symbol.asyncIterator]() {
2070
2146
  return this;
2071
2147
  },
2072
- byPage: () => {
2073
- return this.listPagingPage(options);
2148
+ byPage: (settings) => {
2149
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2150
+ throw new Error("maxPageSize is not supported by this operation.");
2151
+ }
2152
+ return this.listPagingPage(options, settings);
2074
2153
  }
2075
2154
  };
2076
2155
  }
2077
- listPagingPage(options) {
2156
+ listPagingPage(options, settings) {
2078
2157
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
2079
- let result = yield tslib.__await(this._list(options));
2080
- yield yield tslib.__await(result.value || []);
2081
- let continuationToken = result.nextLink;
2158
+ let result;
2159
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2160
+ if (!continuationToken) {
2161
+ result = yield tslib.__await(this._list(options));
2162
+ let page = result.value || [];
2163
+ continuationToken = result.nextLink;
2164
+ setContinuationToken(page, continuationToken);
2165
+ yield yield tslib.__await(page);
2166
+ }
2082
2167
  while (continuationToken) {
2083
2168
  result = yield tslib.__await(this._listNext(continuationToken, options));
2084
2169
  continuationToken = result.nextLink;
2085
- yield yield tslib.__await(result.value || []);
2170
+ let page = result.value || [];
2171
+ setContinuationToken(page, continuationToken);
2172
+ yield yield tslib.__await(page);
2086
2173
  }
2087
2174
  });
2088
2175
  }
@@ -2730,20 +2817,31 @@ class PolicyDefinitionsImpl {
2730
2817
  [Symbol.asyncIterator]() {
2731
2818
  return this;
2732
2819
  },
2733
- byPage: () => {
2734
- return this.listPagingPage(options);
2820
+ byPage: (settings) => {
2821
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2822
+ throw new Error("maxPageSize is not supported by this operation.");
2823
+ }
2824
+ return this.listPagingPage(options, settings);
2735
2825
  }
2736
2826
  };
2737
2827
  }
2738
- listPagingPage(options) {
2828
+ listPagingPage(options, settings) {
2739
2829
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
2740
- let result = yield tslib.__await(this._list(options));
2741
- yield yield tslib.__await(result.value || []);
2742
- let continuationToken = result.nextLink;
2830
+ let result;
2831
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2832
+ if (!continuationToken) {
2833
+ result = yield tslib.__await(this._list(options));
2834
+ let page = result.value || [];
2835
+ continuationToken = result.nextLink;
2836
+ setContinuationToken(page, continuationToken);
2837
+ yield yield tslib.__await(page);
2838
+ }
2743
2839
  while (continuationToken) {
2744
2840
  result = yield tslib.__await(this._listNext(continuationToken, options));
2745
2841
  continuationToken = result.nextLink;
2746
- yield yield tslib.__await(result.value || []);
2842
+ let page = result.value || [];
2843
+ setContinuationToken(page, continuationToken);
2844
+ yield yield tslib.__await(page);
2747
2845
  }
2748
2846
  });
2749
2847
  }
@@ -2782,20 +2880,31 @@ class PolicyDefinitionsImpl {
2782
2880
  [Symbol.asyncIterator]() {
2783
2881
  return this;
2784
2882
  },
2785
- byPage: () => {
2786
- return this.listBuiltInPagingPage(options);
2883
+ byPage: (settings) => {
2884
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2885
+ throw new Error("maxPageSize is not supported by this operation.");
2886
+ }
2887
+ return this.listBuiltInPagingPage(options, settings);
2787
2888
  }
2788
2889
  };
2789
2890
  }
2790
- listBuiltInPagingPage(options) {
2891
+ listBuiltInPagingPage(options, settings) {
2791
2892
  return tslib.__asyncGenerator(this, arguments, function* listBuiltInPagingPage_1() {
2792
- let result = yield tslib.__await(this._listBuiltIn(options));
2793
- yield yield tslib.__await(result.value || []);
2794
- let continuationToken = result.nextLink;
2893
+ let result;
2894
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2895
+ if (!continuationToken) {
2896
+ result = yield tslib.__await(this._listBuiltIn(options));
2897
+ let page = result.value || [];
2898
+ continuationToken = result.nextLink;
2899
+ setContinuationToken(page, continuationToken);
2900
+ yield yield tslib.__await(page);
2901
+ }
2795
2902
  while (continuationToken) {
2796
2903
  result = yield tslib.__await(this._listBuiltInNext(continuationToken, options));
2797
2904
  continuationToken = result.nextLink;
2798
- yield yield tslib.__await(result.value || []);
2905
+ let page = result.value || [];
2906
+ setContinuationToken(page, continuationToken);
2907
+ yield yield tslib.__await(page);
2799
2908
  }
2800
2909
  });
2801
2910
  }
@@ -2840,20 +2949,31 @@ class PolicyDefinitionsImpl {
2840
2949
  [Symbol.asyncIterator]() {
2841
2950
  return this;
2842
2951
  },
2843
- byPage: () => {
2844
- return this.listByManagementGroupPagingPage(managementGroupId, options);
2952
+ byPage: (settings) => {
2953
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2954
+ throw new Error("maxPageSize is not supported by this operation.");
2955
+ }
2956
+ return this.listByManagementGroupPagingPage(managementGroupId, options, settings);
2845
2957
  }
2846
2958
  };
2847
2959
  }
2848
- listByManagementGroupPagingPage(managementGroupId, options) {
2960
+ listByManagementGroupPagingPage(managementGroupId, options, settings) {
2849
2961
  return tslib.__asyncGenerator(this, arguments, function* listByManagementGroupPagingPage_1() {
2850
- let result = yield tslib.__await(this._listByManagementGroup(managementGroupId, options));
2851
- yield yield tslib.__await(result.value || []);
2852
- let continuationToken = result.nextLink;
2962
+ let result;
2963
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2964
+ if (!continuationToken) {
2965
+ result = yield tslib.__await(this._listByManagementGroup(managementGroupId, options));
2966
+ let page = result.value || [];
2967
+ continuationToken = result.nextLink;
2968
+ setContinuationToken(page, continuationToken);
2969
+ yield yield tslib.__await(page);
2970
+ }
2853
2971
  while (continuationToken) {
2854
2972
  result = yield tslib.__await(this._listByManagementGroupNext(managementGroupId, continuationToken, options));
2855
2973
  continuationToken = result.nextLink;
2856
- yield yield tslib.__await(result.value || []);
2974
+ let page = result.value || [];
2975
+ setContinuationToken(page, continuationToken);
2976
+ yield yield tslib.__await(page);
2857
2977
  }
2858
2978
  });
2859
2979
  }
@@ -3291,20 +3411,31 @@ class PolicySetDefinitionsImpl {
3291
3411
  [Symbol.asyncIterator]() {
3292
3412
  return this;
3293
3413
  },
3294
- byPage: () => {
3295
- return this.listPagingPage(options);
3414
+ byPage: (settings) => {
3415
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
3416
+ throw new Error("maxPageSize is not supported by this operation.");
3417
+ }
3418
+ return this.listPagingPage(options, settings);
3296
3419
  }
3297
3420
  };
3298
3421
  }
3299
- listPagingPage(options) {
3422
+ listPagingPage(options, settings) {
3300
3423
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
3301
- let result = yield tslib.__await(this._list(options));
3302
- yield yield tslib.__await(result.value || []);
3303
- let continuationToken = result.nextLink;
3424
+ let result;
3425
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
3426
+ if (!continuationToken) {
3427
+ result = yield tslib.__await(this._list(options));
3428
+ let page = result.value || [];
3429
+ continuationToken = result.nextLink;
3430
+ setContinuationToken(page, continuationToken);
3431
+ yield yield tslib.__await(page);
3432
+ }
3304
3433
  while (continuationToken) {
3305
3434
  result = yield tslib.__await(this._listNext(continuationToken, options));
3306
3435
  continuationToken = result.nextLink;
3307
- yield yield tslib.__await(result.value || []);
3436
+ let page = result.value || [];
3437
+ setContinuationToken(page, continuationToken);
3438
+ yield yield tslib.__await(page);
3308
3439
  }
3309
3440
  });
3310
3441
  }
@@ -3341,20 +3472,31 @@ class PolicySetDefinitionsImpl {
3341
3472
  [Symbol.asyncIterator]() {
3342
3473
  return this;
3343
3474
  },
3344
- byPage: () => {
3345
- return this.listBuiltInPagingPage(options);
3475
+ byPage: (settings) => {
3476
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
3477
+ throw new Error("maxPageSize is not supported by this operation.");
3478
+ }
3479
+ return this.listBuiltInPagingPage(options, settings);
3346
3480
  }
3347
3481
  };
3348
3482
  }
3349
- listBuiltInPagingPage(options) {
3483
+ listBuiltInPagingPage(options, settings) {
3350
3484
  return tslib.__asyncGenerator(this, arguments, function* listBuiltInPagingPage_1() {
3351
- let result = yield tslib.__await(this._listBuiltIn(options));
3352
- yield yield tslib.__await(result.value || []);
3353
- let continuationToken = result.nextLink;
3485
+ let result;
3486
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
3487
+ if (!continuationToken) {
3488
+ result = yield tslib.__await(this._listBuiltIn(options));
3489
+ let page = result.value || [];
3490
+ continuationToken = result.nextLink;
3491
+ setContinuationToken(page, continuationToken);
3492
+ yield yield tslib.__await(page);
3493
+ }
3354
3494
  while (continuationToken) {
3355
3495
  result = yield tslib.__await(this._listBuiltInNext(continuationToken, options));
3356
3496
  continuationToken = result.nextLink;
3357
- yield yield tslib.__await(result.value || []);
3497
+ let page = result.value || [];
3498
+ setContinuationToken(page, continuationToken);
3499
+ yield yield tslib.__await(page);
3358
3500
  }
3359
3501
  });
3360
3502
  }
@@ -3399,20 +3541,31 @@ class PolicySetDefinitionsImpl {
3399
3541
  [Symbol.asyncIterator]() {
3400
3542
  return this;
3401
3543
  },
3402
- byPage: () => {
3403
- return this.listByManagementGroupPagingPage(managementGroupId, options);
3544
+ byPage: (settings) => {
3545
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
3546
+ throw new Error("maxPageSize is not supported by this operation.");
3547
+ }
3548
+ return this.listByManagementGroupPagingPage(managementGroupId, options, settings);
3404
3549
  }
3405
3550
  };
3406
3551
  }
3407
- listByManagementGroupPagingPage(managementGroupId, options) {
3552
+ listByManagementGroupPagingPage(managementGroupId, options, settings) {
3408
3553
  return tslib.__asyncGenerator(this, arguments, function* listByManagementGroupPagingPage_1() {
3409
- let result = yield tslib.__await(this._listByManagementGroup(managementGroupId, options));
3410
- yield yield tslib.__await(result.value || []);
3411
- let continuationToken = result.nextLink;
3554
+ let result;
3555
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
3556
+ if (!continuationToken) {
3557
+ result = yield tslib.__await(this._listByManagementGroup(managementGroupId, options));
3558
+ let page = result.value || [];
3559
+ continuationToken = result.nextLink;
3560
+ setContinuationToken(page, continuationToken);
3561
+ yield yield tslib.__await(page);
3562
+ }
3412
3563
  while (continuationToken) {
3413
3564
  result = yield tslib.__await(this._listByManagementGroupNext(managementGroupId, continuationToken, options));
3414
3565
  continuationToken = result.nextLink;
3415
- yield yield tslib.__await(result.value || []);
3566
+ let page = result.value || [];
3567
+ setContinuationToken(page, continuationToken);
3568
+ yield yield tslib.__await(page);
3416
3569
  }
3417
3570
  });
3418
3571
  }
@@ -3852,20 +4005,31 @@ class PolicyExemptionsImpl {
3852
4005
  [Symbol.asyncIterator]() {
3853
4006
  return this;
3854
4007
  },
3855
- byPage: () => {
3856
- return this.listPagingPage(options);
4008
+ byPage: (settings) => {
4009
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
4010
+ throw new Error("maxPageSize is not supported by this operation.");
4011
+ }
4012
+ return this.listPagingPage(options, settings);
3857
4013
  }
3858
4014
  };
3859
4015
  }
3860
- listPagingPage(options) {
4016
+ listPagingPage(options, settings) {
3861
4017
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
3862
- let result = yield tslib.__await(this._list(options));
3863
- yield yield tslib.__await(result.value || []);
3864
- let continuationToken = result.nextLink;
4018
+ let result;
4019
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
4020
+ if (!continuationToken) {
4021
+ result = yield tslib.__await(this._list(options));
4022
+ let page = result.value || [];
4023
+ continuationToken = result.nextLink;
4024
+ setContinuationToken(page, continuationToken);
4025
+ yield yield tslib.__await(page);
4026
+ }
3865
4027
  while (continuationToken) {
3866
4028
  result = yield tslib.__await(this._listNext(continuationToken, options));
3867
4029
  continuationToken = result.nextLink;
3868
- yield yield tslib.__await(result.value || []);
4030
+ let page = result.value || [];
4031
+ setContinuationToken(page, continuationToken);
4032
+ yield yield tslib.__await(page);
3869
4033
  }
3870
4034
  });
3871
4035
  }
@@ -3906,20 +4070,31 @@ class PolicyExemptionsImpl {
3906
4070
  [Symbol.asyncIterator]() {
3907
4071
  return this;
3908
4072
  },
3909
- byPage: () => {
3910
- return this.listForResourceGroupPagingPage(resourceGroupName, options);
4073
+ byPage: (settings) => {
4074
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
4075
+ throw new Error("maxPageSize is not supported by this operation.");
4076
+ }
4077
+ return this.listForResourceGroupPagingPage(resourceGroupName, options, settings);
3911
4078
  }
3912
4079
  };
3913
4080
  }
3914
- listForResourceGroupPagingPage(resourceGroupName, options) {
4081
+ listForResourceGroupPagingPage(resourceGroupName, options, settings) {
3915
4082
  return tslib.__asyncGenerator(this, arguments, function* listForResourceGroupPagingPage_1() {
3916
- let result = yield tslib.__await(this._listForResourceGroup(resourceGroupName, options));
3917
- yield yield tslib.__await(result.value || []);
3918
- let continuationToken = result.nextLink;
4083
+ let result;
4084
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
4085
+ if (!continuationToken) {
4086
+ result = yield tslib.__await(this._listForResourceGroup(resourceGroupName, options));
4087
+ let page = result.value || [];
4088
+ continuationToken = result.nextLink;
4089
+ setContinuationToken(page, continuationToken);
4090
+ yield yield tslib.__await(page);
4091
+ }
3919
4092
  while (continuationToken) {
3920
4093
  result = yield tslib.__await(this._listForResourceGroupNext(resourceGroupName, continuationToken, options));
3921
4094
  continuationToken = result.nextLink;
3922
- yield yield tslib.__await(result.value || []);
4095
+ let page = result.value || [];
4096
+ setContinuationToken(page, continuationToken);
4097
+ yield yield tslib.__await(page);
3923
4098
  }
3924
4099
  });
3925
4100
  }
@@ -3976,20 +4151,31 @@ class PolicyExemptionsImpl {
3976
4151
  [Symbol.asyncIterator]() {
3977
4152
  return this;
3978
4153
  },
3979
- byPage: () => {
3980
- return this.listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options);
4154
+ byPage: (settings) => {
4155
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
4156
+ throw new Error("maxPageSize is not supported by this operation.");
4157
+ }
4158
+ return this.listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings);
3981
4159
  }
3982
4160
  };
3983
4161
  }
3984
- listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) {
4162
+ listForResourcePagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings) {
3985
4163
  return tslib.__asyncGenerator(this, arguments, function* listForResourcePagingPage_1() {
3986
- let result = yield tslib.__await(this._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options));
3987
- yield yield tslib.__await(result.value || []);
3988
- let continuationToken = result.nextLink;
4164
+ let result;
4165
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
4166
+ if (!continuationToken) {
4167
+ result = yield tslib.__await(this._listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options));
4168
+ let page = result.value || [];
4169
+ continuationToken = result.nextLink;
4170
+ setContinuationToken(page, continuationToken);
4171
+ yield yield tslib.__await(page);
4172
+ }
3989
4173
  while (continuationToken) {
3990
4174
  result = yield tslib.__await(this._listForResourceNext(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, continuationToken, options));
3991
4175
  continuationToken = result.nextLink;
3992
- yield yield tslib.__await(result.value || []);
4176
+ let page = result.value || [];
4177
+ setContinuationToken(page, continuationToken);
4178
+ yield yield tslib.__await(page);
3993
4179
  }
3994
4180
  });
3995
4181
  }
@@ -4029,20 +4215,31 @@ class PolicyExemptionsImpl {
4029
4215
  [Symbol.asyncIterator]() {
4030
4216
  return this;
4031
4217
  },
4032
- byPage: () => {
4033
- return this.listForManagementGroupPagingPage(managementGroupId, options);
4218
+ byPage: (settings) => {
4219
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
4220
+ throw new Error("maxPageSize is not supported by this operation.");
4221
+ }
4222
+ return this.listForManagementGroupPagingPage(managementGroupId, options, settings);
4034
4223
  }
4035
4224
  };
4036
4225
  }
4037
- listForManagementGroupPagingPage(managementGroupId, options) {
4226
+ listForManagementGroupPagingPage(managementGroupId, options, settings) {
4038
4227
  return tslib.__asyncGenerator(this, arguments, function* listForManagementGroupPagingPage_1() {
4039
- let result = yield tslib.__await(this._listForManagementGroup(managementGroupId, options));
4040
- yield yield tslib.__await(result.value || []);
4041
- let continuationToken = result.nextLink;
4228
+ let result;
4229
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
4230
+ if (!continuationToken) {
4231
+ result = yield tslib.__await(this._listForManagementGroup(managementGroupId, options));
4232
+ let page = result.value || [];
4233
+ continuationToken = result.nextLink;
4234
+ setContinuationToken(page, continuationToken);
4235
+ yield yield tslib.__await(page);
4236
+ }
4042
4237
  while (continuationToken) {
4043
4238
  result = yield tslib.__await(this._listForManagementGroupNext(managementGroupId, continuationToken, options));
4044
4239
  continuationToken = result.nextLink;
4045
- yield yield tslib.__await(result.value || []);
4240
+ let page = result.value || [];
4241
+ setContinuationToken(page, continuationToken);
4242
+ yield yield tslib.__await(page);
4046
4243
  }
4047
4244
  });
4048
4245
  }
@@ -4476,7 +4673,7 @@ class PolicyClient extends coreClient__namespace.ServiceClient {
4476
4673
  * @param options The parameter options
4477
4674
  */
4478
4675
  constructor(credentials, subscriptionId, options) {
4479
- var _a, _b;
4676
+ var _a, _b, _c;
4480
4677
  if (credentials === undefined) {
4481
4678
  throw new Error("'credentials' cannot be null");
4482
4679
  }
@@ -4495,28 +4692,30 @@ class PolicyClient extends coreClient__namespace.ServiceClient {
4495
4692
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
4496
4693
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
4497
4694
  : `${packageDetails}`;
4498
- if (!options.credentialScopes) {
4499
- options.credentialScopes = ["https://management.azure.com/.default"];
4500
- }
4501
4695
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
4502
4696
  userAgentPrefix
4503
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
4697
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
4504
4698
  super(optionsWithDefaults);
4699
+ let bearerTokenAuthenticationPolicyFound = false;
4505
4700
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
4506
4701
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
4507
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
4702
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
4508
4703
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
4509
- if (!bearerTokenAuthenticationPolicyFound) {
4510
- this.pipeline.removePolicy({
4511
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
4512
- });
4513
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
4514
- scopes: `${optionsWithDefaults.baseUri}/.default`,
4515
- challengeCallbacks: {
4516
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
4517
- }
4518
- }));
4519
- }
4704
+ }
4705
+ if (!options ||
4706
+ !options.pipeline ||
4707
+ options.pipeline.getOrderedPolicies().length == 0 ||
4708
+ !bearerTokenAuthenticationPolicyFound) {
4709
+ this.pipeline.removePolicy({
4710
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
4711
+ });
4712
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
4713
+ credential: credentials,
4714
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
4715
+ challengeCallbacks: {
4716
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
4717
+ }
4718
+ }));
4520
4719
  }
4521
4720
  // Parameter assignments
4522
4721
  this.subscriptionId = subscriptionId;
@@ -4531,4 +4730,5 @@ class PolicyClient extends coreClient__namespace.ServiceClient {
4531
4730
  }
4532
4731
 
4533
4732
  exports.PolicyClient = PolicyClient;
4733
+ exports.getContinuationToken = getContinuationToken;
4534
4734
  //# sourceMappingURL=index.js.map