@azure/arm-portal 1.0.0-beta.3 → 1.0.0-beta.5

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 (73) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/LICENSE +1 -1
  3. package/README.md +8 -8
  4. package/dist/index.js +173 -59
  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/dashboardsCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/dashboardsDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/dashboardsDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/dashboardsGetSample.js +11 -3
  13. package/dist-esm/samples-dev/dashboardsGetSample.js.map +1 -1
  14. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js +11 -3
  15. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js.map +1 -1
  16. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js +10 -2
  17. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js.map +1 -1
  18. package/dist-esm/samples-dev/dashboardsUpdateSample.js +11 -3
  19. package/dist-esm/samples-dev/dashboardsUpdateSample.js.map +1 -1
  20. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js +10 -2
  21. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js.map +1 -1
  22. package/dist-esm/samples-dev/operationsListSample.js +10 -2
  23. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  24. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js +10 -2
  25. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js.map +1 -1
  26. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js +10 -2
  27. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js.map +1 -1
  28. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js +10 -2
  29. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js.map +1 -1
  30. package/dist-esm/samples-dev/tenantConfigurationsListSample.js +10 -2
  31. package/dist-esm/samples-dev/tenantConfigurationsListSample.js.map +1 -1
  32. package/dist-esm/src/index.d.ts +1 -0
  33. package/dist-esm/src/index.d.ts.map +1 -1
  34. package/dist-esm/src/index.js +1 -0
  35. package/dist-esm/src/index.js.map +1 -1
  36. package/dist-esm/src/models/index.d.ts +7 -5
  37. package/dist-esm/src/models/index.d.ts.map +1 -1
  38. package/dist-esm/src/models/index.js +1 -0
  39. package/dist-esm/src/models/index.js.map +1 -1
  40. package/dist-esm/src/operations/dashboards.d.ts.map +1 -1
  41. package/dist-esm/src/operations/dashboards.js +37 -16
  42. package/dist-esm/src/operations/dashboards.js.map +1 -1
  43. package/dist-esm/src/operations/listTenantConfigurationViolations.d.ts.map +1 -1
  44. package/dist-esm/src/operations/listTenantConfigurationViolations.js +19 -8
  45. package/dist-esm/src/operations/listTenantConfigurationViolations.js.map +1 -1
  46. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  47. package/dist-esm/src/operations/operations.js +19 -8
  48. package/dist-esm/src/operations/operations.js.map +1 -1
  49. package/dist-esm/src/operations/tenantConfigurations.d.ts.map +1 -1
  50. package/dist-esm/src/operations/tenantConfigurations.js +19 -8
  51. package/dist-esm/src/operations/tenantConfigurations.js.map +1 -1
  52. package/dist-esm/src/pagingHelper.d.ts +13 -0
  53. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  54. package/dist-esm/src/pagingHelper.js +32 -0
  55. package/dist-esm/src/pagingHelper.js.map +1 -0
  56. package/dist-esm/src/portal.d.ts +2 -0
  57. package/dist-esm/src/portal.d.ts.map +1 -1
  58. package/dist-esm/src/portal.js +49 -18
  59. package/dist-esm/src/portal.js.map +1 -1
  60. package/dist-esm/test/sampleTest.js +11 -13
  61. package/dist-esm/test/sampleTest.js.map +1 -1
  62. package/package.json +17 -12
  63. package/review/arm-portal.api.md +10 -7
  64. package/src/index.ts +1 -0
  65. package/src/models/index.ts +6 -5
  66. package/src/operations/dashboards.ts +46 -19
  67. package/src/operations/listTenantConfigurationViolations.ts +21 -9
  68. package/src/operations/operations.ts +21 -9
  69. package/src/operations/tenantConfigurations.ts +21 -9
  70. package/src/pagingHelper.ts +39 -0
  71. package/src/portal.ts +60 -20
  72. package/types/arm-portal.d.ts +18 -5
  73. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
- ## Release History
1
+ # Release History
2
2
 
3
- ### 1.0.0-beta.3 (2022-04-28)
3
+ ## 1.0.0-beta.5 (2023-02-02)
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
+
13
+ ## 1.0.0-beta.4 (2022-07-08)
14
+
15
+ **Features**
16
+
17
+ - Added Interface Configuration
18
+ - Added Interface MarkdownPartMetadata
19
+ - Added Interface ProxyResource
20
+
21
+ ## 1.0.0-beta.3 (2022-04-28)
4
22
 
5
23
  **Features**
6
24
 
7
25
  - Bug fix
8
26
 
9
- ### 1.0.0-beta.2 (2021-11-30)
27
+ ## 1.0.0-beta.2 (2021-11-30)
10
28
 
11
29
  The package of @azure/arm-portal is using our next generation design principles since version 1.0.0-beta.2, which contains breaking changes.
12
30
 
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
@@ -1,6 +1,6 @@
1
- # Azure Service client library for JavaScript
1
+ # Azure Portal client library for JavaScript
2
2
 
3
- This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client.
3
+ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Portal client.
4
4
 
5
5
  Allows creation and deletion of Azure Shared Dashboards.
6
6
 
@@ -13,7 +13,7 @@ Allows creation and deletion of Azure Shared Dashboards.
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.
@@ -24,7 +24,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP
24
24
 
25
25
  ### Install the `@azure/arm-portal` package
26
26
 
27
- Install the Azure Service client library for JavaScript with `npm`:
27
+ Install the Azure Portal client library for JavaScript with `npm`:
28
28
 
29
29
  ```bash
30
30
  npm install @azure/arm-portal
@@ -32,8 +32,8 @@ npm install @azure/arm-portal
32
32
 
33
33
  ### Create and authenticate a `Portal`
34
34
 
35
- To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate.
36
- You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal].
35
+ To create a client object to access the Azure Portal API, you will need the `endpoint` of your Azure Portal resource and a `credential`. The Azure Portal client can use Azure Active Directory credentials to authenticate.
36
+ You can find the endpoint for your Azure Portal resource in the [Azure Portal][azure_portal].
37
37
 
38
38
  You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
39
39
 
@@ -43,7 +43,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below
43
43
  npm install @azure/identity
44
44
  ```
45
45
 
46
- You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
46
+ You will also need to **register a new AAD application and grant access to Azure Portal** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
47
47
  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
48
48
 
49
49
  For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
@@ -72,7 +72,7 @@ To use this client library in the browser, first you need to use a bundler. For
72
72
 
73
73
  ### Portal
74
74
 
75
- `Portal` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access.
75
+ `Portal` is the primary interface for developers using the Azure Portal client library. Explore the methods on this client object to understand the different features of the Azure Portal service that you can access.
76
76
 
77
77
  ## Troubleshooting
78
78
 
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
 
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
@@ -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 the last `.value` produced by the `byPage` iterator,
40
+ * returns a continuation token that can be used to begin paging from
41
+ * that point later.
42
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
43
+ * @returns The continuation token that can be passed into byPage() during future calls.
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.
@@ -37,6 +69,7 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
37
69
  /** Known values of {@link ConfigurationName} that the service accepts. */
38
70
  exports.KnownConfigurationName = void 0;
39
71
  (function (KnownConfigurationName) {
72
+ /** Default */
40
73
  KnownConfigurationName["Default"] = "default";
41
74
  })(exports.KnownConfigurationName || (exports.KnownConfigurationName = {}));
42
75
 
@@ -840,20 +873,31 @@ class OperationsImpl {
840
873
  [Symbol.asyncIterator]() {
841
874
  return this;
842
875
  },
843
- byPage: () => {
844
- return this.listPagingPage(options);
876
+ byPage: (settings) => {
877
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
878
+ throw new Error("maxPageSize is not supported by this operation.");
879
+ }
880
+ return this.listPagingPage(options, settings);
845
881
  }
846
882
  };
847
883
  }
