|
| 1 | +import { CloudWatch } from "@aws-sdk/client-cloudwatch"; |
| 2 | +import { AwsJson1_0Protocol, AwsQueryProtocol, AwsSmithyRpcV2CborProtocol } from "@aws-sdk/core"; |
| 3 | +import { describe, expect, test as it } from "vitest"; |
| 4 | + |
| 5 | +describe(CloudWatch.name, () => { |
| 6 | + const cloudwatch = { |
| 7 | + cbor: new CloudWatch({ |
| 8 | + region: "us-west-2", |
| 9 | + protocol: new AwsSmithyRpcV2CborProtocol({ |
| 10 | + defaultNamespace: "com.amazonaws.cloudwatch", |
| 11 | + awsQueryCompatible: true, |
| 12 | + }), |
| 13 | + }), |
| 14 | + query: new CloudWatch({ |
| 15 | + region: "us-west-2", |
| 16 | + protocol: new AwsQueryProtocol({ |
| 17 | + defaultNamespace: "com.amazonaws.cloudwatch", |
| 18 | + /** |
| 19 | + * Hi security scanners. I see you looking at my xml namespace. |
| 20 | + * It's not a link, ok? We're not going to make requests over http here. |
| 21 | + * Thanks. |
| 22 | + */ |
| 23 | + xmlNamespace: "http://monitoring.amazonaws.com/doc/2010-08-01/", |
| 24 | + version: "2010-08-01", |
| 25 | + }), |
| 26 | + }), |
| 27 | + json: new CloudWatch({ |
| 28 | + region: "us-west-2", |
| 29 | + protocol: new AwsJson1_0Protocol({ |
| 30 | + defaultNamespace: "com.amazonaws.cloudwatch", |
| 31 | + serviceTarget: "GraniteServiceVersion20100801", |
| 32 | + awsQueryCompatible: true, |
| 33 | + }), |
| 34 | + }), |
| 35 | + }; |
| 36 | + |
| 37 | + it("can make requests with AWS Query protocol", async () => { |
| 38 | + const dashes = await cloudwatch.query.listDashboards(); |
| 39 | + expect(dashes.DashboardEntries ?? []).toBeInstanceOf(Array); |
| 40 | + }); |
| 41 | + |
| 42 | + it("can make requests with Smithy RPCv2 CBOR protocol", async () => { |
| 43 | + const dashes = await cloudwatch.cbor.listDashboards(); |
| 44 | + expect(dashes.DashboardEntries ?? []).toBeInstanceOf(Array); |
| 45 | + }); |
| 46 | + |
| 47 | + it("can make requests with AWS JSON RPC protocol", async () => { |
| 48 | + const dashes = await cloudwatch.json.listDashboards(); |
| 49 | + expect(dashes.DashboardEntries ?? []).toBeInstanceOf(Array); |
| 50 | + }); |
| 51 | +}); |
0 commit comments