@azure/arm-subscriptions 3.1.2 → 4.0.0

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 (184) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/{LICENSE.txt → LICENSE} +2 -2
  3. package/README.md +68 -79
  4. package/dist/index.js +1772 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/src/index.d.ts +5 -0
  9. package/dist-esm/src/index.d.ts.map +1 -0
  10. package/dist-esm/src/index.js +12 -0
  11. package/dist-esm/src/index.js.map +1 -0
  12. package/dist-esm/src/lroImpl.d.ts +16 -0
  13. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  14. package/dist-esm/src/lroImpl.js +29 -0
  15. package/dist-esm/src/lroImpl.js.map +1 -0
  16. package/dist-esm/src/models/index.d.ts +514 -0
  17. package/dist-esm/src/models/index.d.ts.map +1 -0
  18. package/dist-esm/src/models/index.js +36 -0
  19. package/dist-esm/src/models/index.js.map +1 -0
  20. package/dist-esm/src/models/mappers.d.ts +29 -0
  21. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  22. package/dist-esm/src/models/mappers.js +825 -0
  23. package/dist-esm/src/models/mappers.js.map +1 -0
  24. package/dist-esm/src/models/parameters.d.ts +14 -0
  25. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  26. package/dist-esm/src/models/parameters.js +110 -0
  27. package/dist-esm/src/models/parameters.js.map +1 -0
  28. package/dist-esm/src/operations/alias.d.ts +53 -0
  29. package/dist-esm/src/operations/alias.d.ts.map +1 -0
  30. package/dist-esm/src/operations/alias.js +180 -0
  31. package/dist-esm/src/operations/alias.js.map +1 -0
  32. package/dist-esm/src/operations/billingAccount.d.ts +19 -0
  33. package/dist-esm/src/operations/billingAccount.d.ts.map +1 -0
  34. package/dist-esm/src/operations/billingAccount.js +47 -0
  35. package/dist-esm/src/operations/billingAccount.js.map +1 -0
  36. package/dist-esm/src/operations/index.d.ts +6 -0
  37. package/dist-esm/src/operations/index.d.ts.map +1 -0
  38. package/dist-esm/src/operations/index.js +13 -0
  39. package/dist-esm/src/operations/index.js.map +1 -0
  40. package/dist-esm/src/operations/operations.d.ts +32 -0
  41. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  42. package/dist-esm/src/operations/operations.js +120 -0
  43. package/dist-esm/src/operations/operations.js.map +1 -0
  44. package/dist-esm/src/operations/subscription.d.ts +53 -0
  45. package/dist-esm/src/operations/subscription.d.ts.map +1 -0
  46. package/dist-esm/src/operations/subscription.js +201 -0
  47. package/dist-esm/src/operations/subscription.js.map +1 -0
  48. package/dist-esm/src/operations/subscriptionPolicy.d.ts +43 -0
  49. package/dist-esm/src/operations/subscriptionPolicy.d.ts.map +1 -0
  50. package/dist-esm/src/operations/subscriptionPolicy.js +169 -0
  51. package/dist-esm/src/operations/subscriptionPolicy.js.map +1 -0
  52. package/dist-esm/src/operationsInterfaces/alias.d.ts +45 -0
  53. package/dist-esm/src/operationsInterfaces/alias.d.ts.map +1 -0
  54. package/dist-esm/src/operationsInterfaces/alias.js +9 -0
  55. package/dist-esm/src/operationsInterfaces/alias.js.map +1 -0
  56. package/dist-esm/src/operationsInterfaces/billingAccount.d.ts +11 -0
  57. package/dist-esm/src/operationsInterfaces/billingAccount.d.ts.map +1 -0
  58. package/dist-esm/src/operationsInterfaces/billingAccount.js +9 -0
  59. package/dist-esm/src/operationsInterfaces/billingAccount.js.map +1 -0
  60. package/dist-esm/src/operationsInterfaces/index.d.ts +6 -0
  61. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  62. package/dist-esm/src/operationsInterfaces/index.js +13 -0
  63. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  64. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  65. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  66. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  67. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  68. package/dist-esm/src/operationsInterfaces/subscription.d.ts +45 -0
  69. package/dist-esm/src/operationsInterfaces/subscription.d.ts.map +1 -0
  70. package/dist-esm/src/operationsInterfaces/subscription.js +9 -0
  71. package/dist-esm/src/operationsInterfaces/subscription.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts +22 -0
  73. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts.map +1 -0
  74. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js +9 -0
  75. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js.map +1 -0
  76. package/dist-esm/src/subscriptionClient.d.ts +20 -0
  77. package/dist-esm/src/subscriptionClient.d.ts.map +1 -0
  78. package/dist-esm/src/subscriptionClient.js +49 -0
  79. package/dist-esm/src/subscriptionClient.js.map +1 -0
  80. package/dist-esm/test/sampleTest.d.ts +2 -0
  81. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  82. package/dist-esm/test/sampleTest.js +40 -0
  83. package/dist-esm/test/sampleTest.js.map +1 -0
  84. package/package.json +65 -32
  85. package/review/arm-subscriptions.api.md +446 -0
  86. package/rollup.config.js +181 -30
  87. package/src/index.ts +12 -0
  88. package/src/lroImpl.ts +34 -0
  89. package/src/models/index.ts +449 -555
  90. package/src/models/mappers.ts +506 -250
  91. package/src/models/parameters.ts +82 -27
  92. package/src/operations/alias.ts +170 -170
  93. package/src/operations/billingAccount.ts +65 -0
  94. package/src/operations/index.ts +6 -8
  95. package/src/operations/operations.ts +103 -40
  96. package/src/operations/subscription.ts +289 -0
  97. package/src/operations/subscriptionPolicy.ts +207 -0
  98. package/src/operationsInterfaces/alias.ts +75 -0
  99. package/src/operationsInterfaces/billingAccount.ts +25 -0
  100. package/src/operationsInterfaces/index.ts +13 -0
  101. package/src/operationsInterfaces/operations.ts +22 -0
  102. package/src/operationsInterfaces/subscription.ts +92 -0
  103. package/src/operationsInterfaces/subscriptionPolicy.ts +46 -0
  104. package/src/subscriptionClient.ts +75 -43
  105. package/tsconfig.json +3 -3
  106. package/types/arm-subscriptions.d.ts +727 -0
  107. package/types/tsdoc-metadata.json +11 -0
  108. package/dist/arm-subscriptions.js +0 -1442
  109. package/dist/arm-subscriptions.js.map +0 -1
  110. package/dist/arm-subscriptions.min.js +0 -1
  111. package/dist/arm-subscriptions.min.js.map +0 -1
  112. package/esm/models/aliasMappers.d.ts +0 -2
  113. package/esm/models/aliasMappers.d.ts.map +0 -1
  114. package/esm/models/aliasMappers.js +0 -9
  115. package/esm/models/aliasMappers.js.map +0 -1
  116. package/esm/models/index.d.ts +0 -624
  117. package/esm/models/index.d.ts.map +0 -1
  118. package/esm/models/index.js +0 -8
  119. package/esm/models/index.js.map +0 -1
  120. package/esm/models/mappers.d.ts +0 -25
  121. package/esm/models/mappers.d.ts.map +0 -1
  122. package/esm/models/mappers.js +0 -574
  123. package/esm/models/mappers.js.map +0 -1
  124. package/esm/models/operationsMappers.d.ts +0 -2
  125. package/esm/models/operationsMappers.d.ts.map +0 -1
  126. package/esm/models/operationsMappers.js +0 -9
  127. package/esm/models/operationsMappers.js.map +0 -1
  128. package/esm/models/parameters.d.ts +0 -8
  129. package/esm/models/parameters.d.ts.map +0 -1
  130. package/esm/models/parameters.js +0 -75
  131. package/esm/models/parameters.js.map +0 -1
  132. package/esm/models/subscriptionOperationsMappers.d.ts +0 -2
  133. package/esm/models/subscriptionOperationsMappers.d.ts.map +0 -1
  134. package/esm/models/subscriptionOperationsMappers.js +0 -9
  135. package/esm/models/subscriptionOperationsMappers.js.map +0 -1
  136. package/esm/models/subscriptionsMappers.d.ts +0 -2
  137. package/esm/models/subscriptionsMappers.d.ts.map +0 -1
  138. package/esm/models/subscriptionsMappers.js +0 -9
  139. package/esm/models/subscriptionsMappers.js.map +0 -1
  140. package/esm/models/tenantsMappers.d.ts +0 -2
  141. package/esm/models/tenantsMappers.d.ts.map +0 -1
  142. package/esm/models/tenantsMappers.js +0 -9
  143. package/esm/models/tenantsMappers.js.map +0 -1
  144. package/esm/operations/alias.d.ts +0 -81
  145. package/esm/operations/alias.d.ts.map +0 -1
  146. package/esm/operations/alias.js +0 -161
  147. package/esm/operations/alias.js.map +0 -1
  148. package/esm/operations/index.d.ts +0 -6
  149. package/esm/operations/index.d.ts.map +0 -1
  150. package/esm/operations/index.js +0 -15
  151. package/esm/operations/index.js.map +0 -1
  152. package/esm/operations/operations.d.ts +0 -28
  153. package/esm/operations/operations.d.ts.map +0 -1
  154. package/esm/operations/operations.js +0 -51
  155. package/esm/operations/operations.js.map +0 -1
  156. package/esm/operations/subscriptionOperations.d.ts +0 -70
  157. package/esm/operations/subscriptionOperations.d.ts.map +0 -1
  158. package/esm/operations/subscriptionOperations.js +0 -117
  159. package/esm/operations/subscriptionOperations.js.map +0 -1
  160. package/esm/operations/subscriptions.d.ts +0 -84
  161. package/esm/operations/subscriptions.d.ts.map +0 -1
  162. package/esm/operations/subscriptions.js +0 -133
  163. package/esm/operations/subscriptions.js.map +0 -1
  164. package/esm/operations/tenants.d.ts +0 -46
  165. package/esm/operations/tenants.d.ts.map +0 -1
  166. package/esm/operations/tenants.js +0 -77
  167. package/esm/operations/tenants.js.map +0 -1
  168. package/esm/subscriptionClient.d.ts +0 -27
  169. package/esm/subscriptionClient.d.ts.map +0 -1
  170. package/esm/subscriptionClient.js +0 -41
  171. package/esm/subscriptionClient.js.map +0 -1
  172. package/esm/subscriptionClientContext.d.ts +0 -19
  173. package/esm/subscriptionClientContext.d.ts.map +0 -1
  174. package/esm/subscriptionClientContext.js +0 -55
  175. package/esm/subscriptionClientContext.js.map +0 -1
  176. package/src/models/aliasMappers.ts +0 -18
  177. package/src/models/operationsMappers.ts +0 -14
  178. package/src/models/subscriptionOperationsMappers.ts +0 -15
  179. package/src/models/subscriptionsMappers.ts +0 -16
  180. package/src/models/tenantsMappers.ts +0 -13
  181. package/src/operations/subscriptionOperations.ts +0 -194
  182. package/src/operations/subscriptions.ts +0 -227
  183. package/src/operations/tenants.ts +0 -123
  184. package/src/subscriptionClientContext.ts +0 -60
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Release History
2
+
3
+ ## 4.0.0 (2021-12-22)
4
+
5
+ The package of @azure/arm-subscriptions is using our next generation design principles since version 4.0.0, which contains breaking changes.
6
+
7
+ To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog).
8
+
9
+ To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide).
10
+
11
+ To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Microsoft
3
+ Copyright (c) 2021 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
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,108 +1,97 @@
1
- ## Azure SubscriptionClient SDK for JavaScript
1
+ # Azure Subscription client library for JavaScript
2
2
 
3
- This package contains an isomorphic SDK (runs both in Node.js and in browsers) for SubscriptionClient.
3
+ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Subscription client.
4
+
5
+ The subscription client
6
+
7
+ [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/subscription/arm-subscriptions) |
8
+ [Package (NPM)](https://www.npmjs.com/package/@azure/arm-subscriptions) |
9
+ [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-subscriptions) |
10
+ [Samples](https://github.com/Azure-Samples/azure-samples-js-management)
11
+
12
+ ## Getting started
4
13
 
5
14
  ### Currently supported environments
6
15
 
7
16
  - [LTS versions of Node.js](https://nodejs.org/about/releases/)
8
- - Latest versions of Safari, Chrome, Edge, and Firefox.
17
+ - Latest versions of Safari, Chrome, Edge and Firefox.
9
18
 
10
19
  ### Prerequisites
11
20
 
12
- You must have an [Azure subscription](https://azure.microsoft.com/free/).
21
+ - An [Azure subscription][azure_sub].
13
22
 
14
- ### How to install
23
+ ### Install the `@azure/arm-subscriptions` package
15
24
 
16
- To use this SDK in your project, you will need to install two packages.
17
- - `@azure/arm-subscriptions` that contains the client.
18
- - `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
25
+ Install the Azure Subscription client library for JavaScript with `npm`:
19
26
 
20
- Install both packages using the below command:
21
27
  ```bash
22
- npm install --save @azure/arm-subscriptions @azure/identity
28
+ npm install @azure/arm-subscriptions
23
29
  ```
24
30
 
25
- > **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
26
- If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
31
+ ### Create and authenticate a `SubscriptionClient`
27
32
 
28
- ### How to use
33
+ To create a client object to access the Azure Subscription API, you will need the `endpoint` of your Azure Subscription resource and a `credential`. The Azure Subscription client can use Azure Active Directory credentials to authenticate.
34
+ You can find the endpoint for your Azure Subscription resource in the [Azure Portal][azure_portal].
29
35
 
30
- - If you are writing a client side browser application,
31
- - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
32
- - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
33
- - If you are writing a server side application,
34
- - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
35
- - Complete the set up steps required by the credential if any.
36
- - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
36
+ 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
37
 
38
- In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
39
- Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
38
+ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
39
+
40
+ ```bash
41
+ npm install @azure/identity
42
+ ```
40
43
 
41
- #### nodejs - Authentication, client creation, and listLocations subscriptions as an example written in JavaScript.
44
+ You will also need to **register a new AAD application and grant access to Azure Subscription** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
45
+ 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`.
42
46
 
43
- ##### Sample code
47
+ 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).
44
48
 
45
49
  ```javascript
46
- const { DefaultAzureCredential } = require("@azure/identity");
47
50
  const { SubscriptionClient } = require("@azure/arm-subscriptions");
48
- const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
49
-
50
- // Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
51
- // Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
52
- const creds = new DefaultAzureCredential();
53
- const client = new SubscriptionClient(creds);
54
- client.subscriptions.listLocations(subscriptionId).then((result) => {
55
- console.log("The result is:");
56
- console.log(result);
57
- }).catch((err) => {
58
- console.log("An error occurred:");
59
- console.error(err);
60
- });
51
+ const { DefaultAzureCredential } = require("@azure/identity");
52
+ const client = new SubscriptionClient(new DefaultAzureCredential());
61
53
  ```
62
54
 
63
- #### browser - Authentication, client creation, and listLocations subscriptions as an example written in JavaScript.
64
-
65
- In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
66
- - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
67
- - Note down the client Id from the previous step and use it in the browser sample below.
68
-
69
- ##### Sample code
70
-
71
- - index.html
72
-
73
- ```html
74
- <!DOCTYPE html>
75
- <html lang="en">
76
- <head>
77
- <title>@azure/arm-subscriptions sample</title>
78
- <script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
79
- <script src="node_modules/@azure/identity/dist/index.js"></script>
80
- <script src="node_modules/@azure/arm-subscriptions/dist/arm-subscriptions.js"></script>
81
- <script type="text/javascript">
82
- const subscriptionId = "<Subscription_Id>";
83
- // Create credentials using the `@azure/identity` package.
84
- // Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
85
- const credential = new InteractiveBrowserCredential(
86
- {
87
- clientId: "<client id for your Azure AD app>",
88
- tenantId: "<optional tenant for your organization>"
89
- });
90
- const client = new Azure.ArmSubscriptions.SubscriptionClient(creds);
91
- client.subscriptions.listLocations(subscriptionId).then((result) => {
92
- console.log("The result is:");
93
- console.log(result);
94
- }).catch((err) => {
95
- console.log("An error occurred:");
96
- console.error(err);
97
- });
98
- </script>
99
- </head>
100
- <body></body>
101
- </html>
55
+
56
+ ### JavaScript Bundle
57
+ To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
58
+
59
+ ## Key concepts
60
+
61
+ ### SubscriptionClient
62
+
63
+ `SubscriptionClient` is the primary interface for developers using the Azure Subscription client library. Explore the methods on this client object to understand the different features of the Azure Subscription service that you can access.
64
+
65
+ ## Troubleshooting
66
+
67
+ ### Logging
68
+
69
+ Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
70
+
71
+ ```javascript
72
+ const { setLogLevel } = require("@azure/logger");
73
+ setLogLevel("info");
102
74
  ```
103
75
 
76
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
77
+
78
+ ## Next steps
79
+
80
+ Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
81
+
82
+ ## Contributing
83
+
84
+ If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
85
+
104
86
  ## Related projects
105
87
 
106
- - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
88
+ - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
89
+
90
+ ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fsubscription%2Farm-subscriptions%2FREADME.png)
107
91
 
108
- ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/subscription/arm-subscriptions/README.png)
92
+ [azure_cli]: https://docs.microsoft.com/cli/azure
93
+ [azure_sub]: https://azure.microsoft.com/free/
94
+ [azure_sub]: https://azure.microsoft.com/free/
95
+ [azure_portal]: https://portal.azure.com
96
+ [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
97
+ [defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential