diff --git a/src/components/shared/blocking-aws-blockquote/blocking-aws-blockquote.view.js b/src/components/shared/blocking-aws-blockquote/blocking-aws-blockquote.view.js index 02923c2710..56a167d970 100644 --- a/src/components/shared/blocking-aws-blockquote/blocking-aws-blockquote.view.js +++ b/src/components/shared/blocking-aws-blockquote/blocking-aws-blockquote.view.js @@ -6,19 +6,15 @@ const BlockingAwsBlockquote = () => ( mod="Attention" title="Performance considerations and recommended practices" > - The APIs provided by this jslib operate synchronously, which means k6 must - wait for operations that use the client classes to finish before proceeding - with the rest of the script. -

- In some cases, such as downloading large files from S3, this could affect - performance and test results. To minimize the impact on test performance, - we recommend using these operations in the - setup and{' '} - teardown{' '} - lifecycle functions. These - functions run before and after the test run and thus do not influence test - results. -

+ In some cases, using this library's operations might impact performance + and skew your test results.
+
+ To ensure accurate results, consider executing these operations in the{' '} + setup and{' '} + teardown{' '} + lifecycle functions. These + functions run before and after the test run and have no impact on the test + results. ); diff --git a/src/data/markdown/docs/05 Examples/01 Examples/02 http-authentication.md b/src/data/markdown/docs/05 Examples/01 Examples/02 http-authentication.md index f53c3bfdea..410cbfa92e 100644 --- a/src/data/markdown/docs/05 Examples/01 Examples/02 http-authentication.md +++ b/src/data/markdown/docs/05 Examples/01 Examples/02 http-authentication.md @@ -118,7 +118,7 @@ Here's an example script to demonstrate how to sign a request to fetch an object ```javascript import http from 'k6/http'; -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.8.1/signature.js'; +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.9.0/signature.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 AwsConfig.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 AwsConfig.md index bcff5fa532..f9d4e2e908 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 AwsConfig.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 AwsConfig.md @@ -41,7 +41,7 @@ import exec from 'k6/execution'; // Note that you AWSConfig is also included in the dedicated service // client bundles such as `s3.js` and `secrets-manager.js` -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/aws.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/aws.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 KMSClient.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 KMSClient.md index ee94be9c55..ebfb5be74c 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 KMSClient.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 KMSClient.md @@ -8,7 +8,8 @@ excerpt: 'KMSClient allows interacting with the AWS Key Management Service' `KMSClient` interacts with the AWS Key Management Service. -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. + +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. Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundle include the `KMSClient`. @@ -35,7 +36,7 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl ```javascript import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js'; -import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.8.1/kms.js'; +import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.9.0/kms.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -46,14 +47,14 @@ const awsConfig = new AWSConfig({ const kms = new KMSClient(awsConfig); const keyAlias = 'alias/k6-key'; -export function setup() { +export async function setup() { // Create a symmetric data key return { - dataKey: kms.generateDataKey(keyAlias, 32), + dataKey: await kms.generateDataKey(keyAlias, 32), }; } -export default function (data) { +export default async function (data) { // Use the data key to encrypt data } diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 S3Client.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 S3Client.md index 69b7345905..d1813106df 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 S3Client.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 S3Client.md @@ -7,9 +7,11 @@ excerpt: 'S3Client class allows interacting with AWS S3 buckets and objects' -S3Client allows interacting with AWS S3's buckets and objects. Namely, it allows the user to list buckets and the objects they contain, as well as download, uploading, and deleting objects. The S3Client operations are blocking, and we recommend reserving their usage to the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) functions as much as possible. +`S3Client` interacts with the AWS Simple Storage Service (S3). -S3Client is included in both the dedicated jslib `s3.js` bundle, and the `aws.js` one, containing all the services clients. +With it, you can do several operations such as list buckets, list objects in a bucket, or download objects from a bucket. For a full list of supported operations, see [Methods](#methods). + +Both the dedicated `s3.js` jslib bundle and the all-encompassing `aws.js` bundle include the `S3Client`. ### Methods @@ -44,7 +46,7 @@ import { check } from 'k6'; import exec from 'k6/execution'; import http from 'k6/http'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -57,21 +59,21 @@ const testBucketName = 'test-jslib-aws'; const testInputFileKey = 'productIDs.json'; const testOutputFileKey = `results-${Date.now()}.json`; -export function setup() { +export async function setup() { // If our test bucket does not exist, abort the execution. - const buckets = s3.listBuckets(); + const buckets = await s3.listBuckets(); if (buckets.filter((b) => b.name === testBucketName).length == 0) { exec.test.abort(); } // If our test object does not exist, abort the execution. - const objects = s3.listObjects(testBucketName); + const objects = await s3.listObjects(testBucketName); if (objects.filter((o) => o.key === testInputFileKey).length == 0) { exec.test.abort(); } // Download the S3 object containing our test data - const inputObject = s3.getObject(testBucketName, testInputFileKey); + const inputObject = await s3.getObject(testBucketName, testInputFileKey); // Let's return the downloaded S3 object's data from the // setup function to allow the default function to use it. @@ -80,31 +82,33 @@ export function setup() { }; } -export default function (data) { +export default async function (data) { // Pick a random product ID from our test data const randomProductID = data.productIDs[Math.floor(Math.random() * data.productIDs.length)]; // Query our ecommerce website's product page using the ID - const res = http.get(`http://your.website.com/product/${randomProductID}/`); + const res = await http.asyncRequest("GET", `http://your.website.com/product/${randomProductID}/`); check(res, { 'is status 200': res.status === 200 }); } -export function handleSummary(data) { +export async function handleSummary(data) { // Once the load test is over, let's upload the results to our // S3 bucket. This is executed after teardown. - s3.putObject(testBucketName, testOutputFileKey, JSON.stringify(data)); + await s3.putObject(testBucketName, testOutputFileKey, JSON.stringify(data)); } ``` +#### Multipart uploads + ```javascript import crypto from 'k6/crypto'; import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -118,10 +122,10 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // List the buckets the AWS authentication configuration // gives us access to. - const buckets = s3.listBuckets(); + const buckets = await s3.listBuckets(); // If our test bucket does not exist, abort the execution. if (buckets.filter((b) => b.name === testBucketName).length == 0) { @@ -134,11 +138,11 @@ export default function () { const bigFile = crypto.randomBytes(12 * 1024 * 1024); // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = s3.uploadPart( + const firstPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -148,7 +152,7 @@ export default function () { // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = s3.uploadPart( + const secondPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -157,14 +161,14 @@ export default function () { ); // Complete the multipart upload - s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ firstPart, secondPart, ]); // Let's redownload it verify it's correct, and delete it - const obj = s3.getObject(testBucketName, testFileKey); - s3.deleteObject(testBucketName, testFileKey); + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SQSClient.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SQSClient.md index 80d93d114e..b6a14f65c9 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SQSClient.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SQSClient.md @@ -5,11 +5,11 @@ description: 'SQSClient enables interaction with the AWS Simple Queue Service (S excerpt: 'SQSClient allows interacting with the AWS Simple Queue Service (SQS)' --- - +`SQSClient` interacts with the AWS Simple Queue Service (SQS). -`SQSClient` interacts with the AWS Simple Queue Service (SQS). With it, the user can send messages to specified queues and list available queues in the current region. `SQSClient` operations are blocking. +With it, the user can send messages to specified queues and list available queues in the current region. -Both the dedicated `sqs.js` jslib bundle and the all-encompassing `aws.js` bundle include the `SQSClient`. +`SQSClient` is included in both the dedicated `sqs.js` jslib bundle and the all-encompassing `aws.js` one, containing all the services clients. ### Methods @@ -34,7 +34,7 @@ Both the dedicated `sqs.js` jslib bundle and the all-encompassing `aws.js` bundl ```javascript import exec from 'k6/execution' -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.8.1/sqs.js' +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.9.0/sqs.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -46,15 +46,15 @@ const awsConfig = new AWSConfig({ const sqs = new SQSClient(awsConfig) const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' -export default function () { +export default async function () { // If our test queue does not exist, abort the execution. - const queuesResponse = sqs.listQueues() + const queuesResponse = await sqs.listQueues() if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { exec.test.abort() } // Send message to test queue - sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); + await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SecretsManagerClient.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SecretsManagerClient.md index c77736e88c..f549fa7b7e 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SecretsManagerClient.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SecretsManagerClient.md @@ -5,11 +5,11 @@ description: 'SecretsManagerClient allows interacting with AWS secrets stored in excerpt: 'SecretsManagerClient allows interacting with AWS secrets stored in Secrets Manager' --- - +`SecretsManagerClient` interacts with the AWS Secrets Manager. -SecretsManagerClient allows interacting with secrets stored in AWS's Secrets Manager. Namely, it allows the user to list, download, create, modify and delete secrets. Note that the SecretsManagerClient operations are blocking, and we recommend reserving their usage to the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) functions as much as possible. +With it, you can perform several operations such as listing, creating and downloading secrets owned by the authenticated user. For a full list of supported operations, see [Methods](#methods). -SecretsManagerClient is included in both the dedicated jslib `secrets-manager.js` bundle, and the `aws.js` one, containing all the services clients. +`SecretsManagerClient` is included in both the dedicated jslib `secrets-manager.js` bundle, and the `aws.js` one, containing all the services clients. ### Methods @@ -37,7 +37,7 @@ S3 Client methods will throw errors in case of failure. ```javascript import exec from 'k6/execution'; -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -49,9 +49,9 @@ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; const testSecretValue = 'jslib-test-value'; -export function setup() { +export async function setup() { // Let's make sure our test secret is created - const testSecret = secretsManager.createSecret( + const testSecret = await secretsManager.createSecret( testSecretName, testSecretValue, 'this is a test secret, delete me.' @@ -59,19 +59,19 @@ export function setup() { // List the secrets the AWS authentication configuration // gives us access to, and verify the creation was successful. - const secrets = secretsManager.listSecrets(); + const secrets = await secretsManager.listSecrets(); if (!secrets.filter((s) => s.name === testSecret.name).length == 0) { exec.test.abort('test secret not found'); } } -export default function () { +export default async function () { // Knnowing that we know the secret exist, let's update its value const newTestSecretValue = 'new-test-value'; - secretsManager.putSecretValue(testSecretName, newTestSecretValue); + await secretsManager.putSecretValue(testSecretName, newTestSecretValue); // Let's get its value and verify it was indeed updated - const updatedSecret = secretsManager.getSecret(testSecretName); + const updatedSecret = await secretsManager.getSecret(testSecretName); if (updatedSecret.secret !== newTestSecretValue) { exec.test.abort('unable to update test secret'); } @@ -79,9 +79,9 @@ export default function () { // Let's now use our secret in the context of our load test... } -export function teardown() { +export async function teardown() { // Finally, let's clean after ourselves and delete our test secret - secretsManager.deleteSecret(testSecretName, { noRecovery: true }); + await secretsManager.deleteSecret(testSecretName, { noRecovery: true }); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SignatureV4.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SignatureV4.md index 39c3e933aa..59a92b7241 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SignatureV4.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SignatureV4.md @@ -5,6 +5,8 @@ description: 'SignatureV4 is used to sign or pre-sign requests to AWS services u excerpt: 'SignatureV4 is used to sign and pre-sign requests to AWS services using the Signature V4 algorithm' --- + + With SignatureV4, you can produce authenticated HTTP requests to AWS services. Namely, it lets you sign and pre-sign requests to AWS services using the [Signature V4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) algorithm. The `sign` operation produces a signed request with authorization information stored in its headers. The `presign` operation produces a pre-signed request with authorization information stored in its query string parameters. @@ -42,9 +44,9 @@ SignatureV4 methods throw errors on failure. ```javascript -import http from 'k6/http.js' +import http from 'k6/http' -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.8.1/aws.js' +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.9.0/aws.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SystemsManagerClient.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SystemsManagerClient.md index 9269c2fd5e..8ea071ebf1 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SystemsManagerClient.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/00 SystemsManagerClient.md @@ -5,10 +5,9 @@ description: 'SystemsManagerClient allows interacting with the AWS Systems Manag excerpt: 'SystemsManagerClient allows interacting with the AWS Systems Manager Service' --- - - `SystemsManagerClient` interacts with the AWS Systems Manager Service. -With it, the user can get parameters from the Systems Manager Service in the caller's AWS account and region. `SystemsManagerClient` 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. + +With it, the user can get parameters from the Systems Manager Service in the caller's AWS account and region. Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundle include the `SystemsManagerClient`. @@ -34,7 +33,7 @@ Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundl ```javascript import exec from 'k6/execution'; -import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/ssm.js'; +import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/ssm.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -50,19 +49,19 @@ const testParameterSecretName = 'jslib-test-parameter-secret'; // this value was created with --type SecureString const testParameterSecretValue = 'jslib-test-secret-value'; -export default function () { +export default async function () { // Currently the parameter needs to be created before hand // Let's get its value // getParameter returns a parameter object: e.g. {name: string, value: string...} - const parameter = systemsManager.getParameter(testParameterName); + const parameter = await systemsManager.getParameter(testParameterName); if (parameter.value !== testParameterValue) { exec.test.abort('test parameter not found'); } // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = systemsManager.getParameter( + const { value: encryptedParameterValue } = await systemsManager.getParameter( testParameterSecretName, true ); diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 generateDataKey.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 generateDataKey.md index b57d79cab3..322deebd34 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 generateDataKey.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 generateDataKey.md @@ -15,9 +15,9 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi ### Returns -| Type | Description | -| :----------------------------------------------------------- | :----------------------------------------------------------------- | -| [`KMSDataKey`](/javascript-api/jslib/aws/kmsclient/kmsdatakey) | A [KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmskey) object. | +| Type | Description | +| :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | +| Promise<[KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmskey) object. | ### Example @@ -26,7 +26,7 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi ```javascript import exec from 'k6/execution'; -import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.8.1/kms.js'; +import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.9.0/kms.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -37,10 +37,10 @@ const awsConfig = new AWSConfig({ const kms = new KMSClient(awsConfig); const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; -export default function () { +export default async function () { // List the KMS keys the AWS authentication configuration // gives us access to. - const keys = kms.listKeys(); + const keys = await kms.listKeys(); // If our test key does not exist, abort the execution. if (keys.filter((b) => b.keyId === testKeyId).length == 0) { @@ -48,7 +48,7 @@ export default function () { } // Generate a data key from the KMS key. - const key = kms.generateDataKey(testKeyId, 32); + const key = await kms.generateDataKey(testKeyId, 32); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 listKeys.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 listKeys.md index 75bdb652f5..0f3c0d2dd4 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 listKeys.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/00 listKeys.md @@ -8,9 +8,9 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account ### Returns -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| [`KMSKey[]`](/javascript-api/jslib/aws/kmsclient/kmskey) | An array of [`KMSKey`](/javascript-api/jslib/aws/kmsclient/kmskey) objects. | +| Type | Description | +| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- | +| Promise<[KMSKey[]](/javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](/javascript-api/jslib/aws/kmsclient/kmskey) objects. | ### Example @@ -19,7 +19,7 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account ```javascript import exec from 'k6/execution'; -import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.8.1/kms.js'; +import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.9.0/kms.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,10 +30,10 @@ const awsConfig = new AWSConfig({ const kms = new KMSClient(awsConfig); const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; -export default function () { +export default async function () { // List the KMS keys the AWS authentication configuration // gives us access to. - const keys = kms.listKeys(); + const keys = await kms.listKeys(); // If our test key does not exist, abort the execution. if (keys.filter((b) => b.keyId === testKeyId).length == 0) { diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSDataKey.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSDataKey.md index 89b4a4ed0e..81b2e975a3 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSDataKey.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSDataKey.md @@ -21,7 +21,7 @@ For instance, the [`generateDataKey`](/javascript-api/jslib/aws/kmsclient/kmscli ```javascript import exec from 'k6/execution'; -import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.8.1/kms.js'; +import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.9.0/kms.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -32,10 +32,10 @@ const awsConfig = new AWSConfig({ const kms = new KMSClient(awsConfig); const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; -export default function () { +export default async function () { // List the KMS keys the AWS authentication configuration // gives us access to. - const keys = kms.listKeys(); + const keys = await kms.listKeys(); // If our test key does not exist, abort the execution. if (keys.filter((b) => b.keyId === testKeyId).length == 0) { @@ -43,7 +43,7 @@ export default function () { } // Generate a data key from the KMS key. - const key = kms.generateDataKey(testKeyId, 32); + const key = await kms.generateDataKey(testKeyId, 32); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSKey.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSKey.md index 270581a39b..07be324b8d 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSKey.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/KMSClient/90 KMSKey.md @@ -18,7 +18,7 @@ excerpt: 'KMSKey is returned by the KMSClient.* methods that query KMS keys' ```javascript import exec from 'k6/execution'; -import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.8.1/kms.js'; +import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.9.0/kms.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -29,10 +29,10 @@ const awsConfig = new AWSConfig({ const kms = new KMSClient(awsConfig); const testKeyId = 'e67f95-4c047567-4-a0b7-62f7ce8ec8f48'; -export default function () { +export default async function () { // List the KMS keys the AWS authentication configuration // gives us access to. - const keys = kms.listKeys(); + const keys = await kms.listKeys(); // If our test key does not exist, abort the execution. if (keys.filter((b) => b.keyId === testKeyId).length == 0) { diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md index dfe47cc46a..103e1b1fe4 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md @@ -6,18 +6,26 @@ excerpt: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' `S3Client.abortMultipartUpload` aborts a multipart upload to an S3 bucket. +### Parameters + | Parameter | Type | Description | | :--------- | :-------------------- | :----------------------------------------------------- | | bucketName | string | Name of the bucket to delete the multipart object from.| | objectKey | string | Name of the multipart object to delete. | | uploadId | number | UploadId of the multipart upload to abort. | +### Returns + +| Type | Description | +| :-------------- | :------------------------------------------------------------------ | +| `Promise` | A promise that fulfills when the multipart upload has been aborted. | + ### Example ```javascript -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -31,12 +39,12 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Abort multipart upload - s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md index 6dd0b7b04f..a28583a701 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md @@ -6,6 +6,8 @@ excerpt: 'S3Client.completeMultipartUpload uploads a multipart object to a bucke `S3Client.completeMultipartUpload` uploads a multipart object to an S3 bucket. +### Parameters + | Parameter | Type | Description | | :--------- | :------------------------------------------------------------- | :--------------------------------------------------------------------- | | bucketName | string | Name of the bucket to delete the object to. | @@ -13,6 +15,12 @@ excerpt: 'S3Client.completeMultipartUpload uploads a multipart object to a bucke | uploadId | number | UploadId of the multipart upload to complete. | | parts | Array<[S3Part](/javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](/javascript-api/jslib/aws/s3client/s3part)s to assemble. | +### Returns + +| Type | Description | +| :-------------- | :-------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the multipart upload has been completed. | + ### Example @@ -21,7 +29,7 @@ excerpt: 'S3Client.completeMultipartUpload uploads a multipart object to a bucke import crypto from 'k6/crypto'; import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -35,10 +43,10 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // List the buckets the AWS authentication configuration // gives us access to. - const buckets = s3.listBuckets(); + const buckets = await s3.listBuckets(); // If our test bucket does not exist, abort the execution. if (buckets.filter((b) => b.name === testBucketName).length == 0) { @@ -51,11 +59,11 @@ export default function () { const bigFile = crypto.randomBytes(12 * 1024 * 1024); // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = s3.uploadPart( + const firstPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -65,7 +73,7 @@ export default function () { // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = s3.uploadPart( + const secondPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -74,14 +82,14 @@ export default function () { ); // Complete the multipart upload - s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ firstPart, secondPart, ]); // Let's redownload it verify it's correct, and delete it - const obj = s3.getObject(testBucketName, testFileKey); - s3.deleteObject(testBucketName, testFileKey); + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 copyObject.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 copyObject.md index 34cb4dc3d2..acd415004f 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 copyObject.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 copyObject.md @@ -15,6 +15,12 @@ excerpt: 'S3Client.copyObject copies an object from a bucket to another' | destinationBucket | string | Name of the bucket to copy the object to. | | destinationKey | string | Name of the destination object. | +### Returns + +| Type | Description | +| :-------------- | :---------------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the object has been copied from one bucket to another. | + ### Example @@ -22,7 +28,7 @@ excerpt: 'S3Client.copyObject copies an object from a bucket to another' ```javascript import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ @@ -37,15 +43,15 @@ const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; const testDestinationBucketName = 'test-jslib-aws-destination'; -export default function () { +export default async function () { // Let's upload our test file to the bucket - s3.putObject(testBucketName, testFileKey, testFile); + await s3.putObject(testBucketName, testFileKey, testFile); // Let's create our destination bucket - s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); + await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); } ``` _A k6 script that will copy an object from a source S3 bucket to a destination bucket_ - \ No newline at end of file + diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md index dd5fc0ffab..7d2d280fd9 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md @@ -15,14 +15,14 @@ excerpt: 'S3Client.createMultipartUpload creates a multipart upload to a bucket' | Type | Description | | :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| [S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload) | An [S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | +| Promise<[S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | ### Example ```javascript -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -36,12 +36,12 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Abort multipart upload - s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 deleteObject(bucketName, objectKey).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 deleteObject(bucketName, objectKey).md index 332edb3415..a927212257 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 deleteObject(bucketName, objectKey).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 deleteObject(bucketName, objectKey).md @@ -6,11 +6,19 @@ excerpt: 'S3Client.deleteObject deletes an object from a bucket' `S3Client.deleteObject` deletes an object from a bucket. +### Parameters + | Parameter | Type | Description | | :--------- | :-------------------- | :------------------------------------------- | | bucketName | string | Name of the bucket to delete the object from.| | objectKey | string | Name of the object to delete. | +### Returns + +| Type | Description | +| :-------------- | :------------------------------------------------------------------ | +| `Promise` | A promise that fulfills when the object has been deleted from S3. | + ### Example @@ -18,7 +26,7 @@ excerpt: 'S3Client.deleteObject deletes an object from a bucket' ```javascript import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,12 +38,12 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; -export default function () { +export default async function () { // Let's delete our test object - s3.deleteObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); // And make sure it was indeed deleted - const objects = s3.listObjects(); + const objects = await s3.listObjects(); if (objects.filter((o) => o.name === testBucketName).length != 0) { exec.test.abort(); } diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 getObject(bucketName, objectKey).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 getObject(bucketName, objectKey).md index 1eb899aa7b..df5f3b8a06 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 getObject(bucketName, objectKey).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 getObject(bucketName, objectKey).md @@ -6,6 +6,8 @@ excerpt: 'S3Client.getObject downloads an object from a bucket' `S3Client.getObject` downloads an object from a bucket. +### Parameters + | Parameter | Type | Description | | :--------- | :----- | :------------------------------------------- | | bucketName | string | Name of the bucket to fetch the object from. | @@ -13,9 +15,9 @@ excerpt: 'S3Client.getObject downloads an object from a bucket' ### Returns -| Type | Description | -| :-------------------------------------------------- | :---------------------------------------------------------------------------------------------------- | -| [Object](/javascript-api/jslib/aws/s3client/object) | An [Object](/javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | +| Type | Description | +| :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[Object](/javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](/javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | ### Example @@ -24,7 +26,7 @@ excerpt: 'S3Client.getObject downloads an object from a bucket' ```javascript import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -36,8 +38,8 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; -export default function () { - const objects = s3.listObjects(testBucketName); +export default async function () { + const objects = await s3.listObjects(testBucketName); // If our test object does not exist, abort the execution. if (objects.filter((o) => o.key === testFileKey).length == 0) { @@ -45,7 +47,7 @@ export default function () { } // Let's download our test object and print its content - const object = s3.getObject(testBucketName, testFileKey); + const object = await s3.getObject(testBucketName, testFileKey); console.log(JSON.stringify(object)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listBuckets().md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listBuckets().md index 32781252b3..97a1e58deb 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listBuckets().md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listBuckets().md @@ -8,9 +8,9 @@ excerpt: 'S3Client.listBuckets lists the buckets the authenticated user has acce ### Returns -| Type | Description | -| :-------------- | :----------------------------------------------------------------------- | -| Array<[Bucket](/javascript-api/jslib/aws/s3client/bucket)> | An array of [Bucket](/javascript-api/jslib/aws/s3client/bucket) objects. | +| Type | Description | +| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Promise> | A Promise that fulfills with an array of [Bucket](/javascript-api/jslib/aws/s3client/bucket) objects. | ### Example @@ -19,7 +19,7 @@ excerpt: 'S3Client.listBuckets lists the buckets the authenticated user has acce ```javascript import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,10 +30,10 @@ const awsConfig = new AWSConfig({ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; -export default function () { +export default async function () { // List the buckets the AWS authentication configuration // gives us access to. - const buckets = s3.listBuckets(); + const buckets = await s3.listBuckets(); // If our test bucket does not exist, abort the execution. if (buckets.filter((b) => b.name === testBucketName).length == 0) { diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listObjects(bucketName, [prefix]).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listObjects(bucketName, [prefix]).md index a4695685ec..107fbdc9c8 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listObjects(bucketName, [prefix]).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 listObjects(bucketName, [prefix]).md @@ -6,6 +6,8 @@ excerpt: 'S3Client.listObjects lists the objects contained in a bucket' `S3Client.listObjects()` lists the objects contained in a bucket. +### Parameters + | Parameter | Type | Description | | :---------------- | :----- | :---------------------------------------------------------------- | | bucketName | string | Name of the bucket to fetch the object from. | @@ -13,9 +15,9 @@ excerpt: 'S3Client.listObjects lists the objects contained in a bucket' ### Returns -| Type | Description | -| :--------------------------------------------------------- | :----------------------------------------------------------------------- | -| Array<[Object](/javascript-api/jslib/aws/s3client/object)> | An array of [Object](/javascript-api/jslib/aws/s3client/object) objects. | +| Type | Description | +| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Promise> | A Promise that fulfills with an array of [Object](/javascript-api/jslib/aws/s3client/object) objects. | ### Example @@ -24,7 +26,7 @@ excerpt: 'S3Client.listObjects lists the objects contained in a bucket' ```javascript import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -36,9 +38,9 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; -export default function () { +export default async function () { // List our bucket's objects - const objects = s3.listObjects(testBucketName); + const objects = await s3.listObjects(testBucketName); // If our test object does not exist, abort the execution. if (objects.filter((o) => o.key === testFileKey).length == 0) { diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 putObject(bucketName, objectKey, data).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 putObject(bucketName, objectKey, data).md index c752e4cfeb..8d28fe98b2 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 putObject(bucketName, objectKey, data).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 putObject(bucketName, objectKey, data).md @@ -6,18 +6,26 @@ excerpt: 'S3Client.putObject uploads an object to a bucket' `S3Client.putObject` uploads an object to a bucket. +### Parameters + | Parameter | Type | Description | | :--------- | :-------------------- | :------------------------------------------- | | bucketName | string | Name of the bucket to upload the object to. | | objectKey | string | Name of the uploaded object. | | data | string \| ArrayBuffer | Content of the object to upload. | +### Returns + +| Type | Description | +| :-------------- | :-------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | + ### Example ```javascript -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,12 +38,12 @@ const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; const testFile = open('./bonjour.txt', 'r'); -export default function () { +export default async function () { // Let's upload our test file to the bucket - s3.putObject(testBucketName, testFileKey, testFile); + await s3.putObject(testBucketName, testFileKey, testFile); // And let's redownload it to verify it's correct - const obj = s3.getObject(testBucketName, testFileKey); + const obj = await s3.getObject(testBucketName, testFileKey); console.log(JSON.stringify(obj)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md index 803f294d0a..e29a8f7451 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md @@ -16,9 +16,9 @@ excerpt: 'S3Client.uploadPart a part in a multipart upload to a bucket' ### Returns -| Type | Description | -| :---------------------------------------------------- | :--------------------------------------------------------------------------------------- | -| [S3Part](/javascript-api/jslib/aws/s3client/s3part) | An [S3Part](/javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | +| Type | Description | +| :----------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | +| Promise<[S3Part](/javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](/javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | ### Example @@ -28,7 +28,7 @@ excerpt: 'S3Client.uploadPart a part in a multipart upload to a bucket' import crypto from 'k6/crypto'; import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -42,18 +42,18 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // Produce random bytes to upload of size ~12MB, that // we will upload in two 6MB parts. This is done as the // minimum part size supported by S3 is 5MB. const bigFile = crypto.randomBytes(12 * 1024 * 1024); // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = s3.uploadPart( + const firstPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -63,7 +63,7 @@ export default function () { // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = s3.uploadPart( + const secondPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -72,14 +72,14 @@ export default function () { ); // Complete the multipart upload - s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ firstPart, secondPart, ]); // Let's redownload it verify it's correct, and delete it - const obj = s3.getObject(testBucketName, testFileKey); - s3.deleteObject(testBucketName, testFileKey); + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Bucket.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Bucket.md index de98a52635..e36660ee74 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Bucket.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Bucket.md @@ -16,7 +16,7 @@ Bucket is returned by the S3Client.* methods that query S3 buckets. Namely, `lis ```javascript -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -26,10 +26,10 @@ const awsConfig = new AWSConfig({ const s3 = new S3Client(awsConfig); -export default function () { +export default async function () { // List the buckets the AWS authentication configuration // gives us access to. - const buckets = s3.listBuckets(); + const buckets = await s3.listBuckets(); console.log(JSON.stringify(buckets)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Object.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Object.md index 1362a7d174..e98fbcc3e0 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Object.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 Object.md @@ -27,7 +27,7 @@ import { // listBuckets, AWSConfig, S3Client, -} from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +} from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -39,8 +39,8 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; -export default function () { - const objects = s3.listObjects(testBucketName); +export default async function () { + const objects = await s3.listObjects(testBucketName); // If our test object does not exist, abort the execution. if (objects.filter((o) => o.key === testFileKey).length == 0) { @@ -48,7 +48,7 @@ export default function () { } // Let's download our test object and print its content - const object = s3.getObject(testBucketName, testFileKey); + const object = await s3.getObject(testBucketName, testFileKey); console.log(JSON.stringify(object)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3MultipartUpload.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3MultipartUpload.md index 64329f1dd0..5afb760124 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3MultipartUpload.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3MultipartUpload.md @@ -16,7 +16,7 @@ S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectK ```javascript -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,13 +30,13 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); console.log(multipartUpload.uploadId); // Abort multipart upload - s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3Part.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3Part.md index 766ffef921..4136c024ec 100755 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3Part.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/90 S3Part.md @@ -19,7 +19,7 @@ S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumb import crypto from 'k6/crypto'; import exec from 'k6/execution'; -import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.8.1/s3.js'; +import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -33,18 +33,18 @@ const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; -export default function () { +export default async function () { // Produce random bytes to upload of size ~12MB, that // we will upload in two 6MB parts. This is done as the // minimum part size supported by S3 is 5MB. const bigFile = crypto.randomBytes(12 * 1024 * 1024); // Initialize a multipart upload - const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey); + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = s3.uploadPart( + const firstPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -54,7 +54,7 @@ export default function () { // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = s3.uploadPart( + const secondPart = await s3.uploadPart( testBucketName, testFileKey, multipartUpload.uploadId, @@ -63,14 +63,14 @@ export default function () { ); // Complete the multipart upload - s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ firstPart, secondPart, ]); // Let's redownload it verify it's correct, and delete it - const obj = s3.getObject(testBucketName, testFileKey); - s3.deleteObject(testBucketName, testFileKey); + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 listQueues.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 listQueues.md index b19d73f21c..f6e0c921c7 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 listQueues.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 listQueues.md @@ -16,7 +16,7 @@ excerpt: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" | Type | Description | | :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| `object` | An object with an `urls` property containing an array of queue URLs, and an optional `nextToken` containing a pagination token to include in the next request when relevant. | +| `Promise` | A Promise that fulfills with an object with an `urls` property containing an array of queue URLs, and an optional `nextToken` containing a pagination token to include in the next request when relevant. | ### Example @@ -25,7 +25,7 @@ excerpt: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" ```javascript import exec from 'k6/execution' -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.8.1/sqs.js' +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.9.0/sqs.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -37,9 +37,9 @@ const awsConfig = new AWSConfig({ const sqs = new SQSClient(awsConfig) const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' -export default function () { +export default async function () { // List all queues in the AWS account - const queuesResponse = sqs.listQueues() + const queuesResponse = await sqs.listQueues() // If our test queue does not exist, abort the execution. if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { @@ -47,7 +47,7 @@ export default function () { } // Send message to test queue - sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); + await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 sendMessage.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 sendMessage.md index b261b58f7c..fc21c47a36 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 sendMessage.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 sendMessage.md @@ -18,7 +18,7 @@ excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queu | Type | Description | | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `object` | The message that was sent, as an object containing an `id` string property holding the unique identifier for the message, and a `bodyMD5` string property holding the MD5 digest of the non-URL-encoded message body string. | +| `Promise` | A Promise that fulfills with the message that was sent, as an object containing an `id` string property holding the unique identifier for the message, and a `bodyMD5` string property holding the MD5 digest of the non-URL-encoded message body string. | ### Example @@ -27,7 +27,7 @@ excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queu ```javascript import exec from 'k6/execution' -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.8.1/sqs.js' +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.9.0/sqs.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -39,15 +39,15 @@ const awsConfig = new AWSConfig({ const sqs = new SQSClient(awsConfig) const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' -export default function () { +export default async function () { // If our test queue does not exist, abort the execution. - const queuesResponse = sqs.listQueues() + const queuesResponse = await sqs.listQueues() if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { exec.test.abort() } // Send message to test queue - sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); + await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md index df2bba0aa3..c985b7468f 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md @@ -6,6 +6,8 @@ excerpt: 'SecretsManagerClient.createSecret creates a new secret' `SecretsManagerClient.createSecret` creates a secret in AWS' secrets manager. +### Parameters + | Parameter | Type | Description | | :------------------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | name | string | The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. | @@ -14,12 +16,18 @@ excerpt: 'SecretsManagerClient.createSecret creates a new secret' | versionID (optional) | string | Optional unique version identifier for the created secret. If no versionID is provided, an auto-generated UUID will be used instead. | | tags (optional) | Array<{"key": "value"},> | A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string | +### Returns + +| Type | Description | +| :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) object that contains the details of the created secret. | + ### Example ```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -31,16 +39,16 @@ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; const testSecretValue = 'jslib-test-value'; -export default function () { +export default async function () { // Let's create our test secret. - const testSecret = secretsManager.createSecret( + const testSecret = await secretsManager.createSecret( testSecretName, testSecretValue, 'this is a test secret, delete me.' ); // Let's get its value and verify it was indeed created. - const createdSecret = secretsManager.getSecret(testSecretName); + const createdSecret = await secretsManager.getSecret(testSecretName); console.log(JSON.stringify(createdSecret)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 deleteSecret.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 deleteSecret.md index 8a4cb1b2aa..21736c4dee 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 deleteSecret.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 deleteSecret.md @@ -6,17 +6,25 @@ excerpt: 'SecretsManagerClient.deleteSecret deletes a secret' `SecretsManagerClient.deleteSecret` deletes a secret from AWS' secrets manager. +### Parameters + | Parameter | Type | Description | | :-------- | :---------------------------------------- | :--------------------------------------- | | secretID | string | The ARN or name of the secret to update. | | options | { recoveryWindow: 30, noRecovery: false } | Use options to control the deletion behavior. recoveryWindow defines how long a secret will remain “soft-deleted”, in days, before being hard-deleted. noRecovery set to true would hard-delete the secret immediately. Note that both options are exclusive. | +### Returns + +| Type | Description | +| :-------------- | :--------------------------------------------------------- | +| `Promise` | A promise that will be resolved when the secret is deleted | + ### Example ```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -28,16 +36,16 @@ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; const testSecretValue = 'jslib-test-value'; -export default function () { +export default async function () { // Let's make sure our test secret is created - const testSecret = secretsManager.createSecret( + const testSecret = await secretsManager.createSecret( testSecretName, testSecretValue, 'this is a test secret, delete me.' ); // Let's hard delete our test secret and verify it worked - secretsManager.deleteSecret(testSecretName, { noRecovery: true }); + await secretsManager.deleteSecret(testSecretName, { noRecovery: true }); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 getSecret(secretID).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 getSecret(secretID).md index 4430bb7403..620d0b1423 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 getSecret(secretID).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 getSecret(secretID).md @@ -14,7 +14,7 @@ excerpt: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS s | Type | Description | | :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | -| [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) | A [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | +| Promise<[Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | ### Example @@ -23,7 +23,7 @@ excerpt: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS s ```javascript import exec from 'k6/execution'; -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -34,16 +34,16 @@ const awsConfig = new AWSConfig({ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; -export default function () { +export default async function () { // List the secrets the AWS authentication configuration // gives us access to. - const secrets = secretsManager.listSecrets(); + const secrets = await secretsManager.listSecrets(); if (secrets.filter((s) => s.name === testSecretName).length == 0) { exec.test.abort('test secret not found'); } // Let's get our test secret's value and print it. - const secret = secretsManager.getSecret(testSecretName); + const secret = await secretsManager.getSecret(testSecretName); console.log(JSON.stringify(secret)); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 listSecrets().md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 listSecrets().md index f15d15eef4..3e37ce7caf 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 listSecrets().md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 listSecrets().md @@ -10,7 +10,7 @@ excerpt: 'SecretsManagerClient.listSecrets lists the secrets the authenticated u | Type | Description | | :--------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| Array<[Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret)> | An array of [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | +| Promise> | A Promise that fulfills with an array of [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | ### Example @@ -19,7 +19,7 @@ excerpt: 'SecretsManagerClient.listSecrets lists the secrets the authenticated u ```javascript import exec from 'k6/execution'; -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -30,10 +30,10 @@ const awsConfig = new AWSConfig({ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; -export default function () { +export default async function () { // List the secrets the AWS authentication configuration // gives us access to, and verify the test secret exists. - const secrets = secretsManager.listSecrets(); + const secrets = await secretsManager.listSecrets(); if (secrets.filter((s) => s.name === testSecretName).length == 0) { exec.test.abort('test secret not found'); } diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md index a3e75c8d84..efbddd30c5 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md @@ -13,6 +13,12 @@ excerpt: "SecretsManagerClient.putSecretValue updates an existing secret's value | versionID (optional) | string | Optional unique version identifier for the updated version of the secret. If no versionID is provided, an auto-generated UUID will be used instead. | | tags (optional) | Array<{"key": "value"},> | A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string | +### Returns + +| Type | Description | +| :--- | ----------- | +| Promise<[Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with the updated [Secret](/javascript-api/jslib/aws/secretsmanagerclient/secret). | + ### Example @@ -20,7 +26,7 @@ excerpt: "SecretsManagerClient.putSecretValue updates an existing secret's value ```javascript import exec from 'k6/execution'; -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -32,9 +38,9 @@ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; const testSecretValue = 'jslib-test-value'; -export default function () { +export default async function () { // Let's make sure our test secret is created - const testSecret = secretsManager.createSecret( + const testSecret = await secretsManager.createSecret( testSecretName, testSecretValue, 'this is a test secret, delete me.' @@ -42,10 +48,10 @@ export default function () { // Now that we know the secret exist, let's update its value const newTestSecretValue = 'new-test-value'; - const u = secretsManager.putSecretValue(testSecretName, newTestSecretValue); + const u = await secretsManager.putSecretValue(testSecretName, newTestSecretValue); // Let's get its value back and verify it was indeed updated - const updatedSecret = secretsManager.getSecret(testSecretName); + const updatedSecret = await secretsManager.getSecret(testSecretName); if (updatedSecret.secret !== newTestSecretValue) { exec.test.abort('unable to update test secret'); } diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/99 Secret.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/99 Secret.md index d59b988cb7..582d801c61 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/99 Secret.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SecretsManagerClient/99 Secret.md @@ -25,7 +25,7 @@ Secret is returned by the SecretsManagerClient.* methods that query secrets. Nam ```javascript import exec from 'k6/execution'; -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -36,10 +36,10 @@ const awsConfig = new AWSConfig({ const secretsManager = new SecretsManagerClient(awsConfig); const testSecretName = 'jslib-test-secret'; -export default function () { +export default async function () { // List the secrets the AWS authentication configuration // gives us access to. - const secrets = secretsManager.listSecrets(); + const secrets = await secretsManager.listSecrets(); // If our test secret does not exist, abort the execution. if (secrets.filter((s) => s.name === testSecretName).length == 0) { @@ -47,7 +47,7 @@ export default function () { } // Let's get it and print its content - const downloadedSecret = secretsManager.getSecret(testSecretName); + const downloadedSecret = await secretsManager.getSecret(testSecretName); console.log(downloadedSecret.secret); } ``` diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 presign().md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 presign().md index 8cbdb7b8f3..68ca2ec285 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 presign().md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 presign().md @@ -55,7 +55,7 @@ import { SignatureV4, AMZ_CONTENT_SHA256_HEADER, UNSIGNED_PAYLOAD, -} from 'https://jslib.k6.io/aws/0.8.1/kms.js' +} from 'https://jslib.k6.io/aws/0.9.0/kms.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 sign().md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 sign().md index 5ee3dc49a1..d1a784aae8 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 sign().md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SignatureV4/00 sign().md @@ -45,9 +45,9 @@ You can override SignatureV4 options in the context of this specific request. To ```javascript -import http from 'k6/http.js' +import http from 'k6/http' -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.8.1/signature.js' +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.9.0/signature.js' const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/00 getParameter.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/00 getParameter.md index 06c768e463..e8d7c7b924 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/00 getParameter.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/00 getParameter.md @@ -10,7 +10,7 @@ excerpt: "SystemsManagerClient.getParameter gets a Systems Manager parameter in | Type | Description | | :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| [`SystemsManagerParameter[]`](/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | An array of [`SystemsManagerParameter`](/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | +| [`Promise`](/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | A Promise that fulfills with an array of [`SystemsManagerParameter`](/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | ### Example @@ -19,7 +19,7 @@ excerpt: "SystemsManagerClient.getParameter gets a Systems Manager parameter in ```javascript import exec from 'k6/execution'; -import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/ssm.js'; +import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/ssm.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -35,19 +35,19 @@ const testParameterSecretName = 'jslib-test-parameter-secret'; // this value was created with --type SecureString const testParameterSecretValue = 'jslib-test-secret-value'; -export default function () { +export default async function () { // Currently the parameter needs to be created before hand // Let's get its value // getParameter returns a parameter object: e.g. {name: string, value: string...} - const parameter = systemsManager.getParameter(testParameterName); + const parameter = await systemsManager.getParameter(testParameterName); if (parameter.value !== testParameterValue) { exec.test.abort('test parameter not found'); } // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = systemsManager.getParameter( + const { value: encryptedParameterValue } = await systemsManager.getParameter( testParameterSecretName, true ); diff --git a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/90 SystemsManagerParameter.md b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/90 SystemsManagerParameter.md index d393060545..b0140b0192 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/90 SystemsManagerParameter.md +++ b/src/data/markdown/docs/20 jslib/01 jslib/01 aws/SystemsManagerClient/90 SystemsManagerParameter.md @@ -25,7 +25,7 @@ excerpt: 'SystemsManagerParameter is returned by the SystemsManagerClient.* meth ```javascript import exec from 'k6/execution'; -import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/ssm.js'; +import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/ssm.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, @@ -41,19 +41,19 @@ const testParameterSecretName = 'jslib-test-parameter-secret'; // this value was created with --type SecureString const testParameterSecretValue = 'jslib-test-secret-value'; -export default function () { +export default async function () { // Currently the parameter needs to be created before hand // Let's get its value // getParameter returns a parameter object: e.g. {name: string, value: string...} - const parameter = systemsManager.getParameter(testParameterName); + const parameter = await systemsManager.getParameter(testParameterName); if (parameter.value !== testParameterValue) { exec.test.abort('test parameter not found'); } // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = systemsManager.getParameter( + const { value: encryptedParameterValue } = await systemsManager.getParameter( testParameterSecretName, true ); diff --git a/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, { recoveryWindow 30, noRecovery false}}).md b/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, { recoveryWindow 30, noRecovery false}}).md index 8a4cb1b2aa..5a97f4b78e 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, { recoveryWindow 30, noRecovery false}}).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, { recoveryWindow 30, noRecovery false}}).md @@ -16,7 +16,7 @@ excerpt: 'SecretsManagerClient.deleteSecret deletes a secret' ```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, diff --git a/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, {{ recoveryWindow 30, noRecovery false }}).md b/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, {{ recoveryWindow 30, noRecovery false }}).md index 8a4cb1b2aa..5a97f4b78e 100644 --- a/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, {{ recoveryWindow 30, noRecovery false }}).md +++ b/src/data/markdown/docs/20 jslib/01 jslib/05 aws/SecretsManagerClient/04 deleteSecret(secretID, {{ recoveryWindow 30, noRecovery false }}).md @@ -16,7 +16,7 @@ excerpt: 'SecretsManagerClient.deleteSecret deletes a secret' ```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.8.1/secrets-manager.js'; +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION,