Skip to content

Commit 7a487e4

Browse files
committed
Replicate jslib-aws v0.48 changes in next docs
1 parent f945178 commit 7a487e4

36 files changed

+2094
-69
lines changed
Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
2-
title: 'EventBridgeClient.putEvents'
2+
title: 'putEvents'
33
head_title: 'EventBridgeClient.putEvents'
4-
slug: 'eventbridgeclient-putevents'
54
description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge'
65
excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge'
76
---
@@ -12,33 +11,32 @@ excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge'
1211

1312
### Parameters
1413

15-
| Parameter | Type | Description |
16-
| :------------ | :-------------- | :----------------------------------------------------------------------------------------------------------------------- |
17-
| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. |
14+
| Parameter | Type | Description |
15+
| :-------- | :-------------------------------- | :------------------------------------------------------- |
16+
| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. |
1817

1918
#### PutEventsInput
2019

21-
| Parameter | Type | Description |
22-
| :-------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------- |
23-
| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. |
24-
| EndpointId | string (optional) | The ID of the target to receive the event. |
20+
| Parameter | Type | Description |
21+
| :--------- | :-------------------------------------- | :------------------------------------------------------- |
22+
| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. |
23+
| EndpointId | string (optional) | The ID of the target to receive the event. |
2524

2625
#### EventBridgeEntry
2726

28-
| Parameter | Type | Description |
29-
| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------------- |
30-
| Source | string | The source of the event. |
31-
| Detail | object | A JSON object containing event data. |
32-
| DetailType | string | Free-form string used to decide what fields to expect in the event detail. |
33-
| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. |
34-
| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. |
35-
27+
| Parameter | Type | Description |
28+
| :----------- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ |
29+
| Source | string | The source of the event. |
30+
| Detail | object | A JSON object containing event data. |
31+
| DetailType | string | Free-form string used to decide what fields to expect in the event detail. |
32+
| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. |
33+
| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. |
3634

3735
### Returns
3836

39-
| Type | Description |
40-
| :-------------- | :---------------------------------------------------------------------------------- |
41-
| `Promise<void>` | A Promise that fulfills when the events have been sent to Amazon EventBridge. |
37+
| Type | Description |
38+
| :-------------- | :---------------------------------------------------------------------------- |
39+
| `Promise<void>` | A Promise that fulfills when the events have been sent to Amazon EventBridge. |
4240

4341
### Example
4442

