@azure-tools/communication-tiering 1.0.0-alpha.20250122.7 → 1.0.0-alpha.20250130.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.
- package/README.md +42 -32
- package/package.json +17 -20
package/README.md
CHANGED
|
@@ -35,8 +35,9 @@ Once you have a key, you can authenticate the `TieringClient` with any of the fo
|
|
|
35
35
|
|
|
36
36
|
### Using a connection string
|
|
37
37
|
|
|
38
|
-
```
|
|
39
|
-
|
|
38
|
+
```ts snippet:ReadmeSampleCreateClient_ConnectionString
|
|
39
|
+
import { TieringClient } from "@azure-tools/communication-tiering";
|
|
40
|
+
|
|
40
41
|
const connectionString = "endpoint=<endpoint>;accessKey=<accessKey>";
|
|
41
42
|
const client = new TieringClient(connectionString);
|
|
42
43
|
```
|
|
@@ -45,9 +46,10 @@ const client = new TieringClient(connectionString);
|
|
|
45
46
|
|
|
46
47
|
If you use a key to initialize the client you will also need to provide the appropriate endpoint. You can get this endpoint from your Communication Services resource in [Azure Portal][azure_portal]. Once you have a key and endpoint, you can authenticate with the following code:
|
|
47
48
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
```ts snippet:ReadmeSampleCreateClient_KeyCredential
|
|
50
|
+
import { AzureKeyCredential } from "@azure/core-auth";
|
|
51
|
+
import { TieringClient } from "@azure-tools/communication-tiering";
|
|
52
|
+
|
|
51
53
|
const credential = new AzureKeyCredential("<key-from-resource>");
|
|
52
54
|
const client = new TieringClient("<endpoint-from-resource>", credential);
|
|
53
55
|
```
|
|
@@ -62,9 +64,9 @@ npm install @azure/identity
|
|
|
62
64
|
|
|
63
65
|
The [`@azure/identity`][azure_identity] package provides a variety of credential types that your application can use to do this. The [README for `@azure/identity`][azure_identity_readme] provides more details and samples to get you started.
|
|
64
66
|
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
```ts snippet:ReadmeSampleCreateClient_TokenCredential
|
|
68
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
69
|
+
import { TieringClient } from "@azure-tools/communication-tiering";
|
|
68
70
|
|
|
69
71
|
const credential = new DefaultAzureCredential();
|
|
70
72
|
const client = new TieringClient("<endpoint-from-resource>", credential);
|
|
@@ -79,46 +81,54 @@ The following sections provide code snippets that cover some of the common tasks
|
|
|
79
81
|
|
|
80
82
|
### Get acquired number limits
|
|
81
83
|
|
|
82
|
-
```
|
|
83
|
-
import {
|
|
84
|
-
|
|
85
|
-
const client = new Tiering(connectionString);
|
|
84
|
+
```ts snippet:SampleReadmeGetAcquiredNumberLimits
|
|
85
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
86
|
+
import { TieringClient } from "@azure-tools/communication-tiering";
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
const credential = new DefaultAzureCredential();
|
|
89
|
+
const client = new TieringClient("<endpoint-from-resource>", credential);
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
const acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId);
|
|
91
|
+
const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b";
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
93
|
+
// Get acquired numbers and limits for a resource
|
|
94
|
+
const acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId);
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
// print all number limits
|
|
97
|
+
console.log(acquiredNumberLimits);
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### Get tier info
|
|
101
101
|
|
|
102
|
-
```
|
|
103
|
-
import {
|
|
104
|
-
|
|
105
|
-
const client = new Tiering(connectionString);
|
|
102
|
+
```ts snippet:ReadmeSampleGetTierInfo
|
|
103
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
104
|
+
import { TieringClient } from "@azure-tools/communication-tiering";
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const credential = new DefaultAzureCredential();
|
|
107
|
+
const client = new TieringClient("<endpoint-from-resource>", credential);
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
const tierInfo = await client.getTierByResourceId(resourceId);
|
|
109
|
+
const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b";
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
111
|
+
// Get tier info for a resource
|
|
112
|
+
const tierInfo = await client.getTierByResourceId(resourceId);
|
|
116
113
|
|
|
117
|
-
|
|
114
|
+
// print all tier info
|
|
115
|
+
console.log(tierInfo);
|
|
118
116
|
```
|
|
119
117
|
|
|
120
118
|
## Troubleshooting
|
|
121
119
|
|
|
120
|
+
### Logging
|
|
121
|
+
|
|
122
|
+
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`:
|
|
123
|
+
|
|
124
|
+
```ts snippet:SetLogLevel
|
|
125
|
+
import { setLogLevel } from "@azure/logger";
|
|
126
|
+
|
|
127
|
+
setLogLevel("info");
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
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).
|
|
131
|
+
|
|
122
132
|
## Next steps
|
|
123
133
|
|
|
124
134
|
Please take a look at the samples directory for detailed examples on how to use this library.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/communication-tiering",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20250130.1",
|
|
4
4
|
"description": "Test",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
33
33
|
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
34
34
|
"unit-test:node": "dev-tool run test:vitest",
|
|
35
|
-
"update-snippets": "
|
|
35
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist/",
|
|
@@ -57,18 +57,17 @@
|
|
|
57
57
|
"sideEffects": false,
|
|
58
58
|
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@azure/abort-controller": "^2.
|
|
61
|
-
"@azure/communication-common": "^2.
|
|
62
|
-
"@azure/core-auth": "^1.
|
|
63
|
-
"@azure/core-client": "^1.
|
|
64
|
-
"@azure/core-lro": "^2.2
|
|
65
|
-
"@azure/core-paging": "^1.
|
|
66
|
-
"@azure/core-rest-pipeline": "^1.
|
|
67
|
-
"@azure/core-tracing": "^1.
|
|
68
|
-
"@azure/logger": "^1.
|
|
69
|
-
"events": "^3.
|
|
70
|
-
"tslib": "^2.
|
|
71
|
-
"uuid": "^8.3.2"
|
|
60
|
+
"@azure/abort-controller": "^2.1.2",
|
|
61
|
+
"@azure/communication-common": "^2.3.1",
|
|
62
|
+
"@azure/core-auth": "^1.9.0",
|
|
63
|
+
"@azure/core-client": "^1.9.2",
|
|
64
|
+
"@azure/core-lro": "^2.7.2",
|
|
65
|
+
"@azure/core-paging": "^1.6.2",
|
|
66
|
+
"@azure/core-rest-pipeline": "^1.18.2",
|
|
67
|
+
"@azure/core-tracing": "^1.2.0",
|
|
68
|
+
"@azure/logger": "^1.1.4",
|
|
69
|
+
"events": "^3.3.0",
|
|
70
|
+
"tslib": "^2.8.1"
|
|
72
71
|
},
|
|
73
72
|
"devDependencies": {
|
|
74
73
|
"@azure-tools/test-recorder": ">=4.1.0-alpha <4.1.0-alphb",
|
|
@@ -76,17 +75,15 @@
|
|
|
76
75
|
"@azure/core-util": "^1.9.0",
|
|
77
76
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
78
77
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
79
|
-
"@azure/identity": "^4.0
|
|
78
|
+
"@azure/identity": "^4.5.0",
|
|
80
79
|
"@types/node": "^18.0.0",
|
|
81
|
-
"@
|
|
82
|
-
"@vitest/
|
|
83
|
-
"@vitest/coverage-istanbul": "^2.1.4",
|
|
80
|
+
"@vitest/browser": "^3.0.3",
|
|
81
|
+
"@vitest/coverage-istanbul": "^3.0.3",
|
|
84
82
|
"dotenv": "^16.0.0",
|
|
85
83
|
"eslint": "^9.9.0",
|
|
86
|
-
"inherits": "^2.0.3",
|
|
87
84
|
"playwright": "^1.48.2",
|
|
88
85
|
"typescript": "~5.7.2",
|
|
89
|
-
"vitest": "^
|
|
86
|
+
"vitest": "^3.0.3"
|
|
90
87
|
},
|
|
91
88
|
"//metadata": {
|
|
92
89
|
"constantPaths": [
|