-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replicate jslib-aws v0.48 changes in next docs
- Loading branch information
Showing
36 changed files
with
2,094 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: 'KMSDataKey' | ||
slug: 'kmsdatakey' | ||
head_title: 'KMSDataKey' | ||
description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys' | ||
--- | ||
|
||
# KMSDataKey | ||
|
||
`KMSClient.*DataKey` methods, querying Key Management Service data keys, return some KMSDataKey instances. | ||
The KMSDataKey object describes an Amazon Key Management Service data key. | ||
For instance, the [`generateDataKey`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmsclient-generatedatakey/) returns the generated KMSDataKey object. | ||
|
||
| Name | Type | Description | | ||
| :-------------------------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `KMSDataKey.id` | string | The identifier of the Key Management Service key that encrypted the data key. | | ||
| `KMSDataKey.ciphertextBlob` | string | The base64-encoded encrypted copy of the data key. | | ||
| `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. | | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import exec from 'k6/execution'; | ||
|
||
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js'; | ||
|
||
const awsConfig = new AWSConfig({ | ||
region: __ENV.AWS_REGION, | ||
accessKeyId: __ENV.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const kms = new KMSClient(awsConfig); | ||
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; | ||
|
||
export default async function () { | ||
// List the KMS keys the AWS authentication configuration | ||
// gives us access to. | ||
const keys = await kms.listKeys(); | ||
|
||
// If our test key does not exist, abort the execution. | ||
if (keys.filter((b) => b.keyId === testKeyId).length == 0) { | ||
exec.test.abort(); | ||
} | ||
|
||
// Generate a data key from the KMS key. | ||
const key = await kms.generateDataKey(testKeyId, 32); | ||
} | ||
``` | ||
|
||
_A k6 script that generating a data key from an AWS Key Management Service key_ | ||
|
||
{{< /code >}} |
49 changes: 49 additions & 0 deletions
49
docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: 'KMSKey' | ||
head_title: 'KMSKey' | ||
description: 'KMSKey is returned by the KMSClient.* methods that query KMS keys' | ||
excerpt: 'KMSKey is returned by the KMSClient.* methods that query KMS keys' | ||
--- | ||
|
||
# KMSKey | ||
|
||
`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. | ||
|
||
| Name | Type | Description | | ||
| :-------------- | :----- | :--------------------------- | | ||
| `KMSKey.keyId` | string | Unique identifier of the key | | ||
| `KMSKey.keyArn` | string | ARN of the key | | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import exec from 'k6/execution'; | ||
|
||
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js'; | ||
|
||
const awsConfig = new AWSConfig({ | ||
region: __ENV.AWS_REGION, | ||
accessKeyId: __ENV.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const kms = new KMSClient(awsConfig); | ||
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; | ||
|
||
export default async function () { | ||
// List the KMS keys the AWS authentication configuration | ||
// gives us access to. | ||
const keys = await kms.listKeys(); | ||
|
||
// If our test key does not exist, abort the execution. | ||
if (keys.filter((b) => b.keyId === testKeyId).length == 0) { | ||
exec.test.abort(); | ||
} | ||
} | ||
``` | ||
|
||
_A k6 script querying the user's Key Management Service keys and verifying their test key exists_ | ||
|
||
{{< /code >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: 'generateDataKey' | ||
head_title: 'KMSClient.generateDataKey' | ||
description: 'KMSClient.generateDataKey generates a symmetric data key for use outside of the AWS Key Management Service' | ||
excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outside of the AWS Key Management Service' | ||
--- | ||
|
||
# KMSClient.generateDataKey | ||
|
||
`KMSClient.generateDataKey` generates a symmetric data key for use outside of the AWS Key Management Service. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| :----- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `id` | string | The identifier of the key. This can be either the key ID or the Amazon Resource Name (ARN) of the key. | | ||
| `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. | | ||
|
||
### Returns | ||
|
||
| Type | Description | | ||
| :------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------- | | ||
| 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. | | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import exec from 'k6/execution'; | ||
|
||
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js'; | ||
|
||
const awsConfig = new AWSConfig({ | ||
region: __ENV.AWS_REGION, | ||
accessKeyId: __ENV.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const kms = new KMSClient(awsConfig); | ||
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; | ||
|
||
export default async function () { | ||
// List the KMS keys the AWS authentication configuration | ||
// gives us access to. | ||
const keys = await kms.listKeys(); | ||
|
||
// If our test key does not exist, abort the execution. | ||
if (keys.filter((b) => b.keyId === testKeyId).length == 0) { | ||
exec.test.abort(); | ||
} | ||
|
||
// Generate a data key from the KMS key. | ||
const key = await kms.generateDataKey(testKeyId, 32); | ||
} | ||
``` | ||
|
||
_A k6 script that generating a data key from an AWS Key Management Service key_ | ||
|
||
{{< /code >}} |
50 changes: 50 additions & 0 deletions
50
docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: 'listKeys' | ||
head_title: 'KMSClient.listKeys()' | ||
description: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region" | ||
excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region" | ||
--- | ||
|
||
# KMSClient.listKeys() | ||
|
||
`KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region. | ||
|
||
### Returns | ||
|
||
| Type | Description | | ||
| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| 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. | | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import exec from 'k6/execution'; | ||
|
||
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.11.0/kms.js'; | ||
|
||
const awsConfig = new AWSConfig({ | ||
region: __ENV.AWS_REGION, | ||
accessKeyId: __ENV.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const kms = new KMSClient(awsConfig); | ||
const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; | ||
|
||
export default async function () { | ||
// List the KMS keys the AWS authentication configuration | ||
// gives us access to. | ||
const keys = await kms.listKeys(); | ||
|
||
// If our test key does not exist, abort the execution. | ||
if (keys.filter((b) => b.keyId === testKeyId).length == 0) { | ||
exec.test.abort(); | ||
} | ||
} | ||
``` | ||
|
||
_A k6 script querying the user's Key Management Service keys and verifying their test key exists_ | ||
|
||
{{< /code >}} |
41 changes: 41 additions & 0 deletions
41
docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: 'Bucket' | ||
head_title: 'Bucket' | ||
description: 'Bucket is returned by the S3Client.* methods who query S3 buckets.' | ||
--- | ||
|
||
# Bucket | ||
|
||
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. | ||
|
||
| Name | Type | Description | | ||
| :-------------------- | :----- | :--------------------------- | | ||
| `Bucket.name` | string | The S3 bucket's name | | ||
| `Bucket.creationDate` | Date | The S3 bucket's creationDate | | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.11.0/s3.js'; | ||
|
||
const awsConfig = new AWSConfig({ | ||
region: __ENV.AWS_REGION, | ||
accessKeyId: __ENV.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const s3 = new S3Client(awsConfig); | ||
|
||
export default async function () { | ||
// List the buckets the AWS authentication configuration | ||
// gives us access to. | ||
const buckets = await s3.listBuckets(); | ||
console.log(JSON.stringify(buckets)); | ||
} | ||
``` | ||
|
||
_A k6 script that will query the user's S3 buckets and print all of their metadata_ | ||
|
||
{{< /code >}} |
Oops, something went wrong.