@azure/arm-portal 1.0.0-alpha.20220421.1 → 1.0.0-alpha.20220908.1

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 (72) hide show
  1. package/CHANGELOG.md +21 -7
  2. package/LICENSE +1 -1
  3. package/README.md +18 -7
  4. package/dist/index.js +51 -3
  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.d.ts +2 -0
  9. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js +46 -0
  11. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/dashboardsDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/dashboardsDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/dashboardsDeleteSample.js +31 -0
  15. package/dist-esm/samples-dev/dashboardsDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/dashboardsGetSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/dashboardsGetSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/dashboardsGetSample.js +31 -0
  19. package/dist-esm/samples-dev/dashboardsGetSample.js.map +1 -0
  20. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js +44 -0
  23. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js.map +1 -0
  24. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js +43 -0
  27. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js.map +1 -0
  28. package/dist-esm/samples-dev/dashboardsUpdateSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/dashboardsUpdateSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/dashboardsUpdateSample.js +34 -0
  31. package/dist-esm/samples-dev/dashboardsUpdateSample.js.map +1 -0
  32. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js +43 -0
  35. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js.map +1 -0
  36. package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
  37. package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
  38. package/dist-esm/samples-dev/operationsListSample.js +43 -0
  39. package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
  40. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.d.ts +2 -0
  41. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.d.ts.map +1 -0
  42. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js +33 -0
  43. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js.map +1 -0
  44. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.d.ts +2 -0
  45. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.d.ts.map +1 -0
  46. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js +30 -0
  47. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js.map +1 -0
  48. package/dist-esm/samples-dev/tenantConfigurationsGetSample.d.ts +2 -0
  49. package/dist-esm/samples-dev/tenantConfigurationsGetSample.d.ts.map +1 -0
  50. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js +30 -0
  51. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js.map +1 -0
  52. package/dist-esm/samples-dev/tenantConfigurationsListSample.d.ts +2 -0
  53. package/dist-esm/samples-dev/tenantConfigurationsListSample.d.ts.map +1 -0
  54. package/dist-esm/samples-dev/tenantConfigurationsListSample.js +43 -0
  55. package/dist-esm/samples-dev/tenantConfigurationsListSample.js.map +1 -0
  56. package/dist-esm/src/models/index.d.ts +7 -5
  57. package/dist-esm/src/models/index.d.ts.map +1 -1
  58. package/dist-esm/src/models/index.js +1 -0
  59. package/dist-esm/src/models/index.js.map +1 -1
  60. package/dist-esm/src/portal.d.ts +2 -0
  61. package/dist-esm/src/portal.d.ts.map +1 -1
  62. package/dist-esm/src/portal.js +49 -2
  63. package/dist-esm/src/portal.js.map +1 -1
  64. package/dist-esm/test/sampleTest.js +11 -13
  65. package/dist-esm/test/sampleTest.js.map +1 -1
  66. package/package.json +33 -14
  67. package/review/arm-portal.api.md +7 -7
  68. package/rollup.config.js +6 -72
  69. package/src/models/index.ts +6 -5
  70. package/src/portal.ts +61 -2
  71. package/tsconfig.json +19 -5
  72. package/types/arm-portal.d.ts +9 -5
package/CHANGELOG.md CHANGED
@@ -1,16 +1,30 @@
1
- ## Release History
1
+ # Release History
2
2
 
3
- ### 1.0.0-beta.3 (Unreleased)
3
+ ## 1.0.0-beta.5 (Unreleased)
4
4
 
5
- #### Features Added
5
+ ### Features Added
6
6
 
7
- #### Breaking Changes
7
+ ### Breaking Changes
8
8
 
9
- #### Bugs Fixed
9
+ ### Bugs Fixed
10
10
 
11
- #### Other Changes
11
+ ### Other Changes
12
12
 
13
- ### 1.0.0-beta.2 (2021-11-30)
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)
22
+
23
+ **Features**
24
+
25
+ - Bug fix
26
+
27
+ ## 1.0.0-beta.2 (2021-11-30)
14
28
 
15
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.
16
30
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Microsoft
3
+ Copyright (c) 2022 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
 
@@ -16,13 +16,15 @@ Allows creation and deletion of Azure Shared Dashboards.
16
16
  - [LTS versions of Node.js](https://nodejs.org/about/releases/)
17
17
  - Latest versions of Safari, Chrome, Edge and Firefox.
18
18
 
19
+ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
20
+
19
21
  ### Prerequisites
20
22
 
21
23
  - An [Azure subscription][azure_sub].
22
24
 
23
25
  ### Install the `@azure/arm-portal` package
24
26
 
25
- Install the Azure Service client library for JavaScript with `npm`:
27
+ Install the Azure Portal client library for JavaScript with `npm`:
26
28
 
27
29
  ```bash
28
30
  npm install @azure/arm-portal
@@ -30,8 +32,8 @@ npm install @azure/arm-portal
30
32
 
31
33
  ### Create and authenticate a `Portal`
32
34
 
33
- 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.
34
- 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].
35
37
 
36
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).
37
39
 
@@ -41,7 +43,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below
41
43
  npm install @azure/identity
42
44
  ```
43
45
 
44
- 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).
45
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`.
46
48
 
47
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).
@@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this
49
51
  ```javascript