@@ -56,19 +54,19 @@ const awsConfig = new AWSConfig({
5654

5755
const eventBridge = new EventBridgeClient(awsConfig);
5856
const eventEntry = {
59-
Source: "my.source",
60-
Detail: {
61-
key: "value"
62-
},
63-
DetailType: "MyDetailType",
64-
Resources: ["resource-arn"],
57+
Source: 'my.source',
58+
Detail: {
59+
key: 'value',
60+
},
61+
DetailType: 'MyDetailType',
62+
Resources: ['resource-arn'],
6563
};
6664

6765
export default async function () {
68-
await eventBridge.putEvents({
69-
Entries: [eventEntry]
70-
});
66+
await eventBridge.putEvents({
67+
Entries: [eventEntry],
68+
});
7169
}
7270
```
7371

74-
{{< /code >}}
72+
{{< /code >}}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: 'KMSDataKey'
3+
slug: 'kmsdatakey'
4+
head_title: 'KMSDataKey'
5+
description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys'
6+
---
7+
8+
# KMSDataKey
9+
10+
`KMSClient.*DataKey` methods, querying Key Management Service data keys, return some KMSDataKey instances.
11+
The KMSDataKey object describes an Amazon Key Management Service data key.
12+
For instance, the [`generateDataKey`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmsclient-generatedatakey/) returns the generated KMSDataKey object.
13+
14+
| Name | Type | Description |
15+
| :-------------------------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
16+
| `KMSDataKey.id` | string | The identifier of the Key Management Service key that encrypted the data key. |
17+
| `KMSDataKey.ciphertextBlob` | string | The base64-encoded encrypted copy of the data key. |
18+
| `KMSDataKey.plaintext` | string | The plain text data key. Use this data key to encrypt your data outside of Key Management Service. Then, remove it from memory as soon as possible. |
19+
20+
### Example
21+
22+
{{< code >}}
23+
24+
```javascript
25+
import exec from 'k6/execution';
26+
27+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js';
28+
29+
const awsConfig = new AWSConfig({
30+
region: __ENV.AWS_REGION,
31+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
32+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
33+
});
34+
35+
const kms = new KMSClient(awsConfig);
36+
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
37+
38+
export default async function () {
39+
// List the KMS keys the AWS authentication configuration
40+
// gives us access to.
41+
const keys = await kms.listKeys();
42+
43+
// If our test key does not exist, abort the execution.
44+
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
45+
exec.test.abort();
46+
}
47+
48+
// Generate a data key from the KMS key.
49+
const key = await kms.generateDataKey(testKeyId, 32);
50+
}
51+
```
52+
53+
_A k6 script that generating a data key from an AWS Key Management Service key_
54+
55+
{{< /code >}}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: 'KMSKey'
3+
head_title: 'KMSKey'
4+
description: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
5+
excerpt: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
6+
---
7+
8+
# KMSKey
9+
10+
`KMSClient.*` methods querying Key Management Service keys return some `KMSKey` instances. Namely, `listKeys()` returns an array of `KMSKey` objects. The `KMSKey` object describes an Amazon Key Management Service key.
11+
12+
| Name | Type | Description |
13+
| :-------------- | :----- | :--------------------------- |
14+
| `KMSKey.keyId` | string | Unique identifier of the key |
15+
| `KMSKey.keyArn` | string | ARN of the key |
16+
17+
### Example
18+
19+
{{< code >}}
20+
21+
```javascript
22+
import exec from 'k6/execution';
23+
24+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js';
25+
26+
const awsConfig = new AWSConfig({
27+
region: __ENV.AWS_REGION,
28+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
29+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
30+
});
31+
32+
const kms = new KMSClient(awsConfig);
33+
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
34+
35+
export default async function () {
36+
// List the KMS keys the AWS authentication configuration
37+
// gives us access to.
38+
const keys = await kms.listKeys();
39+
40+
// If our test key does not exist, abort the execution.
41+
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
42+
exec.test.abort();
43+
}
44+
}
45+
```
46+
47+
_A k6 script querying the user's Key Management Service keys and verifying their test key exists_
48+
49+
{{< /code >}}

docs/sources/next/javascript-api/jslib/aws/KMSClient/_index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl
1818

1919
### Methods
2020

21-
| Function | Description |
22-
| :-------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- |
23-
| [listKeys](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/00 listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. |
24-
| [generateDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/00 generateDataKey) | Generate a symmetric data key for use outside of the AWS Key Management Service. |
21+
| Function | Description |
22+
| :------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- |
23+
| [listKeys](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. |
24+
| [generateDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/generatedatakey) | Generate a symmetric data key for use outside of the AWS Key Management Service. |
2525

2626
### Throws
2727

@@ -63,7 +63,7 @@ export default async function (data) {
6363

6464
export function handleSummary(data) {
6565
return {
66-
stdout: textSummary(data, { indent: ' ', enableColors: true }),
66+
'stdout': textSummary(data, { indent: ' ', enableColors: true }),
6767
'./test-run.key': data.dataKey,
6868
};
6969
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: 'generateDataKey'
3+
head_title: 'KMSClient.generateDataKey'
4+
description: 'KMSClient.generateDataKey generates a symmetric data key for use outside of the AWS Key Management Service'
5+
excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outside of the AWS Key Management Service'
6+
---
7+
8+
# KMSClient.generateDataKey
9+
10+
`KMSClient.generateDataKey` generates a symmetric data key for use outside of the AWS Key Management Service.
11+
12+
### Parameters
13+
14+
| Name | Type | Description |
15+
| :----- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16+
| `id` | string | The identifier of the key. This can be either the key ID or the Amazon Resource Name (ARN) of the key. |
17+
| `size` | number | The length of the data key. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). For 256-bit (32-byte) data keys, use the value 32, instead. |
18+
19+
### Returns
20+
21+
| Type | Description |
22+
| :------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------- |
23+
| Promise<[KMSDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey) object. |
24+
25+
### Example
26+
27+
{{< code >}}
28+
29+
```javascript
30+
import exec from 'k6/execution';
31+
32+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js';
33+
34+
const awsConfig = new AWSConfig({
35+
region: __ENV.AWS_REGION,
36+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
37+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
38+
});
39+
40+
const kms = new KMSClient(awsConfig);
41+
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
42+
43+
export default async function () {
44+
// List the KMS keys the AWS authentication configuration
45+
// gives us access to.
46+
const keys = await kms.listKeys();
47+
48+
// If our test key does not exist, abort the execution.
49+
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
50+
exec.test.abort();
51+
}
52+
53+
// Generate a data key from the KMS key.
54+
const key = await kms.generateDataKey(testKeyId, 32);
55+
}
56+
```
57+
58+
_A k6 script that generating a data key from an AWS Key Management Service key_
59+
60+
{{< /code >}}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: 'listKeys'
3+
head_title: 'KMSClient.listKeys()'
4+
description: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region"
5+
excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region"
6+
---
7+
8+
# KMSClient.listKeys()
9+
10+
`KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region.
11+
12+
### Returns
13+
14+
| Type | Description |
15+
| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------- |
16+
| Promise<[KMSKey[]](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey) objects. |
17+
18+
### Example
19+
20+
{{< code >}}
21+
22+
```javascript
23+
import exec from 'k6/execution';
24+
25+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js';
26+
27+
const awsConfig = new AWSConfig({
28+
region: __ENV.AWS_REGION,
29+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
30+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
31+
});
32+
33+
const kms = new KMSClient(awsConfig);
34+
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
35+
36+
export default async function () {
37+
// List the KMS keys the AWS authentication configuration
38+
// gives us access to.
39+
const keys = await kms.listKeys();
40+
41+
// If our test key does not exist, abort the execution.
42+
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
43+
exec.test.abort();
44+
}
45+
}
46+
```
47+
48+
_A k6 script querying the user's Key Management Service keys and verifying their test key exists_
49+
50+
{{< /code >}}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: 'Bucket'
3+
head_title: 'Bucket'
4+
description: 'Bucket is returned by the S3Client.* methods who query S3 buckets.'
5+
---
6+
7+
# Bucket
8+
9+
Bucket is returned by the S3Client.\* methods that query S3 buckets. Namely, `listBuckets()` returns an array of Bucket objects. The Bucket object describes an Amazon S3 bucket.
10+
11+
| Name | Type | Description |
12+
| :-------------------- | :----- | :--------------------------- |
13+
| `Bucket.name` | string | The S3 bucket's name |
14+
| `Bucket.creationDate` | Date | The S3 bucket's creationDate |
15+
16+
### Example
17+
18+
{{< code >}}
19+
20+
```javascript
21+
import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.11.0/s3.js';
22+
23+
const awsConfig = new AWSConfig({
24+
region: __ENV.AWS_REGION,
25+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
26+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
27+
});
28+
29+
const s3 = new S3Client(awsConfig);
30+
31+
export default async function () {
32+
// List the buckets the AWS authentication configuration
33+
// gives us access to.
34+
const buckets = await s3.listBuckets();
35+
console.log(JSON.stringify(buckets));
36+
}
37+
```
38+
39+
_A k6 script that will query the user's S3 buckets and print all of their metadata_
40+
41+
{{< /code >}}

0 commit comments

Comments
 (0)