Skip to content

Commit a34f1cd

Browse files
committed
Update jslib-aws KMSClient's documentation to reflect new async syntax
1 parent 60b0d9d commit a34f1cd

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 KMSClient.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ excerpt: 'KMSClient allows interacting with the AWS Key Management Service'
88
<BlockingAwsBlockquote />
99

1010
`KMSClient` interacts with the AWS Key Management Service.
11-
With it, the user can list all the Key Management Service keys in the caller's AWS account and region. They can also generate symmetric data keys to use outside of AWS Key Management Service. `KMSClient` operations are blocking. k6 recommends reserving their use to the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) stages as much as possible.
11+
12+
With it, the user can list all the Key Management Service keys in the caller's AWS account and region. They can also generate symmetric data keys to use outside of AWS Key Management Service.
1213

1314
Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundle include the `KMSClient`.
1415

@@ -46,14 +47,14 @@ const awsConfig = new AWSConfig({
4647
const kms = new KMSClient(awsConfig);
4748
const keyAlias = 'alias/k6-key';
4849

49-
export function setup() {
50+
export async function setup() {
5051
// Create a symmetric data key
5152
return {
52-
dataKey: kms.generateDataKey(keyAlias, 32),
53+
dataKey: await kms.generateDataKey(keyAlias, 32),
5354
};
5455
}
5556

56-
export default function (data) {
57+
export default async function (data) {
5758
// Use the data key to encrypt data
5859
}
5960

src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 generateDataKey.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi
1515

1616
### Returns
1717

18-
| Type | Description |
19-
| :----------------------------------------------------------- | :----------------------------------------------------------------- |
20-
| [`KMSDataKey`](/javascript-api/jslib/aws/kmsclient/kmsdatakey) | A [KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmskey) object. |
18+
| Type | Description |
19+
| :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- |
20+
| Promise<[KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmskey) object. |
2121

2222
### Example
2323

@@ -37,18 +37,18 @@ const awsConfig = new AWSConfig({
3737
const kms = new KMSClient(awsConfig);
3838
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
3939

40-
export default function () {
40+
export default async function () {
4141
// List the KMS keys the AWS authentication configuration
4242
// gives us access to.
43-
const keys = kms.listKeys();
43+
const keys = await kms.listKeys();
4444

4545
// If our test key does not exist, abort the execution.
4646
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
4747
exec.test.abort();
4848
}
4949

5050
// Generate a data key from the KMS key.
51-
const key = kms.generateDataKey(testKeyId, 32);
51+
const key = await kms.generateDataKey(testKeyId, 32);
5252
}
5353
```
5454

src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 listKeys.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account
88

99
### Returns
1010

11-
| Type | Description |
12-
| :---------------------------------------------------------- | :------------------------------------------------------------------------ |
13-
| [`KMSKey[]`](/javascript-api/jslib/aws/kmsclient/kmskey) | An array of [`KMSKey`](/javascript-api/jslib/aws/kmsclient/kmskey) objects. |
11+
| Type | Description |
12+
| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- |
13+
| Promise<[KMSKey[]](/javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](/javascript-api/jslib/aws/kmsclient/kmskey) objects. |
1414

1515
### Example
1616

@@ -30,10 +30,10 @@ const awsConfig = new AWSConfig({
3030
const kms = new KMSClient(awsConfig);
3131
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
3232

33-
export default function () {
33+
export default async function () {
3434
// List the KMS keys the AWS authentication configuration
3535
// gives us access to.
36-
const keys = kms.listKeys();
36+
const keys = await kms.listKeys();
3737

3838
// If our test key does not exist, abort the execution.
3939
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {

src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSDataKey.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ const awsConfig = new AWSConfig({
3232
const kms = new KMSClient(awsConfig);
3333
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
3434

35-
export default function () {
35+
export default async function () {
3636
// List the KMS keys the AWS authentication configuration
3737
// gives us access to.
38-
const keys = kms.listKeys();
38+
const keys = await kms.listKeys();
3939

4040
// If our test key does not exist, abort the execution.
4141
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {
4242
exec.test.abort();
4343
}
4444

4545
// Generate a data key from the KMS key.
46-
const key = kms.generateDataKey(testKeyId, 32);
46+
const key = await kms.generateDataKey(testKeyId, 32);
4747
}
4848
```
4949

src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSKey.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const awsConfig = new AWSConfig({
2929
const kms = new KMSClient(awsConfig);
3030
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48';
3131

32-
export default function () {
32+
export default async function () {
3333
// List the KMS keys the AWS authentication configuration
3434
// gives us access to.
35-
const keys = kms.listKeys();
35+
const keys = await kms.listKeys();
3636

3737
// If our test key does not exist, abort the execution.
3838
if (keys.filter((b) => b.keyId === testKeyId).length == 0) {

0 commit comments

Comments
 (0)