@aws-sdk/client-cloudwatch 3.1008.0 → 3.1009.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.
- package/README.md +76 -46
- package/package.json +36 -36
package/README.md
CHANGED
|
@@ -21,8 +21,9 @@ visibility into resource utilization, application performance, and operational
|
|
|
21
21
|
health.</p>
|
|
22
22
|
|
|
23
23
|
## Installing
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
To install this package, use the CLI of your favorite package manager:
|
|
26
|
+
|
|
26
27
|
- `npm install @aws-sdk/client-cloudwatch`
|
|
27
28
|
- `yarn add @aws-sdk/client-cloudwatch`
|
|
28
29
|
- `pnpm add @aws-sdk/client-cloudwatch`
|
|
@@ -47,24 +48,74 @@ import { CloudWatchClient, ListMetricsCommand } from "@aws-sdk/client-cloudwatch
|
|
|
47
48
|
|
|
48
49
|
### Usage
|
|
49
50
|
|
|
50
|
-
To send a request
|
|
51
|
+
To send a request:
|
|
51
52
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
53
|
+
- Instantiate a client with configuration (e.g. credentials, region).
|
|
54
|
+
- See [docs/CLIENTS](https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md) for configuration details.
|
|
55
|
+
- See [@aws-sdk/config](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/config/README.md) for additional options.
|
|
56
|
+
- Instantiate a command with input parameters.
|
|
57
|
+
- Call the `send` operation on the client, providing the command object as input.
|
|
56
58
|
|
|
57
59
|
```js
|
|
58
|
-
// a client can be shared by different commands.
|
|
59
60
|
const client = new CloudWatchClient({ region: "REGION" });
|
|
60
61
|
|
|
61
62
|
const params = { /** input parameters */ };
|
|
62
63
|
const command = new ListMetricsCommand(params);
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
#### Supported Message Protocols
|
|
67
|
+
|
|
68
|
+
This client supports multiple protocols.
|
|
69
|
+
|
|
70
|
+
The default for this client is **AWS JSON (RPC) 1.0**.
|
|
71
|
+
|
|
72
|
+
We have selected this default based on our evaluation of the
|
|
73
|
+
performance characteristics of this protocol format in JavaScript. You don't need to change it,
|
|
74
|
+
but you have the option to do so, for example to support existing integrations or tests.
|
|
75
|
+
Selecting a non-default protocol changes the format
|
|
76
|
+
of the data sent over the network, but does not affect how you interact with the
|
|
77
|
+
client using JavaScript objects.
|
|
78
|
+
|
|
79
|
+
Install the `@aws-sdk/config` package to access alternate protocols.
|
|
80
|
+
|
|
81
|
+
See [AWS Protocols](https://smithy.io/2.0/aws/protocols/index.html) for more information.
|
|
82
|
+
|
|
83
|
+
##### AWS JSON (RPC) 1.0
|
|
84
|
+
|
|
85
|
+
This protocol uses JSON payloads.
|
|
86
|
+
```js
|
|
87
|
+
import { AwsJson1_0Protocol } from "@aws-sdk/config/protocol";
|
|
88
|
+
|
|
89
|
+
const client = new CloudWatchClient({
|
|
90
|
+
protocol: AwsJson1_0Protocol
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
##### AWS Query
|
|
95
|
+
|
|
96
|
+
This protocol uses query format requests and XML responses.
|
|
97
|
+
```js
|
|
98
|
+
import { AwsQueryProtocol } from "@aws-sdk/config/protocol";
|
|
99
|
+
|
|
100
|
+
const client = new CloudWatchClient({
|
|
101
|
+
protocol: AwsQueryProtocol
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
##### Smithy RPC v2 CBOR
|
|
106
|
+
|
|
107
|
+
This protocol uses CBOR payloads.
|
|
108
|
+
```js
|
|
109
|
+
import { AwsJson1_0Protocol } from "@aws-sdk/config/protocol";
|
|
110
|
+
|
|
111
|
+
const client = new CloudWatchClient({
|
|
112
|
+
protocol: AwsJson1_0Protocol
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
65
116
|
#### Async/await
|
|
66
117
|
|
|
67
|
-
We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
|
|
118
|
+
We recommend using the [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
|
|
68
119
|
operator to wait for the promise returned by send operation as follows:
|
|
69
120
|
|
|
70
121
|
```js
|
|
@@ -79,26 +130,9 @@ try {
|
|
|
79
130
|
}
|
|
80
131
|
```
|
|
81
132
|
|
|
82
|
-
Async-await is clean, concise, intuitive, easy to debug and has better error handling
|
|
83
|
-
as compared to using Promise chains or callbacks.
|
|
84
|
-
|
|
85
133
|
#### Promises
|
|
86
134
|
|
|
87
|
-
You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining)
|
|
88
|
-
to execute send operation.
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
client.send(command).then(
|
|
92
|
-
(data) => {
|
|
93
|
-
// process data.
|
|
94
|
-
},
|
|
95
|
-
(error) => {
|
|
96
|
-
// error handling.
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Promises can also be called using `.catch()` and `.finally()` as follows:
|
|
135
|
+
You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining).
|
|
102
136
|
|
|
103
137
|
```js
|
|
104
138
|
client
|
|
@@ -114,27 +148,21 @@ client
|
|
|
114
148
|
});
|
|
115
149
|
```
|
|
116
150
|
|
|
117
|
-
####
|
|
151
|
+
#### Aggregated client
|
|
118
152
|
|
|
119
|
-
|
|
120
|
-
but they are supported by the send operation.
|
|
121
|
-
|
|
122
|
-
```js
|
|
123
|
-
// callbacks.
|
|
124
|
-
client.send(command, (err, data) => {
|
|
125
|
-
// process err and data.
|
|
126
|
-
});
|
|
127
|
-
```
|
|
153
|
+
The aggregated client class is exported from the same package, but without the "Client" suffix.
|
|
128
154
|
|
|
129
|
-
|
|
155
|
+
`CloudWatch` extends `CloudWatchClient` and additionally supports all operations, waiters, and paginators as methods.
|
|
156
|
+
This style may be familiar to you from the AWS SDK for JavaScript v2.
|
|
130
157
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
If you are bundling the AWS SDK, we recommend using only the bare-bones client (`CloudWatchClient`).
|
|
159
|
+
More details are in the blog post on
|
|
160
|
+
[modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/).
|
|
134
161
|
|
|
135
162
|
```ts
|
|
136
|
-
import
|
|
137
|
-
|
|
163
|
+
import { CloudWatch } from "@aws-sdk/client-cloudwatch";
|
|
164
|
+
|
|
165
|
+
const client = new CloudWatch({ region: "REGION" });
|
|
138
166
|
|
|
139
167
|
// async/await.
|
|
140
168
|
try {
|
|
@@ -154,7 +182,7 @@ client
|
|
|
154
182
|
// error handling.
|
|
155
183
|
});
|
|
156
184
|
|
|
157
|
-
// callbacks.
|
|
185
|
+
// callbacks (not recommended).
|
|
158
186
|
client.listMetrics(params, (err, data) => {
|
|
159
187
|
// process err and data.
|
|
160
188
|
});
|
|
@@ -182,12 +210,14 @@ try {
|
|
|
182
210
|
}
|
|
183
211
|
```
|
|
184
212
|
|
|
213
|
+
See also [docs/ERROR_HANDLING](https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/ERROR_HANDLING.md).
|
|
214
|
+
|
|
185
215
|
## Getting Help
|
|
186
216
|
|
|
187
217
|
Please use these community resources for getting help.
|
|
188
|
-
We use
|
|
218
|
+
We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
|
|
189
219
|
|
|
190
|
-
- Visit [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html)
|
|
220
|
+
- Visit the [Developer Guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html)
|
|
191
221
|
or [API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html).
|
|
192
222
|
- Check out the blog posts tagged with [`aws-sdk-js`](https://aws.amazon.com/blogs/developer/tag/aws-sdk-js/)
|
|
193
223
|
on AWS Developer Blog.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-cloudwatch",
|
|
3
3
|
"description": "AWS SDK for JavaScript Cloudwatch Client for Node.js, Browser and React Native",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1009.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline client-cloudwatch",
|
|
@@ -27,48 +27,48 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
29
29
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
30
|
-
"@aws-sdk/core": "^3.973.
|
|
31
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
32
|
-
"@aws-sdk/middleware-host-header": "^3.972.
|
|
33
|
-
"@aws-sdk/middleware-logger": "^3.972.
|
|
34
|
-
"@aws-sdk/middleware-recursion-detection": "^3.972.
|
|
35
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
36
|
-
"@aws-sdk/region-config-resolver": "^3.972.
|
|
37
|
-
"@aws-sdk/types": "^3.973.
|
|
38
|
-
"@aws-sdk/util-endpoints": "^3.996.
|
|
39
|
-
"@aws-sdk/util-user-agent-browser": "^3.972.
|
|
40
|
-
"@aws-sdk/util-user-agent-node": "^3.973.
|
|
41
|
-
"@smithy/config-resolver": "^4.4.
|
|
42
|
-
"@smithy/core": "^3.23.
|
|
43
|
-
"@smithy/fetch-http-handler": "^5.3.
|
|
44
|
-
"@smithy/hash-node": "^4.2.
|
|
45
|
-
"@smithy/invalid-dependency": "^4.2.
|
|
46
|
-
"@smithy/middleware-compression": "^4.3.
|
|
47
|
-
"@smithy/middleware-content-length": "^4.2.
|
|
48
|
-
"@smithy/middleware-endpoint": "^4.4.
|
|
49
|
-
"@smithy/middleware-retry": "^4.4.
|
|
50
|
-
"@smithy/middleware-serde": "^4.2.
|
|
51
|
-
"@smithy/middleware-stack": "^4.2.
|
|
52
|
-
"@smithy/node-config-provider": "^4.3.
|
|
53
|
-
"@smithy/node-http-handler": "^4.4.
|
|
54
|
-
"@smithy/protocol-http": "^5.3.
|
|
55
|
-
"@smithy/smithy-client": "^4.12.
|
|
56
|
-
"@smithy/types": "^4.13.
|
|
57
|
-
"@smithy/url-parser": "^4.2.
|
|
30
|
+
"@aws-sdk/core": "^3.973.20",
|
|
31
|
+
"@aws-sdk/credential-provider-node": "^3.972.21",
|
|
32
|
+
"@aws-sdk/middleware-host-header": "^3.972.8",
|
|
33
|
+
"@aws-sdk/middleware-logger": "^3.972.8",
|
|
34
|
+
"@aws-sdk/middleware-recursion-detection": "^3.972.8",
|
|
35
|
+
"@aws-sdk/middleware-user-agent": "^3.972.21",
|
|
36
|
+
"@aws-sdk/region-config-resolver": "^3.972.8",
|
|
37
|
+
"@aws-sdk/types": "^3.973.6",
|
|
38
|
+
"@aws-sdk/util-endpoints": "^3.996.5",
|
|
39
|
+
"@aws-sdk/util-user-agent-browser": "^3.972.8",
|
|
40
|
+
"@aws-sdk/util-user-agent-node": "^3.973.7",
|
|
41
|
+
"@smithy/config-resolver": "^4.4.11",
|
|
42
|
+
"@smithy/core": "^3.23.11",
|
|
43
|
+
"@smithy/fetch-http-handler": "^5.3.15",
|
|
44
|
+
"@smithy/hash-node": "^4.2.12",
|
|
45
|
+
"@smithy/invalid-dependency": "^4.2.12",
|
|
46
|
+
"@smithy/middleware-compression": "^4.3.40",
|
|
47
|
+
"@smithy/middleware-content-length": "^4.2.12",
|
|
48
|
+
"@smithy/middleware-endpoint": "^4.4.25",
|
|
49
|
+
"@smithy/middleware-retry": "^4.4.42",
|
|
50
|
+
"@smithy/middleware-serde": "^4.2.14",
|
|
51
|
+
"@smithy/middleware-stack": "^4.2.12",
|
|
52
|
+
"@smithy/node-config-provider": "^4.3.12",
|
|
53
|
+
"@smithy/node-http-handler": "^4.4.16",
|
|
54
|
+
"@smithy/protocol-http": "^5.3.12",
|
|
55
|
+
"@smithy/smithy-client": "^4.12.5",
|
|
56
|
+
"@smithy/types": "^4.13.1",
|
|
57
|
+
"@smithy/url-parser": "^4.2.12",
|
|
58
58
|
"@smithy/util-base64": "^4.3.2",
|
|
59
59
|
"@smithy/util-body-length-browser": "^4.2.2",
|
|
60
60
|
"@smithy/util-body-length-node": "^4.2.3",
|
|
61
|
-
"@smithy/util-defaults-mode-browser": "^4.3.
|
|
62
|
-
"@smithy/util-defaults-mode-node": "^4.2.
|
|
63
|
-
"@smithy/util-endpoints": "^3.3.
|
|
64
|
-
"@smithy/util-middleware": "^4.2.
|
|
65
|
-
"@smithy/util-retry": "^4.2.
|
|
61
|
+
"@smithy/util-defaults-mode-browser": "^4.3.41",
|
|
62
|
+
"@smithy/util-defaults-mode-node": "^4.2.44",
|
|
63
|
+
"@smithy/util-endpoints": "^3.3.3",
|
|
64
|
+
"@smithy/util-middleware": "^4.2.12",
|
|
65
|
+
"@smithy/util-retry": "^4.2.12",
|
|
66
66
|
"@smithy/util-utf8": "^4.2.2",
|
|
67
|
-
"@smithy/util-waiter": "^4.2.
|
|
67
|
+
"@smithy/util-waiter": "^4.2.13",
|
|
68
68
|
"tslib": "^2.6.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@smithy/snapshot-testing": "^2.0.
|
|
71
|
+
"@smithy/snapshot-testing": "^2.0.2",
|
|
72
72
|
"@tsconfig/node20": "20.1.8",
|
|
73
73
|
"@types/node": "^20.14.8",
|
|
74
74
|
"concurrently": "7.0.0",
|