@azure-rest/arm-network 1.0.0-beta.2 → 1.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +29 -30
  3. package/dist/browser/isUnexpected.js +4 -5
  4. package/dist/browser/isUnexpected.js.map +1 -1
  5. package/dist/browser/networkManagementClient.js +12 -8
  6. package/dist/browser/networkManagementClient.js.map +1 -1
  7. package/dist/browser/paginateHelper.js +43 -73
  8. package/dist/browser/paginateHelper.js.map +1 -1
  9. package/dist/browser/pollingHelper.js +11 -8
  10. package/dist/browser/pollingHelper.js.map +1 -1
  11. package/dist/commonjs/isUnexpected.js +4 -5
  12. package/dist/commonjs/isUnexpected.js.map +1 -1
  13. package/dist/commonjs/networkManagementClient.js +12 -8
  14. package/dist/commonjs/networkManagementClient.js.map +1 -1
  15. package/dist/commonjs/paginateHelper.js +43 -73
  16. package/dist/commonjs/paginateHelper.js.map +1 -1
  17. package/dist/commonjs/pollingHelper.js +11 -8
  18. package/dist/commonjs/pollingHelper.js.map +1 -1
  19. package/dist/commonjs/tsdoc-metadata.json +11 -11
  20. package/dist/esm/isUnexpected.js +4 -5
  21. package/dist/esm/isUnexpected.js.map +1 -1
  22. package/dist/esm/networkManagementClient.js +12 -8
  23. package/dist/esm/networkManagementClient.js.map +1 -1
  24. package/dist/esm/paginateHelper.js +43 -73
  25. package/dist/esm/paginateHelper.js.map +1 -1
  26. package/dist/esm/pollingHelper.js +11 -8
  27. package/dist/esm/pollingHelper.js.map +1 -1
  28. package/dist/react-native/isUnexpected.js +4 -5
  29. package/dist/react-native/isUnexpected.js.map +1 -1
  30. package/dist/react-native/networkManagementClient.js +12 -8
  31. package/dist/react-native/networkManagementClient.js.map +1 -1
  32. package/dist/react-native/paginateHelper.js +43 -73
  33. package/dist/react-native/paginateHelper.js.map +1 -1
  34. package/dist/react-native/pollingHelper.js +11 -8
  35. package/dist/react-native/pollingHelper.js.map +1 -1
  36. package/package.json +40 -49
  37. /package/review/{arm-network.api.md → arm-network-node.api.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ## 1.0.0-beta.3 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
3
13
  ## 1.0.0-beta.2 (2025-02-10)
4
14
 
5
15
  ### Features Added
package/README.md CHANGED
@@ -46,9 +46,10 @@ AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
46
46
 
47
47
  Use the returned token credential to authenticate the client:
48
48
 
49
- ```typescript
50
- import NetworkManagementClient from "@azure-rest/arm-network";
49
+ ```ts snippet:ReadmeSampleCreateClient_Node
51
50
  import { DefaultAzureCredential } from "@azure/identity";
51
+ import NetworkManagementClient from "@azure-rest/arm-network";
52
+
52
53
  const credential = new DefaultAzureCredential();
53
54
  const client = NetworkManagementClient(credential);
54
55
  ```
@@ -59,38 +60,36 @@ The following section shows you how to initialize and authenticate your client,
59
60
 
60
61
  ### List virtual networks within a resource group
61
62
 
62
- ```typescript
63
- import createNetworkManagementClient, {
63
+ ```ts snippet:ReadmeSampleListVirtualNetworks
64
+ import { DefaultAzureCredential } from "@azure/identity";
65
+ import NetworkManagementClient, {
64
66
  VirtualNetworksListParameters,
65
67
  paginate,
66
68
  } from "@azure-rest/arm-network";
67
- import { DefaultAzureCredential } from "@azure/identity";
68
- import * as dotenv from "dotenv";
69
- dotenv.config();
70
- async function listVirtualNetworksInResourceGroup() {
71
- const credential = new DefaultAzureCredential();
72
- const client = createNetworkManagementClient(credential);
73
- const subscriptionId = "";
74
- const resourceGroupName = "rg1";
75
- const options: VirtualNetworksListParameters = {
76
- queryParameters: { "api-version": "2022-05-01" },
77
- };
78
- const initialResponse = await client
79
- .path(
80
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks",
81
- subscriptionId,
82
- resourceGroupName,
83
- )
84
- .get(options);
85
- const pageData = paginate(client, initialResponse);
86
- const result = [];
87
- for await (const item of pageData) {
88
- result.push(item);
69
+
70
+ const credential = new DefaultAzureCredential();
71
+ const client = NetworkManagementClient(credential);
72
+
73
+ const subscriptionId = "";
74
+ const resourceGroupName = "rg1";
75
+ const options: VirtualNetworksListParameters = {
76
+ queryParameters: { "api-version": "2022-05-01" },
77
+ };
78
+
79
+ const initialResponse = await client
80
+ .path(
81
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks",
82
+ subscriptionId,
83
+ resourceGroupName,
84
+ )
85
+ .get(options);
86
+
87
+ const pageData = paginate(client, initialResponse);
88
+ for await (const page of pageData.byPage()) {
89
+ for await (const item of page) {
90
+ console.log(`Virtual Network: ${item}`);
89
91
  }
90
- console.log(result);
91
92
  }
92
-
93
- listVirtualNetworksInResourceGroup().catch(console.error);
94
93
  ```
95
94
 
96
95
  ## Troubleshooting
@@ -99,7 +98,7 @@ listVirtualNetworksInResourceGroup().catch(console.error);
99
98
 
100
99
  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`:
101
100
 
102
- ```javascript
101
+ ```ts snippet:SetLogLevel
103
102
  import { setLogLevel } from "@azure/logger";
104
103
 
105
104
  setLogLevel("info");
@@ -724,7 +724,7 @@ const responseMap = {
724
724
  };
725
725
  export function isUnexpected(response) {
726
726
  const lroOriginal = response.headers["x-ms-original-url"];
727
- const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
727
+ const url = new URL(lroOriginal ?? response.request.url);
728
728
  const method = response.request.method;
729
729
  let pathDetails = responseMap[`${method} ${url.pathname}`];
730
730
  if (!pathDetails) {
@@ -733,7 +733,6 @@ export function isUnexpected(response) {
733
733
  return !pathDetails.includes(response.status);
734
734
  }
735
735
  function getParametrizedPathSuccess(method, path) {
736
- var _a, _b, _c, _d;
737
736
  const pathParts = path.split("/");
738
737
  // Traverse list to match the longest candidate
739
738
  // matchedLen: the length of candidate path
@@ -752,13 +751,13 @@ function getParametrizedPathSuccess(method, path) {
752
751
  // track if we have found a match to return the values found.
753
752
  let found = true;
754
753
  for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
755
- if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
756
- const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
754
+ if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
755
+ const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
757
756
  // If the current part of the candidate is a "template" part
758
757
  // Try to use the suffix of pattern to match the path
759
758
  // {guid} ==> $
760
759
  // {guid}:export ==> :export$
761
- const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
760
+ const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
762
761
  if (!isMatched) {
763
762
  found = false;
764
763
  break;