848
- listPagingPage(options) {
884
+ listPagingPage(options, settings) {
849
885
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
850
- let result = yield tslib.__await(this._list(options));
851
- yield yield tslib.__await(result.value || []);
852
- let continuationToken = result.nextLink;
886
+ let result;
887
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
888
+ if (!continuationToken) {
889
+ result = yield tslib.__await(this._list(options));
890
+ let page = result.value || [];
891
+ continuationToken = result.nextLink;
892
+ setContinuationToken(page, continuationToken);
893
+ yield yield tslib.__await(page);
894
+ }
853
895
  while (continuationToken) {
854
896
  result = yield tslib.__await(this._listNext(continuationToken, options));
855
897
  continuationToken = result.nextLink;
856
- yield yield tslib.__await(result.value || []);
898
+ let page = result.value || [];
899
+ setContinuationToken(page, continuationToken);
900
+ yield yield tslib.__await(page);
857
901
  }
858
902
  });
859
903
  }
@@ -920,7 +964,6 @@ const listNextOperationSpec$2 = {
920
964
  bodyMapper: ErrorResponse
921
965
  }
922
966
  },
923
- queryParameters: [apiVersion],
924
967
  urlParameters: [$host, nextLink],
925
968
  headerParameters: [accept],
926
969
  serializer: serializer$3
@@ -957,20 +1000,31 @@ class DashboardsImpl {
957
1000
  [Symbol.asyncIterator]() {
958
1001
  return this;
959
1002
  },
960
- byPage: () => {
961
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
1003
+ byPage: (settings) => {
1004
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1005
+ throw new Error("maxPageSize is not supported by this operation.");
1006
+ }
1007
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
962
1008
  }
963
1009
  };
964
1010
  }
965
- listByResourceGroupPagingPage(resourceGroupName, options) {
1011
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
966
1012
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
967
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
968
- yield yield tslib.__await(result.value || []);
969
- let continuationToken = result.nextLink;
1013
+ let result;
1014
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1015
+ if (!continuationToken) {
1016
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1017
+ let page = result.value || [];
1018
+ continuationToken = result.nextLink;
1019
+ setContinuationToken(page, continuationToken);
1020
+ yield yield tslib.__await(page);
1021
+ }
970
1022
  while (continuationToken) {
971
1023
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
972
1024
  continuationToken = result.nextLink;
973
- yield yield tslib.__await(result.value || []);
1025
+ let page = result.value || [];
1026
+ setContinuationToken(page, continuationToken);
1027
+ yield yield tslib.__await(page);
974
1028
  }
975
1029
  });
976
1030
  }
@@ -1005,20 +1059,31 @@ class DashboardsImpl {
1005
1059
  [Symbol.asyncIterator]() {
1006
1060
  return this;
1007
1061
  },
1008
- byPage: () => {
1009
- return this.listBySubscriptionPagingPage(options);
1062
+ byPage: (settings) => {
1063
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1064
+ throw new Error("maxPageSize is not supported by this operation.");
1065
+ }
1066
+ return this.listBySubscriptionPagingPage(options, settings);
1010
1067
  }
1011
1068
  };
1012
1069
  }
1013
- listBySubscriptionPagingPage(options) {
1070
+ listBySubscriptionPagingPage(options, settings) {
1014
1071
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
1015
- let result = yield tslib.__await(this._listBySubscription(options));
1016
- yield yield tslib.__await(result.value || []);
1017
- let continuationToken = result.nextLink;
1072
+ let result;
1073
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1074
+ if (!continuationToken) {
1075
+ result = yield tslib.__await(this._listBySubscription(options));
1076
+ let page = result.value || [];
1077
+ continuationToken = result.nextLink;
1078
+ setContinuationToken(page, continuationToken);
1079
+ yield yield tslib.__await(page);
1080
+ }
1018
1081
  while (continuationToken) {
1019
1082
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
1020
1083
  continuationToken = result.nextLink;
1021
- yield yield tslib.__await(result.value || []);
1084
+ let page = result.value || [];
1085
+ setContinuationToken(page, continuationToken);
1086
+ yield yield tslib.__await(page);
1022
1087
  }
1023
1088
  });
1024
1089
  }
@@ -1252,7 +1317,6 @@ const listByResourceGroupNextOperationSpec = {
1252
1317
  bodyMapper: ErrorResponse
1253
1318
  }
1254
1319
  },
1255
- queryParameters: [apiVersion],
1256
1320
  urlParameters: [
1257
1321
  $host,
1258
1322
  nextLink,
@@ -1273,7 +1337,6 @@ const listBySubscriptionNextOperationSpec = {
1273
1337
  bodyMapper: ErrorResponse
1274
1338
  }
1275
1339
  },
1276
- queryParameters: [apiVersion],
1277
1340
  urlParameters: [
1278
1341
  $host,
1279
1342
  nextLink,
@@ -1313,20 +1376,31 @@ class TenantConfigurationsImpl {
1313
1376
  [Symbol.asyncIterator]() {
1314
1377
  return this;
1315
1378
  },
1316
- byPage: () => {
1317
- return this.listPagingPage(options);
1379
+ byPage: (settings) => {
1380
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1381
+ throw new Error("maxPageSize is not supported by this operation.");
1382
+ }
1383
+ return this.listPagingPage(options, settings);
1318
1384
  }
1319
1385
  };
1320
1386
  }
1321
- listPagingPage(options) {
1387
+ listPagingPage(options, settings) {
1322
1388
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1323
- let result = yield tslib.__await(this._list(options));
1324
- yield yield tslib.__await(result.value || []);
1325
- let continuationToken = result.nextLink;
1389
+ let result;
1390
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1391
+ if (!continuationToken) {
1392
+ result = yield tslib.__await(this._list(options));
1393
+ let page = result.value || [];
1394
+ continuationToken = result.nextLink;
1395
+ setContinuationToken(page, continuationToken);
1396
+ yield yield tslib.__await(page);
1397
+ }
1326
1398
  while (continuationToken) {
1327
1399
  result = yield tslib.__await(this._listNext(continuationToken, options));
1328
1400
  continuationToken = result.nextLink;
1329
- yield yield tslib.__await(result.value || []);
1401
+ let page = result.value || [];
1402
+ setContinuationToken(page, continuationToken);
1403
+ yield yield tslib.__await(page);
1330
1404
  }
1331
1405
  });
1332
1406
  }
@@ -1472,7 +1546,6 @@ const listNextOperationSpec$1 = {
1472
1546
  bodyMapper: ErrorResponse
1473
1547
  }
1474
1548
  },
1475
- queryParameters: [apiVersion],
1476
1549
  urlParameters: [$host, nextLink],
1477
1550
  headerParameters: [accept],
1478
1551
  serializer: serializer$1
@@ -1508,20 +1581,31 @@ class ListTenantConfigurationViolationsImpl {
1508
1581
  [Symbol.asyncIterator]() {
1509
1582
  return this;
1510
1583
  },
1511
- byPage: () => {
1512
- return this.listPagingPage(options);
1584
+ byPage: (settings) => {
1585
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1586
+ throw new Error("maxPageSize is not supported by this operation.");
1587
+ }
1588
+ return this.listPagingPage(options, settings);
1513
1589
  }
1514
1590
  };
1515
1591
  }
1516
- listPagingPage(options) {
1592
+ listPagingPage(options, settings) {
1517
1593
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1518
- let result = yield tslib.__await(this._list(options));
1519
- yield yield tslib.__await(result.value || []);
1520
- let continuationToken = result.nextLink;
1594
+ let result;
1595
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1596
+ if (!continuationToken) {
1597
+ result = yield tslib.__await(this._list(options));
1598
+ let page = result.value || [];
1599
+ continuationToken = result.nextLink;
1600
+ setContinuationToken(page, continuationToken);
1601
+ yield yield tslib.__await(page);
1602
+ }
1521
1603
  while (continuationToken) {
1522
1604
  result = yield tslib.__await(this._listNext(continuationToken, options));
1523
1605
  continuationToken = result.nextLink;
1524
- yield yield tslib.__await(result.value || []);
1606
+ let page = result.value || [];
1607
+ setContinuationToken(page, continuationToken);
1608
+ yield yield tslib.__await(page);
1525
1609
  }
1526
1610
  });
1527
1611
  }
@@ -1588,7 +1672,6 @@ const listNextOperationSpec = {
1588
1672
  bodyMapper: ErrorResponse
1589
1673
  }
1590
1674
  },
1591
- queryParameters: [apiVersion],
1592
1675
  urlParameters: [$host, nextLink],
1593
1676
  headerParameters: [accept],
1594
1677
  serializer
@@ -1610,7 +1693,7 @@ class Portal extends coreClient__namespace.ServiceClient {
1610
1693
  * @param options The parameter options
1611
1694
  */
1612
1695
  constructor(credentials, subscriptionId, options) {
1613
- var _a, _b;
1696
+ var _a, _b, _c;
1614
1697
  if (credentials === undefined) {
1615
1698
  throw new Error("'credentials' cannot be null");
1616
1699
  }
@@ -1625,32 +1708,34 @@ class Portal extends coreClient__namespace.ServiceClient {
1625
1708
  requestContentType: "application/json; charset=utf-8",
1626
1709
  credential: credentials
1627
1710
  };
1628
- const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.3`;
1711
+ const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.5`;
1629
1712
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1630
1713
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1631
1714
  : `${packageDetails}`;
1632
- if (!options.credentialScopes) {
1633
- options.credentialScopes = ["https://management.azure.com/.default"];
1634
- }
1635
1715
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1636
1716
  userAgentPrefix
1637
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1717
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1638
1718
  super(optionsWithDefaults);
1719
+ let bearerTokenAuthenticationPolicyFound = false;
1639
1720
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1640
1721
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
1641
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1722
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1642
1723
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1643
- if (!bearerTokenAuthenticationPolicyFound) {
1644
- this.pipeline.removePolicy({
1645
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1646
- });
1647
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1648
- scopes: `${optionsWithDefaults.baseUri}/.default`,
1649
- challengeCallbacks: {
1650
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1651
- }
1652
- }));
1653
- }
1724
+ }
1725
+ if (!options ||
1726
+ !options.pipeline ||
1727
+ options.pipeline.getOrderedPolicies().length == 0 ||
1728
+ !bearerTokenAuthenticationPolicyFound) {
1729
+ this.pipeline.removePolicy({
1730
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1731
+ });
1732
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1733
+ credential: credentials,
1734
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1735
+ challengeCallbacks: {
1736
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1737
+ }
1738
+ }));
1654
1739
  }
1655
1740
  // Parameter assignments
1656
1741
  this.subscriptionId = subscriptionId;
@@ -1661,8 +1746,37 @@ class Portal extends coreClient__namespace.ServiceClient {
1661
1746
  this.dashboards = new DashboardsImpl(this);
1662
1747
  this.tenantConfigurations = new TenantConfigurationsImpl(this);
1663
1748
  this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsImpl(this);
1749
+ this.addCustomApiVersionPolicy(options.apiVersion);
1750
+ }
1751
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1752
+ addCustomApiVersionPolicy(apiVersion) {
1753
+ if (!apiVersion) {
1754
+ return;
1755
+ }
1756
+ const apiVersionPolicy = {
1757
+ name: "CustomApiVersionPolicy",
1758
+ sendRequest(request, next) {
1759
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1760
+ const param = request.url.split("?");
1761
+ if (param.length > 1) {
1762
+ const newParams = param[1].split("&").map((item) => {
1763
+ if (item.indexOf("api-version") > -1) {
1764
+ return "api-version=" + apiVersion;
1765
+ }
1766
+ else {
1767
+ return item;
1768
+ }
1769
+ });
1770
+ request.url = param[0] + "?" + newParams.join("&");
1771
+ }
1772
+ return next(request);
1773
+ });
1774
+ }
1775
+ };
1776
+ this.pipeline.addPolicy(apiVersionPolicy);
1664
1777
  }
1665
1778
  }
1666
1779
 
1667
1780
  exports.Portal = Portal;
1781
+ exports.getContinuationToken = getContinuationToken;
1668
1782
  //# sourceMappingURL=index.js.map