50
52
  const { Portal } = require("@azure/arm-portal");
51
53
  const { DefaultAzureCredential } = require("@azure/identity");
54
+ // For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
55
+
52
56
  const subscriptionId = "00000000-0000-0000-0000-000000000000";
53
57
  const client = new Portal(new DefaultAzureCredential(), subscriptionId);
58
+
59
+ // For client-side applications running in the browser, use this code instead:
60
+ // const credential = new InteractiveBrowserCredential({
61
+ // tenantId: "<YOUR_TENANT_ID>",
62
+ // clientId: "<YOUR_CLIENT_ID>"
63
+ // });
64
+ // const client = new Portal(credential, subscriptionId);
54
65
  ```
55
66
 
56
67
 
@@ -61,7 +72,7 @@ To use this client library in the browser, first you need to use a bundler. For
61
72
 
62
73
  ### Portal
63
74
 
64
- `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.
65
76
 
66
77
  ## Troubleshooting
67
78
 
package/dist/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var coreClient = require('@azure/core-client');
6
5
  var tslib = require('tslib');
6
+ var coreClient = require('@azure/core-client');
7
+ var coreRestPipeline = require('@azure/core-rest-pipeline');
7
8
 
8
9
  function _interopNamespace(e) {
9
10
  if (e && e.__esModule) return e;
@@ -24,6 +25,7 @@ function _interopNamespace(e) {
24
25
  }
25
26
 
26
27
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
28
+ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
27
29
 
28
30
  /*
29
31
  * Copyright (c) Microsoft Corporation.
@@ -35,6 +37,7 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
35
37
  /** Known values of {@link ConfigurationName} that the service accepts. */
36
38
  exports.KnownConfigurationName = void 0;
37
39
  (function (KnownConfigurationName) {
40
+ /** Default */
38
41
  KnownConfigurationName["Default"] = "default";
39
42
  })(exports.KnownConfigurationName || (exports.KnownConfigurationName = {}));
40
43
 
@@ -1608,6 +1611,7 @@ class Portal extends coreClient__namespace.ServiceClient {
1608
1611
  * @param options The parameter options
1609
1612
  */
1610
1613
  constructor(credentials, subscriptionId, options) {
1614
+ var _a, _b;
1611
1615
  if (credentials === undefined) {
1612
1616
  throw new Error("'credentials' cannot be null");
1613
1617
  }
@@ -1622,7 +1626,7 @@ class Portal extends coreClient__namespace.ServiceClient {
1622
1626
  requestContentType: "application/json; charset=utf-8",
1623
1627
  credential: credentials
1624
1628
  };
1625
- const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.2`;
1629
+ const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.5`;
1626
1630
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1627
1631
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1628
1632
  : `${packageDetails}`;
@@ -1631,8 +1635,24 @@ class Portal extends coreClient__namespace.ServiceClient {
1631
1635
  }
1632
1636
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1633
1637
  userAgentPrefix
1634
- }, baseUri: options.endpoint || "https://management.azure.com" });
1638
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1635
1639
  super(optionsWithDefaults);
1640
+ if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1641
+ const pipelinePolicies = options.pipeline.getOrderedPolicies();
1642
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1643
+ coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1644
+ if (!bearerTokenAuthenticationPolicyFound) {
1645
+ this.pipeline.removePolicy({
1646
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1647
+ });
1648
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1649
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
1650
+ challengeCallbacks: {
1651
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1652
+ }
1653
+ }));
1654
+ }
1655
+ }
1636
1656
  // Parameter assignments
1637
1657
  this.subscriptionId = subscriptionId;
1638
1658
  // Assigning values to Constant parameters
@@ -1642,6 +1662,34 @@ class Portal extends coreClient__namespace.ServiceClient {
1642
1662
  this.dashboards = new DashboardsImpl(this);
1643
1663
  this.tenantConfigurations = new TenantConfigurationsImpl(this);
1644
1664
  this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsImpl(this);
1665
+ this.addCustomApiVersionPolicy(options.apiVersion);
1666
+ }
1667
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1668
+ addCustomApiVersionPolicy(apiVersion) {
1669
+ if (!apiVersion) {
1670
+ return;
1671
+ }
1672
+ const apiVersionPolicy = {
1673
+ name: "CustomApiVersionPolicy",
1674
+ sendRequest(request, next) {
1675
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1676
+ const param = request.url.split("?");
1677
+ if (param.length > 1) {
1678
+ const newParams = param[1].split("&").map((item) => {
1679
+ if (item.indexOf("api-version") > -1) {
1680
+ return "api-version=" + apiVersion;
1681
+ }
1682
+ else {
1683
+ return item;
1684
+ }
1685
+ });
1686
+ request.url = param[0] + "?" + newParams.join("&");
1687
+ }
1688
+ return next(request);
1689
+ });
1690
+ }
1691
+ };
1692
+ this.pipeline.addPolicy(apiVersionPolicy);
1645
1693
  }
1646
1694
  }
1647
1695