From 31ca32e8a4c398e338e966925435676a49b834b8 Mon Sep 17 00:00:00 2001 From: oleiade Date: Tue, 12 Dec 2023 11:13:24 +0100 Subject: [PATCH 1/5] Fix v0.47.x aws links --- .../jslib/aws/EventBridgeClient/putEvents.md | 58 +++-- .../{90 KMSDataKey.md => KMSDataKey.md} | 9 +- .../aws/KMSClient/{90 KMSKey.md => KMSKey.md} | 2 +- .../jslib/aws/KMSClient/_index.md | 10 +- ... generateDataKey.md => generateDataKey.md} | 13 +- .../KMSClient/{00 listKeys.md => listKeys.md} | 9 +- ...Upload(bucketName, objectKey, uploadId).md | 56 ----- ...bucketName, objectKey, uploadId, parts).md | 101 --------- ...eMultipartUpload(bucketName, objectKey).md | 53 ----- ... putObject(bucketName, objectKey, data).md | 70 ------ ...ctKey, uploadId, partNumber, data) copy.md | 91 -------- .../jslib/aws/S3Client/90 S3Part.md | 82 ------- .../aws/S3Client/{90 Bucket.md => Bucket.md} | 4 +- .../aws/S3Client/{90 Object.md => Object.md} | 17 +- ...ultipartUpload.md => S3MultipartUpload.md} | 28 +-- .../jslib/aws/S3Client/S3Part.md | 82 +++++++ .../jslib/aws/S3Client/_index.md | 45 ++-- .../aws/S3Client/abortMultipartUpload.md | 55 +++++ .../aws/S3Client/completeMultipartUpload.md | 100 +++++++++ .../{00 copyObject.md => copyObject.md} | 12 +- .../aws/S3Client/createMultipartUpload.md | 52 +++++ ...ketName, objectKey).md => deleteObject.md} | 19 +- ...bucketName, objectKey).md => getObject.md} | 9 +- .../{00 listBuckets().md => listBuckets.md} | 9 +- ...ucketName, [prefix]).md => listObjects.md} | 9 +- .../jslib/aws/S3Client/putObject.md | 69 ++++++ .../jslib/aws/S3Client/uploadPart.md | 90 ++++++++ .../jslib/aws/SQSClient/00 listQueues.md | 58 ----- .../jslib/aws/SQSClient/00 sendMessage.md | 82 ------- .../jslib/aws/SQSClient/_index.md | 8 +- .../jslib/aws/SQSClient/listQueues.md | 57 +++++ .../jslib/aws/SQSClient/sendMessage.md | 81 +++++++ .../{99 Secret.md => Secret.md} | 9 +- .../jslib/aws/SecretsManagerClient/_index.md | 14 +- ...versionID], [tags]).md => createSecret.md} | 11 +- .../{00 deleteSecret.md => deleteSecret.md} | 10 +- ...00 getSecret(secretID).md => getSecret.md} | 14 +- .../{00 listSecrets().md => listSecrets.md} | 7 +- ...ing, [versionID]).md => putSecretValue.md} | 11 +- .../jslib/aws/SignatureV4/00 presign().md | 202 ------------------ .../jslib/aws/SignatureV4/00 sign().md | 146 ------------- .../jslib/aws/SignatureV4/_index.md | 8 +- .../jslib/aws/SignatureV4/presign.md | 202 ++++++++++++++++++ .../jslib/aws/SignatureV4/sign.md | 145 +++++++++++++ ...arameter.md => SystemsManagerParameter.md} | 2 +- .../{00 getParameter.md => getParameter.md} | 8 +- 46 files changed, 1104 insertions(+), 1125 deletions(-) rename docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/{90 KMSDataKey.md => KMSDataKey.md} (89%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/{90 KMSKey.md => KMSKey.md} (99%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/{00 generateDataKey.md => generateDataKey.md} (77%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/{00 listKeys.md => listKeys.md} (79%) delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md delete mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3Part.md rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{90 Bucket.md => Bucket.md} (84%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{90 Object.md => Object.md} (89%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{90 S3MultipartUpload.md => S3MultipartUpload.md} (55%) create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{00 copyObject.md => copyObject.md} (85%) create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{00 deleteObject(bucketName, objectKey).md => deleteObject.md} (70%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{00 getObject(bucketName, objectKey).md => getObject.md} (80%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{00 listBuckets().md => listBuckets.md} (78%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/{00 listObjects(bucketName, [prefix]).md => listObjects.md} (81%) create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md create mode 100755 docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md delete mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md delete mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md create mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md create mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{99 Secret.md => Secret.md} (84%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{00 createSecret(name, secretString, description, [versionID], [tags]).md => createSecret.md} (85%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{00 deleteSecret.md => deleteSecret.md} (72%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{00 getSecret(secretID).md => getSecret.md} (71%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{00 listSecrets().md => listSecrets.md} (78%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/{00 putSecretValue(secretID, secretString, [versionID]).md => putSecretValue.md} (84%) delete mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 presign().md delete mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 sign().md create mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/presign.md create mode 100644 docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/sign.md rename docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/{90 SystemsManagerParameter.md => SystemsManagerParameter.md} (99%) rename docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/{00 getParameter.md => getParameter.md} (75%) diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index 994492d6d4..cb0399ccca 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -1,7 +1,6 @@ --- -title: 'EventBridgeClient.putEvents' +title: 'putEvents' head_title: 'EventBridgeClient.putEvents' -slug: 'eventbridgeclient-putevents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' --- @@ -12,33 +11,32 @@ excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' ### Parameters -| Parameter | Type | Description | -| :------------ | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | +| Parameter | Type | Description | +| :-------- | :-------------------------------- | :------------------------------------------------------- | +| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | #### PutEventsInput -| Parameter | Type | Description | -| :-------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | -| EndpointId | string (optional) | The ID of the target to receive the event. | +| Parameter | Type | Description | +| :--------- | :-------------------------------------- | :------------------------------------------------------- | +| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | +| EndpointId | string (optional) | The ID of the target to receive the event. | #### EventBridgeEntry -| Parameter | Type | Description | -| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------------- | -| Source | string | The source of the event. | -| Detail | object | A JSON object containing event data. | -| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | -| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | -| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | - +| Parameter | Type | Description | +| :----------- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Source | string | The source of the event. | +| Detail | object | A JSON object containing event data. | +| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | +| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | +| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | ### Returns -| Type | Description | -| :-------------- | :---------------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | +| Type | Description | +| :-------------- | :---------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | ### Example @@ -56,19 +54,19 @@ const awsConfig = new AWSConfig({ const eventBridge = new EventBridgeClient(awsConfig); const eventEntry = { - Source: "my.source", - Detail: { - key: "value" - }, - DetailType: "MyDetailType", - Resources: ["resource-arn"], + Source: 'my.source', + Detail: { + key: 'value', + }, + DetailType: 'MyDetailType', + Resources: ['resource-arn'], }; export default async function () { - await eventBridge.putEvents({ - Entries: [eventEntry] - }); + await eventBridge.putEvents({ + Entries: [eventEntry], + }); } ``` -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md similarity index 89% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md index baffa9e1e3..f4b836b143 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -11,10 +11,10 @@ description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that quer The KMSDataKey object describes an Amazon Key Management Service data key. For instance, the [`generateDataKey`](https://grafana.com/docs/k6//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. | +| 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 @@ -53,4 +53,3 @@ export default async function () { _A k6 script that generating a data key from an AWS Key Management Service key_ {{< /code >}} - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md similarity index 99% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md index 75270b4b55..83f10505d0 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -47,4 +47,4 @@ export default async function () { _A k6 script querying the user's Key Management Service keys and verifying their test key exists_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/_index.md index 5fca4ba3d6..2b533eb675 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/_index.md @@ -18,10 +18,10 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | -| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 generateDataKey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | +| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/generatedatakey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | ### Throws @@ -63,7 +63,7 @@ export default async function (data) { export function handleSummary(data) { return { - stdout: textSummary(data, { indent: ' ', enableColors: true }), + 'stdout': textSummary(data, { indent: ' ', enableColors: true }), './test-run.key': data.dataKey, }; } diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md similarity index 77% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md index e350f54bc7..a217e48cfa 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -1,7 +1,6 @@ --- -title: 'KMSClient.generateDataKey' +title: 'generateDataKey' head_title: 'KMSClient.generateDataKey' -slug: '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' --- @@ -12,15 +11,15 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi ### Parameters -| Name | Type | Description | -| :--- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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 | -| :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | +| Type | Description | +| :------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[KMSDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey) object. | ### Example @@ -59,5 +58,3 @@ export default async function () { _A k6 script that generating a data key from an AWS Key Management Service key_ {{< /code >}} - - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md similarity index 79% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md index 0b89ce35cc..26337a008c 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -1,7 +1,6 @@ --- -title: 'KMSClient.listKeys()' +title: 'listKeys' head_title: 'KMSClient.listKeys()' -slug: '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" --- @@ -12,8 +11,8 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account ### Returns -| Type | Description | -| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[KMSKey[]](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey) objects. | ### Example @@ -49,5 +48,3 @@ export default async function () { _A k6 script querying the user's Key Management Service keys and verifying their test key exists_ {{< /code >}} - - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md deleted file mode 100755 index 04ec6b6d2a..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -slug: 's3client-abortmultipartupload' -description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' ---- - -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) - -`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 - -{{< 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload and abort the multipart_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md deleted file mode 100755 index e41ff6f807..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -slug: 's3client-completemultipartupload' -description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' ---- - -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) - -`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. | -| objectKey | string | Name of the uploaded object. | -| uploadId | number | UploadId of the multipart upload to complete. | -| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // List the buckets the AWS authentication configuration - // gives us access to. - const buckets = await s3.listBuckets(); - - // If our test bucket does not exist, abort the execution. - if (buckets.filter((b) => b.name === testBucketName).length == 0) { - exec.test.abort(); - } - - // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md deleted file mode 100755 index 717866d28b..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -slug: 's3client-createmultipartupload' -description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' ---- - -# S3Client.createMultipartUpload(bucketName, objectKey) - -`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the uploaded object. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | - -### 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md deleted file mode 100755 index 7c61a48733..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: 'S3Client.putObject(bucketName, objectKey, data)' -head_title: 'S3Client.putObject(bucketName, objectKey, data)' -slug: 's3client-putobject' -description: 'S3Client.putObject uploads an object to a bucket' ---- - -# S3Client.putObject(bucketName, objectKey, data) - -`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. | -| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | - -#### PutObjectParams - -| Name | Type | Description | -| :-------------------- | :---------------- | :---------- | -| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | -| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | -| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | -| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | -| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | - -### Returns - -| Type | Description | -| :-------------- | :-------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | - -### 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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; -const testFile = open('./bonjour.txt', 'r'); - -export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile, { - contentType: 'text/plain', - contentLength: testFile.length, - }); - - // And let's redownload it to verify it's correct - const obj = await s3.getObject(testBucketName, testFileKey); - console.log(JSON.stringify(obj)); -} -``` - -_A k6 script that will upload an object to a S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md deleted file mode 100755 index 6fa49213ae..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -slug: 's3client-uploadpart' -description: 'S3Client.uploadPart a part in a multipart upload to a bucket' ---- - -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) - -`S3Client.uploadPart` uploads a part to multipart upload in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the object to upload. | -| uploadId | string | UploadId of the multipart upload. | -| partNumber | number | The Part number of the Part to upload. | -| data | string \| ArrayBuffer | Content of the part to upload. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3Part.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3Part.md deleted file mode 100755 index 067ffe775d..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3Part.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'S3Part' -head_title: 'S3Part' -slug: 's3part' -description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' ---- - -# S3Part - -S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-uploadpart/) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. - -| Name | Type | Description | -| :-------------------- | :----- | :---------------------- | -| `S3Part.partNumber` | number | The S3 Part'number | -| `S3Part.eTag ` | String | The S3 Part's etag | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Bucket.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md similarity index 84% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Bucket.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md index 1eeb62f020..e02e36a7a4 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Bucket.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md @@ -7,7 +7,7 @@ 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. +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 | | :-------------------- | :----- | :--------------------------- | @@ -39,4 +39,4 @@ export default async function () { _A k6 script that will query the user's S3 buckets and print all of their metadata_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Object.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md similarity index 89% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Object.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md index a49ed2dd7a..264d9b7ba5 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 Object.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md @@ -10,14 +10,14 @@ description: "Object is returned by the S3Client.* methods who query S3 buckets' Object is returned by the S3Client.\* methods that query S3 buckets' objects. Namely, [`listObjects`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects), [`getObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-getobject), [`putObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-putobject), and [`deleteObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-deleteobject). The Object construct describes an Amazon S3 object. -| Name | Type | Description | -| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Object.key` | string | The S3 object's name. | -| `Object.lastModified` | number | The S3 object's last modification date. | -| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | -| `Object.size` | size | The S3 object's size in bytes. | -| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | -| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | +| Name | Type | Description | +| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Object.key` | string | The S3 object's name. | +| `Object.lastModified` | number | The S3 object's last modification date. | +| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | +| `Object.size` | size | The S3 object's size in bytes. | +| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | +| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | ### Example @@ -59,4 +59,3 @@ export default async function () { _A k6 script that will query a S3 bucket's objects and print its content and metadata_ {{< /code >}} - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md similarity index 55% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md index 5cb0daa2e8..5831312cfe 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md @@ -9,10 +9,10 @@ description: 'S3MultipartUpload is returned by the S3Client.createMultipartUploa S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectKey)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-createmultipartupload/) method when creating a [multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html). -| Name | Type | Description | -| :------------------------------ | :----- | :----------------------------- | -| `S3MultipartUpload.key` | string | The S3 Multipart object's key | -| `S3MultipartUpload.uploadId` | Date | The S3 Multipart upload Id | +| Name | Type | Description | +| :--------------------------- | :----- | :---------------------------- | +| `S3MultipartUpload.key` | string | The S3 Multipart object's key | +| `S3MultipartUpload.uploadId` | Date | The S3 Multipart upload Id | ### Example @@ -22,10 +22,10 @@ S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectK 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, }); const s3 = new S3Client(awsConfig); @@ -34,15 +34,15 @@ const testBucketName = 'test-jslib-aws'; const testFileKey = 'multipart.txt'; export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - console.log(multipartUpload.uploadId); + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + console.log(multipartUpload.uploadId); - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); } ``` _A k6 script that will create a multipart upload and log the multipart `uploadId` and abort the multipart upload_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md new file mode 100755 index 0000000000..bcc0a825c2 --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md @@ -0,0 +1,82 @@ +--- +title: 'S3Part' +head_title: 'S3Part' +slug: 's3part' +description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +--- + +# S3Part + +S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-uploadpart/) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. + +| Name | Type | Description | +| :-------------------- | :----- | :----------------- | +| `S3Part.partNumber` | number | The S3 Part'number | +| `S3Part.eTag ` | String | The S3 Part's etag | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/_index.md index 633be6816c..e1f2520bb5 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/_index.md @@ -18,18 +18,18 @@ Both the dedicated `s3.js` jslib bundle and the all-encompassing `aws.js` bundle ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | -| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 listBuckets()) | List the buckets the authenticated user has access to | -| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects/) | List the objects contained in a bucket | -| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 getObject(bucketName, objectKey)) | Download an object from a bucket | -| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 putObject(bucketName, objectKey, data)) | Upload an object to a bucket | -| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 deleteObject(bucketName, objectKey)) | Delete an object from a bucket | -| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 copyObject) | Copy an object from one bucket to another | -| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 createMultipartUpload(bucketName, objectKey)) | Create a multipart upload for a given objectKey to a bucket | -| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy) | Upload a part in a multipart upload | -| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts)) | Complete a previously assembled multipart upload | -| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 abortMultipartUpload(bucketName, objectKey, uploadId)) | Abort a multipart upload | +| Function | Description | +| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | +| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listbuckets) | List the buckets the authenticated user has access to | +| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listobjects) | List the objects contained in a bucket | +| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/getobject) | Download an object from a bucket | +| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/putobject) | Upload an object to a bucket | +| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/deleteobject) | Delete an object from a bucket | +| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/copyobject) | Copy an object from one bucket to another | +| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/createmultipartupload) | Create a multipart upload for a given objectKey to a bucket | +| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/uploadpart) | Upload a part in a multipart upload | +| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/completemultipartupload) | Complete a previously assembled multipart upload | +| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/abortmultipartupload) | Abort a multipart upload | ### Throws @@ -145,14 +145,29 @@ export default async function () { // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 1, firstPartData); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 2, secondPartData); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [firstPart, secondPart]); + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); // Let's redownload it verify it's correct, and delete it const obj = await s3.getObject(testBucketName, testFileKey); diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md new file mode 100755 index 0000000000..d63ce836ad --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -0,0 +1,55 @@ +--- +title: 'abortMultipartUpload' +head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' +description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +--- + +# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) + +`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 + +{{< 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload and abort the multipart_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md new file mode 100755 index 0000000000..6546cc335c --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -0,0 +1,100 @@ +--- +title: 'completeMultipartUpload' +head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' +description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +--- + +# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) + +`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. | +| objectKey | string | Name of the uploaded object. | +| uploadId | number | UploadId of the multipart upload to complete. | +| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // List the buckets the AWS authentication configuration + // gives us access to. + const buckets = await s3.listBuckets(); + + // If our test bucket does not exist, abort the execution. + if (buckets.filter((b) => b.name === testBucketName).length == 0) { + exec.test.abort(); + } + + // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 copyObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md similarity index 85% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 copyObject.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md index 07b0f65d74..b3dbbaebf5 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 copyObject.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.copyObject' +title: 'copyObject' head_title: 'S3Client.copyObject' -slug: 's3client-copyobject' description: 'S3Client.copyObject copies an object from a bucket to another' --- @@ -33,7 +32,6 @@ import exec from 'k6/execution'; 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, @@ -47,11 +45,11 @@ const testFileKey = 'bonjour.txt'; const testDestinationBucketName = 'test-jslib-aws-destination'; export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile); + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile); - // Let's create our destination bucket - await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); + // Let's create our destination bucket + await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); } ``` diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md new file mode 100755 index 0000000000..b0ce51a4d2 --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -0,0 +1,52 @@ +--- +title: 'createMultipartUpload' +head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' +description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +--- + +# S3Client.createMultipartUpload(bucketName, objectKey) + +`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. + +| Parameter | Type | Description | +| :--------- | :----- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the uploaded object. | + +### Returns + +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | + +### 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md similarity index 70% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md index 09019d3d7f..154f85075e 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.deleteObject(bucketName, objectKey)' +title: 'deleteObject' head_title: 'S3Client.deleteObject(bucketName, objectKey)' -slug: 's3client-deleteobject' description: 'S3Client.deleteObject deletes an object from a bucket' --- @@ -11,16 +10,16 @@ description: '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. | +| 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. | +| Type | Description | +| :-------------- | :---------------------------------------------------------------- | +| `Promise` | A promise that fulfills when the object has been deleted from S3. | ### Example @@ -55,4 +54,4 @@ export default async function () { _A k6 script that will delete an object from a S3 bucket_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md similarity index 80% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md index a273220fb4..0d66a1c4c5 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.getObject(bucketName, objectKey)' +title: 'getObject' head_title: 'S3Client.getObject(bucketName, objectKey)' -slug: 's3client-getobject' description: 'S3Client.getObject downloads an object from a bucket' --- @@ -18,8 +17,8 @@ description: 'S3Client.getObject downloads an object from a bucket' ### Returns -| Type | Description | -| :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | ### Example @@ -57,4 +56,4 @@ export default async function () { _A k6 script that will download an object from a bucket_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md similarity index 78% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md index c49f247344..25272099ea 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.listBuckets()' +title: 'listBuckets' head_title: 'S3Client.listBuckets()' -slug: 's3client-listbuckets' description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' --- @@ -11,8 +10,8 @@ description: 'S3Client.listBuckets lists the buckets the authenticated user has ### Returns -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/bucket) objects. | ### Example @@ -48,5 +47,3 @@ export default async function () { ``` {{< /code >}} - - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md similarity index 81% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md index aed563dd21..3500c002e2 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.listObjects(bucketName, [prefix])' +title: 'listObjects' head_title: 'S3Client.listObjects(bucketName, [prefix])' -slug: 's3client-listobjects' description: 'S3Client.listObjects lists the objects contained in a bucket' --- @@ -18,8 +17,8 @@ description: 'S3Client.listObjects lists the objects contained in a bucket' ### Returns -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) objects. | ### Example @@ -55,4 +54,4 @@ export default async function () { } ``` -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md new file mode 100755 index 0000000000..e3961bcebb --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md @@ -0,0 +1,69 @@ +--- +title: 'putObject' +head_title: 'S3Client.putObject(bucketName, objectKey, data)' +description: 'S3Client.putObject uploads an object to a bucket' +--- + +# S3Client.putObject(bucketName, objectKey, data) + +`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. | +| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | + +#### PutObjectParams + +| Name | Type | Description | +| :------------------- | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | +| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | +| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | +| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | +| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | + +### Returns + +| Type | Description | +| :-------------- | :-------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | + +### 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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; +const testFile = open('./bonjour.txt', 'r'); + +export default async function () { + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile, { + contentType: 'text/plain', + contentLength: testFile.length, + }); + + // And let's redownload it to verify it's correct + const obj = await s3.getObject(testBucketName, testFileKey); + console.log(JSON.stringify(obj)); +} +``` + +_A k6 script that will upload an object to a S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md new file mode 100755 index 0000000000..92dd1ccb41 --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -0,0 +1,90 @@ +--- +title: 'uploadPart' +head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' +description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +--- + +# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) + +`S3Client.uploadPart` uploads a part to multipart upload in a bucket. + +| Parameter | Type | Description | +| :--------- | :-------------------- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the object to upload. | +| uploadId | string | UploadId of the multipart upload. | +| partNumber | number | The Part number of the Part to upload. | +| data | string \| ArrayBuffer | Content of the part to upload. | + +### Returns + +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md deleted file mode 100644 index d422aa0459..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'SQSClient.listQueues()' -head_title: 'SQSClient.listQueues()' -slug: 'sqsclient-listqueues' -description: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" -excerpt: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" ---- - -# SQSClient.listQueues() - -`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | - -### Returns - -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // List all queues in the AWS account - const queuesResponse = await sqs.listQueues() - - // If our test queue does not exist, abort the execution. - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md deleted file mode 100644 index 8d34b18c8f..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'SQSClient.sendMessage()' -head_title: 'SQSClient.sendMessage()' -slug: 'sqsclient-sendmessage' -description: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" -excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" ---- - -# SQSClient.sendMessage() - -`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | -| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | -| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | - -#### SendMessageOptions - -| Name | Type | Description | -| :------------------------ | :----- | :---------------------------------------------------------------------------------------------- | -| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | -| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | -| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | -| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | - -### Returns - -| Type | Description | -| :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // If our test queue does not exist, abort the execution. - const queuesResponse = await sqs.listQueues() - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, 'test', { - messageAttributes: { - 'test-string': { - type: 'String', - value: 'test' - }, - 'test-number': { - type: 'Number', - value: '23' - }, - 'test-binary': { - type: 'Binary', - value: 'dGVzdA==' - } - } - }); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/_index.md index 39f426c236..ef4f597326 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/_index.md @@ -16,10 +16,10 @@ With it, the user can send messages to specified queues and list available queue ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | -| [`sendMessage`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 sendMessage) | Delivers a message to the specified queue. | -| [`listQueues`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 listQueues) | Returns a list of your queues in the current region. | +| Function | Description | +| :----------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | +| [sendMessage](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/sendmessage) | Delivers a message to the specified queue. | +| [listQueues](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/listqueues) | Returns a list of your queues in the current region. | ### Throws diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md new file mode 100644 index 0000000000..be7e54c381 --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -0,0 +1,57 @@ +--- +title: 'listQueues' +head_title: 'SQSClient.listQueues()' +description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +--- + +# SQSClient.listQueues() + +`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. + +### Parameters + +| Name | Type | Description | +| :-------- | :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // List all queues in the AWS account + const queuesResponse = await sqs.listQueues(); + + // If our test queue does not exist, abort the execution. + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, JSON.stringify({ value: '123' })); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md new file mode 100644 index 0000000000..53e36ccbb7 --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -0,0 +1,81 @@ +--- +title: 'sendMessage' +head_title: 'SQSClient.sendMessage()' +description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +--- + +# SQSClient.sendMessage() + +`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. + +### Parameters + +| Name | Type | Description | +| :------------ | :--------------------------------------------------- | :--------------------------------------------------------------------------------------------------- | +| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | +| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | +| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | + +#### SendMessageOptions + +| Name | Type | Description | +| :----------------------- | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | +| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | +| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | +| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // If our test queue does not exist, abort the execution. + const queuesResponse = await sqs.listQueues(); + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, 'test', { + messageAttributes: { + 'test-string': { + type: 'String', + value: 'test', + }, + 'test-number': { + type: 'Number', + value: '23', + }, + 'test-binary': { + type: 'Binary', + value: 'dGVzdA==', + }, + }, + }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md similarity index 84% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md index 9f84df3426..848258797c 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -7,10 +7,10 @@ description: 'Secret is returned by the SecretsManagerClient.* methods who query # Secret -Secret is returned by the SecretsManagerClient.* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets/), -[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret), -[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret), and -[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. +Secret is returned by the SecretsManagerClient.\* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets/), +[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret), +[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret), and +[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. | Name | Type | Description | | :----------------------- | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | @@ -58,4 +58,3 @@ export default async function () { _A k6 script that will query the user's secrets and print a test secret's value_ {{< /code >}} - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md index 4e8b408c48..a9f3ce9819 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md @@ -15,13 +15,13 @@ With it, you can perform several operations such as listing, creating and downlo ### Methods -| Function | Description | -| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | -| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets) | List secrets owned by the authenticated user | -| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret) | Download a secret | -| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret) | Create a new secret | -| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) | Update a secret | -| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-deletesecret) | Delete a secret | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------- | +| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets) | List secrets owned by the authenticated user | +| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret) | Download a secret | +| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret) | Create a new secret | +| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) | Update a secret | +| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/deletesecret) | Delete a secret | ### Throws diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md similarity index 85% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md index b078ed890e..6f0afe7f7b 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' +title: 'createSecret' head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' -slug: 'secretsmanagerclient-createsecret' description: 'SecretsManagerClient.createSecret creates a new secret' --- @@ -16,13 +15,13 @@ description: 'SecretsManagerClient.createSecret creates a new secret' | name | string | The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. | | secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value. | | description | string | The description of the 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. | +| 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 | -| :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) object that contains the details of the created secret. | ### Example @@ -58,4 +57,4 @@ export default async function () { _A k6 script that will create a secret in AWS secrets manager_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md similarity index 72% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md index e43adb5bf0..0a11bd591a 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' +title: 'deleteSecret' head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' -slug: 'secretsmanagerclient-deletesecret' description: 'SecretsManagerClient.deleteSecret deletes a secret' --- @@ -11,9 +10,9 @@ description: 'SecretsManagerClient.deleteSecret deletes a secret' ### Parameters -| Parameter | Type | Description | -| :-------- | :---------------------------------------- | :--------------------------------------- | -| secretID | string | The ARN or name of the secret to update. | +| 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 @@ -55,4 +54,3 @@ export default async function () { _A k6 script that will delete a secret in AWS secrets manager_ {{< /code >}} - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md similarity index 71% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md index 9b54abbc43..3cd399502c 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.getSecret(secretID)' +title: 'getSecret' head_title: 'SecretsManagerClient.getSecret(secretID)' -slug: 'secretsmanagerclient-getsecret' description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' --- @@ -9,14 +8,14 @@ description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from A `SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. -| Parameter | Type | Description | -| :--------- | :----- | :------------------------------------------- | -| secretID | string | The ARN or name of the secret to retrieve. | +| Parameter | Type | Description | +| :-------- | :----- | :----------------------------------------- | +| secretID | string | The ARN or name of the secret to retrieve. | ### Returns -| Type | Description | -| :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | ### Example @@ -54,4 +53,3 @@ export default async function () { _A k6 script that will download a user's secret from AWS secrets manager_ {{< /code >}} - diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md similarity index 78% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md index 78ced1a9c0..27586084ff 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.listSecrets()' +title: 'listSecrets' head_title: 'SecretsManagerClient.listSecrets()' -slug: 'secretsmanagerclient-listsecrets' description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' --- @@ -11,8 +10,8 @@ description: 'SecretsManagerClient.listSecrets lists the secrets the authenticat ### Returns -| Type | Description | -| :--------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/secretsmanagerclient/secret)>> | A Promise that fulfills with an array of [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | ### Example diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md similarity index 84% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md index 102f760d1e..1d87a33197 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' +title: 'putSecretValue' head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' -slug: 'secretsmanagerclient-putsecretvalue' description: "SecretsManagerClient.putSecretValue updates an existing secret's value" --- @@ -13,13 +12,13 @@ description: "SecretsManagerClient.putSecretValue updates an existing secret's v | :------------------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | secretID | string | The ARN or name of the secret to update. | | secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret 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. | +| 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 | -| :--- | ----------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with the updated [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret). | ### Example @@ -63,4 +62,4 @@ export default async function () { _A k6 script that will update a secret's value in AWS secrets manager_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 presign().md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 presign().md deleted file mode 100644 index 707b73432f..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 presign().md +++ /dev/null @@ -1,202 +0,0 @@ ---- -title: 'presign' -head_title: 'presign' -slug: 'presign' -description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' ---- - -# presign - -`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. - -### Parameters - -The first parameter of the `presign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | - -You can provide further options and override SignatureV4 options in the context of this specific request. -To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :------------ | :------------------------------------------------------------------------- | -| expiresIn | number | The number of seconds before the pre-signed URL expires | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -The `presign` operation returns an Object with the following properties. - -| Property | Type | Description | -| :------- | :----- | :------------------------------------------------------------------------- | -| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | -| url | string | The pre-signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' -import { check } from 'k6' - -import { - AWSConfig, - SignatureV4, - AMZ_CONTENT_SHA256_HEADER, - UNSIGNED_PAYLOAD, -} 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - // In order to be able to produce pre-signed URLs, - // we need to instantiate a SignatureV4 object. - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - // We can now use the signer to produce a pre-signed URL. - const signedRequest = signer.presign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'my-bucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/my-file.txt', - - /** - * The headers we will be sending in the request. - * - * Note that in the specific case of this example, requesting - * an object from S3, we want to set the `x-amz-content-sha256` - * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload - * hash calculation, and communicate that value instead, as specified. - */ - headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, - }, - - /** - * (optional) pre-sign operation options. - */ - { - /** - * The number of seconds before the pre-signed URL expires - */ - expiresIn: 86400, - - /** - * A set of strings whose representing headers that should not be hoisted - * to pre-signed request's query string. If not supplied, the pre-signer - * moves all the AWS-specific headers (starting with `x-amz-`) to the request - * query string. If supplied, these headers remain in the pre-signed request's - * header. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unhoistableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that cannot be signed. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unsignableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that should be signed. - * Any values passed here will override those provided via unsignableHeaders, - * allowing them to be signed. - * - * All headers in the provided request will have their names converted to - * lower case before signing. - */ - signableHeaders: new Set(), - - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The signingRegion and signingService options let the user - * specify a different region or service to pre-sign the request for. - */ - signingRegion: 'us-east-1', - } - ) - - console.log(`presigned URL: ${signedRequest.url}`) - - /** - * Our URL is now ready to be used. - */ - const res = http.get(signedRequest.url, { - headers: signedRequest.headers, - }) - - check(res, { 'status is 200': (r) => r.status === 200 }) -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 sign().md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 sign().md deleted file mode 100644 index b3588fccd6..0000000000 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/00 sign().md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: 'sign' -head_title: 'sign' -slug: 'sign' -description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' ---- - -# sign - -`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. - -### Parameters - -The first parameter of the `sign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | -| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | -| query (optional) | `Object.>` | The optional query parameters of the HTTP request | - - -You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :---------- | :------------------------------------------------------------------------- | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -| Property | Type | Description | -| :------- | :----- | :---------------------------------------------------------------------- | -| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | -| url | string | The signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' - -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - /** - * In order to be able to sign an HTTP request's, - * we need to instantiate a SignatureV4 object. - */ - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - /** - * The sign operation will return a new HTTP request with the - * AWS signature v4 protocol headers added. It returns an Object - * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` - * properties, ready to use in the context of k6's http call. - */ - const signedRequest = signer.sign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'mybucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/myfile.txt', - - /** - * The headers we will be sending in the request. - */ - headers: {}, - }, - - /** - * (optional) Signature operation options allows to override the - * SignatureV4's options in the context of this specific request. - */ - { - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The region name to sign the request. It will override the signing region of the - * signer in current invocation - */ - signingRegion: 'us-east-1', - } - ) - - http.get(signedRequest.url, { headers: signedRequest.headers }) -} -``` - -{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/_index.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/_index.md index b35913292f..4303527393 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/_index.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/_index.md @@ -29,10 +29,10 @@ Instantiating a new `SignatureV4` requires a single options object argument with -| Method | Description | -| :---------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | -| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 sign()) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | -| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 presign()) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | +| Method | Description | +| :------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | +| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/sign) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | +| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/presign) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/presign.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/presign.md new file mode 100644 index 0000000000..c9aa2031fb --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/presign.md @@ -0,0 +1,202 @@ +--- +title: 'presign' +head_title: 'presign' +slug: 'presign' +description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' +--- + +# presign + +`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. + +### Parameters + +The first parameter of the `presign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :------- | :----------------------- | :---------------------------------- | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | + +You can provide further options and override SignatureV4 options in the context of this specific request. +To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| expiresIn | number | The number of seconds before the pre-signed URL expires | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +The `presign` operation returns an Object with the following properties. + +| Property | Type | Description | +| :------- | :----- | :------------------------------------------------------------------------ | +| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | +| url | string | The pre-signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; +import { check } from 'k6'; + +import { + AWSConfig, + SignatureV4, + AMZ_CONTENT_SHA256_HEADER, + UNSIGNED_PAYLOAD, +} 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + // In order to be able to produce pre-signed URLs, + // we need to instantiate a SignatureV4 object. + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + // We can now use the signer to produce a pre-signed URL. + const signedRequest = signer.presign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'my-bucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/my-file.txt', + + /** + * The headers we will be sending in the request. + * + * Note that in the specific case of this example, requesting + * an object from S3, we want to set the `x-amz-content-sha256` + * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload + * hash calculation, and communicate that value instead, as specified. + */ + headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, + }, + + /** + * (optional) pre-sign operation options. + */ + { + /** + * The number of seconds before the pre-signed URL expires + */ + expiresIn: 86400, + + /** + * A set of strings whose representing headers that should not be hoisted + * to pre-signed request's query string. If not supplied, the pre-signer + * moves all the AWS-specific headers (starting with `x-amz-`) to the request + * query string. If supplied, these headers remain in the pre-signed request's + * header. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unhoistableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that cannot be signed. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unsignableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that should be signed. + * Any values passed here will override those provided via unsignableHeaders, + * allowing them to be signed. + * + * All headers in the provided request will have their names converted to + * lower case before signing. + */ + signableHeaders: new Set(), + + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The signingRegion and signingService options let the user + * specify a different region or service to pre-sign the request for. + */ + signingRegion: 'us-east-1', + } + ); + + console.log(`presigned URL: ${signedRequest.url}`); + + /** + * Our URL is now ready to be used. + */ + const res = http.get(signedRequest.url, { + headers: signedRequest.headers, + }); + + check(res, { 'status is 200': (r) => r.status === 200 }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/sign.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/sign.md new file mode 100644 index 0000000000..da7132db3a --- /dev/null +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SignatureV4/sign.md @@ -0,0 +1,145 @@ +--- +title: 'sign' +head_title: 'sign' +slug: 'sign' +description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' +--- + +# sign + +`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. + +### Parameters + +The first parameter of the `sign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :--------------- | :------------------------------------------ | :------------------------------------------------ | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | +| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | +| query (optional) | `Object.>` | The optional query parameters of the HTTP request | + +You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +| Property | Type | Description | +| :------- | :----- | :---------------------------------------------------------------------- | +| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | +| url | string | The signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; + +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + /** + * In order to be able to sign an HTTP request's, + * we need to instantiate a SignatureV4 object. + */ + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + /** + * The sign operation will return a new HTTP request with the + * AWS signature v4 protocol headers added. It returns an Object + * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` + * properties, ready to use in the context of k6's http call. + */ + const signedRequest = signer.sign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'mybucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/myfile.txt', + + /** + * The headers we will be sending in the request. + */ + headers: {}, + }, + + /** + * (optional) Signature operation options allows to override the + * SignatureV4's options in the context of this specific request. + */ + { + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The region name to sign the request. It will override the signing region of the + * signer in current invocation + */ + signingRegion: 'us-east-1', + } + ); + + http.get(signedRequest.url, { headers: signedRequest.headers }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md similarity index 99% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md index 98e35dee3d..075c991914 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -68,4 +68,4 @@ export default async function () { _A k6 script querying a user Systems Manager Service parameter_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md similarity index 75% rename from docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md rename to docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md index 5e1e6cbbcd..8f4299ec24 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -1,5 +1,5 @@ --- -title: 'SystemsManagerClient.getParameter()' +title: 'getParameter' head_title: 'SystemsManagerClient.getParameter()' slug: 'systemsmanagerclient-getparameter' description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" @@ -11,8 +11,8 @@ description: "SystemsManagerClient.getParameter gets a Systems Manager parameter ### Returns -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [`Promise`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | A Promise that fulfills with an array of [`SystemsManagerParameter`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | ### Example @@ -63,5 +63,3 @@ export default async function () { _A k6 script querying a user's Systems Manager Service parameter_ {{< /code >}} - - From f945178d3fc417349330d93fbdf83d60b48a5af0 Mon Sep 17 00:00:00 2001 From: oleiade Date: Tue, 12 Dec 2023 11:43:04 +0100 Subject: [PATCH 2/5] Fix v0.48.x aws links --- .../jslib/aws/EventBridgeClient/putEvents.md | 58 +++-- .../{90 KMSDataKey.md => KMSDataKey.md} | 9 +- .../aws/KMSClient/{90 KMSKey.md => KMSKey.md} | 3 +- .../jslib/aws/KMSClient/_index.md | 10 +- ... generateDataKey.md => generateDataKey.md} | 13 +- .../KMSClient/{00 listKeys.md => listKeys.md} | 9 +- ...Upload(bucketName, objectKey, uploadId).md | 56 ----- ...bucketName, objectKey, uploadId, parts).md | 101 --------- ...eMultipartUpload(bucketName, objectKey).md | 53 ----- ... putObject(bucketName, objectKey, data).md | 70 ------ ...ctKey, uploadId, partNumber, data) copy.md | 91 -------- .../aws/S3Client/90 S3MultipartUpload.md | 48 ----- .../jslib/aws/S3Client/90 S3Part.md | 82 ------- .../aws/S3Client/{90 Bucket.md => Bucket.md} | 5 +- .../aws/S3Client/{90 Object.md => Object.md} | 22 +- .../jslib/aws/S3Client/S3Part.md | 82 +++++++ .../jslib/aws/S3Client/_index.md | 45 ++-- .../aws/S3Client/abortMultipartUpload.md | 55 +++++ .../aws/S3Client/completeMultipartUpload.md | 100 +++++++++ .../{00 copyObject.md => copyObject.md} | 12 +- .../aws/S3Client/createMultipartUpload.md | 52 +++++ ...ketName, objectKey).md => deleteObject.md} | 19 +- ...bucketName, objectKey).md => getObject.md} | 9 +- .../{00 listBuckets().md => listBuckets.md} | 9 +- ...ucketName, [prefix]).md => listObjects.md} | 9 +- .../jslib/aws/S3Client/putObject.md | 69 ++++++ .../jslib/aws/S3Client/uploadPart.md | 90 ++++++++ .../jslib/aws/SQSClient/00 listQueues.md | 58 ----- .../jslib/aws/SQSClient/00 sendMessage.md | 82 ------- .../jslib/aws/SQSClient/_index.md | 8 +- .../jslib/aws/SQSClient/listQueues.md | 58 +++++ .../jslib/aws/SQSClient/sendMessage.md | 82 +++++++ .../{99 Secret.md => Secret.md} | 10 +- .../jslib/aws/SecretsManagerClient/_index.md | 14 +- ...versionID], [tags]).md => createSecret.md} | 11 +- .../{00 deleteSecret.md => deleteSecret.md} | 10 +- ...00 getSecret(secretID).md => getSecret.md} | 14 +- .../{00 listSecrets().md => listSecrets.md} | 7 +- ...ing, [versionID]).md => putSecretValue.md} | 11 +- .../jslib/aws/SignatureV4/00 presign().md | 202 ------------------ .../jslib/aws/SignatureV4/00 sign().md | 146 ------------- .../jslib/aws/SignatureV4/_index.md | 8 +- .../jslib/aws/SignatureV4/presign.md | 202 ++++++++++++++++++ .../jslib/aws/SignatureV4/sign.md | 145 +++++++++++++ ...arameter.md => SystemsManagerParameter.md} | 2 +- .../jslib/aws/SystemsManagerClient/_index.md | 11 +- .../{00 getParameter.md => getParameter.md} | 9 +- 47 files changed, 1101 insertions(+), 1170 deletions(-) rename docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/{90 KMSDataKey.md => KMSDataKey.md} (89%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/{90 KMSKey.md => KMSKey.md} (98%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/{00 generateDataKey.md => generateDataKey.md} (77%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/{00 listKeys.md => listKeys.md} (79%) delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md delete mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3Part.md rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{90 Bucket.md => Bucket.md} (83%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{90 Object.md => Object.md} (80%) create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{00 copyObject.md => copyObject.md} (85%) create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{00 deleteObject(bucketName, objectKey).md => deleteObject.md} (70%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{00 getObject(bucketName, objectKey).md => getObject.md} (80%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{00 listBuckets().md => listBuckets.md} (78%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/{00 listObjects(bucketName, [prefix]).md => listObjects.md} (81%) create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md create mode 100755 docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md delete mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md delete mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md create mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md create mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{99 Secret.md => Secret.md} (83%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{00 createSecret(name, secretString, description, [versionID], [tags]).md => createSecret.md} (85%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{00 deleteSecret.md => deleteSecret.md} (72%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{00 getSecret(secretID).md => getSecret.md} (71%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{00 listSecrets().md => listSecrets.md} (78%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/{00 putSecretValue(secretID, secretString, [versionID]).md => putSecretValue.md} (84%) delete mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 presign().md delete mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 sign().md create mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/presign.md create mode 100644 docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/sign.md rename docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/{90 SystemsManagerParameter.md => SystemsManagerParameter.md} (99%) rename docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/{00 getParameter.md => getParameter.md} (75%) diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index 994492d6d4..cb0399ccca 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -1,7 +1,6 @@ --- -title: 'EventBridgeClient.putEvents' +title: 'putEvents' head_title: 'EventBridgeClient.putEvents' -slug: 'eventbridgeclient-putevents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' --- @@ -12,33 +11,32 @@ excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' ### Parameters -| Parameter | Type | Description | -| :------------ | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | +| Parameter | Type | Description | +| :-------- | :-------------------------------- | :------------------------------------------------------- | +| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | #### PutEventsInput -| Parameter | Type | Description | -| :-------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | -| EndpointId | string (optional) | The ID of the target to receive the event. | +| Parameter | Type | Description | +| :--------- | :-------------------------------------- | :------------------------------------------------------- | +| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | +| EndpointId | string (optional) | The ID of the target to receive the event. | #### EventBridgeEntry -| Parameter | Type | Description | -| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------------- | -| Source | string | The source of the event. | -| Detail | object | A JSON object containing event data. | -| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | -| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | -| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | - +| Parameter | Type | Description | +| :----------- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Source | string | The source of the event. | +| Detail | object | A JSON object containing event data. | +| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | +| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | +| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | ### Returns -| Type | Description | -| :-------------- | :---------------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | +| Type | Description | +| :-------------- | :---------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | ### Example @@ -56,19 +54,19 @@ const awsConfig = new AWSConfig({ const eventBridge = new EventBridgeClient(awsConfig); const eventEntry = { - Source: "my.source", - Detail: { - key: "value" - }, - DetailType: "MyDetailType", - Resources: ["resource-arn"], + Source: 'my.source', + Detail: { + key: 'value', + }, + DetailType: 'MyDetailType', + Resources: ['resource-arn'], }; export default async function () { - await eventBridge.putEvents({ - Entries: [eventEntry] - }); + await eventBridge.putEvents({ + Entries: [eventEntry], + }); } ``` -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md similarity index 89% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md index baffa9e1e3..f4b836b143 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -11,10 +11,10 @@ description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that quer The KMSDataKey object describes an Amazon Key Management Service data key. For instance, the [`generateDataKey`](https://grafana.com/docs/k6//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. | +| 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 @@ -53,4 +53,3 @@ export default async function () { _A k6 script that generating a data key from an AWS Key Management Service key_ {{< /code >}} - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md similarity index 98% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md index 75270b4b55..3651e3721d 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/90 KMSKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -1,6 +1,5 @@ --- title: 'KMSKey' -slug: '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' @@ -47,4 +46,4 @@ export default async function () { _A k6 script querying the user's Key Management Service keys and verifying their test key exists_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/_index.md index 5fca4ba3d6..2b533eb675 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/_index.md @@ -18,10 +18,10 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | -| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 generateDataKey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | +| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/generatedatakey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | ### Throws @@ -63,7 +63,7 @@ export default async function (data) { export function handleSummary(data) { return { - stdout: textSummary(data, { indent: ' ', enableColors: true }), + 'stdout': textSummary(data, { indent: ' ', enableColors: true }), './test-run.key': data.dataKey, }; } diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md similarity index 77% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md index e350f54bc7..a217e48cfa 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -1,7 +1,6 @@ --- -title: 'KMSClient.generateDataKey' +title: 'generateDataKey' head_title: 'KMSClient.generateDataKey' -slug: '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' --- @@ -12,15 +11,15 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi ### Parameters -| Name | Type | Description | -| :--- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 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 | -| :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | +| Type | Description | +| :------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[KMSDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey) object. | ### Example @@ -59,5 +58,3 @@ export default async function () { _A k6 script that generating a data key from an AWS Key Management Service key_ {{< /code >}} - - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md similarity index 79% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md index 0b89ce35cc..26337a008c 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/00 listKeys.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -1,7 +1,6 @@ --- -title: 'KMSClient.listKeys()' +title: 'listKeys' head_title: 'KMSClient.listKeys()' -slug: '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" --- @@ -12,8 +11,8 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account ### Returns -| Type | Description | -| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[KMSKey[]](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/kmskey) objects. | ### Example @@ -49,5 +48,3 @@ export default async function () { _A k6 script querying the user's Key Management Service keys and verifying their test key exists_ {{< /code >}} - - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md deleted file mode 100755 index 04ec6b6d2a..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -slug: 's3client-abortmultipartupload' -description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' ---- - -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) - -`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 - -{{< 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload and abort the multipart_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md deleted file mode 100755 index e41ff6f807..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -slug: 's3client-completemultipartupload' -description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' ---- - -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) - -`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. | -| objectKey | string | Name of the uploaded object. | -| uploadId | number | UploadId of the multipart upload to complete. | -| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // List the buckets the AWS authentication configuration - // gives us access to. - const buckets = await s3.listBuckets(); - - // If our test bucket does not exist, abort the execution. - if (buckets.filter((b) => b.name === testBucketName).length == 0) { - exec.test.abort(); - } - - // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md deleted file mode 100755 index 717866d28b..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -slug: 's3client-createmultipartupload' -description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' ---- - -# S3Client.createMultipartUpload(bucketName, objectKey) - -`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the uploaded object. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | - -### 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md deleted file mode 100755 index 7c61a48733..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: 'S3Client.putObject(bucketName, objectKey, data)' -head_title: 'S3Client.putObject(bucketName, objectKey, data)' -slug: 's3client-putobject' -description: 'S3Client.putObject uploads an object to a bucket' ---- - -# S3Client.putObject(bucketName, objectKey, data) - -`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. | -| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | - -#### PutObjectParams - -| Name | Type | Description | -| :-------------------- | :---------------- | :---------- | -| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | -| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | -| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | -| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | -| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | - -### Returns - -| Type | Description | -| :-------------- | :-------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | - -### 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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; -const testFile = open('./bonjour.txt', 'r'); - -export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile, { - contentType: 'text/plain', - contentLength: testFile.length, - }); - - // And let's redownload it to verify it's correct - const obj = await s3.getObject(testBucketName, testFileKey); - console.log(JSON.stringify(obj)); -} -``` - -_A k6 script that will upload an object to a S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md deleted file mode 100755 index 6fa49213ae..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -slug: 's3client-uploadpart' -description: 'S3Client.uploadPart a part in a multipart upload to a bucket' ---- - -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) - -`S3Client.uploadPart` uploads a part to multipart upload in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the object to upload. | -| uploadId | string | UploadId of the multipart upload. | -| partNumber | number | The Part number of the Part to upload. | -| data | string \| ArrayBuffer | Content of the part to upload. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md deleted file mode 100755 index 5cb0daa2e8..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: 'S3MultipartUpload' -head_title: 'S3MultipartUpload' -slug: 's3multipartupload' -description: 'S3MultipartUpload is returned by the S3Client.createMultipartUpload method when creating a multipart upload.' ---- - -# S3MultipartUpload - -S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectKey)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-createmultipartupload/) method when creating a [multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html). - -| Name | Type | Description | -| :------------------------------ | :----- | :----------------------------- | -| `S3MultipartUpload.key` | string | The S3 Multipart object's key | -| `S3MultipartUpload.uploadId` | Date | The S3 Multipart upload Id | - -### 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - console.log(multipartUpload.uploadId); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload and log the multipart `uploadId` and abort the multipart upload_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3Part.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3Part.md deleted file mode 100755 index 067ffe775d..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 S3Part.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'S3Part' -head_title: 'S3Part' -slug: 's3part' -description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' ---- - -# S3Part - -S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-uploadpart/) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. - -| Name | Type | Description | -| :-------------------- | :----- | :---------------------- | -| `S3Part.partNumber` | number | The S3 Part'number | -| `S3Part.eTag ` | String | The S3 Part's etag | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Bucket.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md similarity index 83% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Bucket.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md index 1eeb62f020..491ca77260 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Bucket.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md @@ -1,13 +1,12 @@ --- title: 'Bucket' head_title: 'Bucket' -slug: '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. +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 | | :-------------------- | :----- | :--------------------------- | @@ -39,4 +38,4 @@ export default async function () { _A k6 script that will query the user's S3 buckets and print all of their metadata_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Object.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md similarity index 80% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Object.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md index a49ed2dd7a..e9891f93bb 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/90 Object.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md @@ -1,23 +1,22 @@ --- title: 'Object' head_title: 'Object' -slug: 'object' description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." --- # Object -Object is returned by the S3Client.\* methods that query S3 buckets' objects. Namely, [`listObjects`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects), [`getObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-getobject), [`putObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-putobject), -and [`deleteObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-deleteobject). The Object construct describes an Amazon S3 object. +Object is returned by the S3Client.\* methods that query S3 buckets' objects. Namely, [`listObjects`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listobjects), [`getObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/getobject), [`putObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/putobject), +and [`deleteObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/deleteobject). The Object construct describes an Amazon S3 object. -| Name | Type | Description | -| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Object.key` | string | The S3 object's name. | -| `Object.lastModified` | number | The S3 object's last modification date. | -| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | -| `Object.size` | size | The S3 object's size in bytes. | -| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | -| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | +| Name | Type | Description | +| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Object.key` | string | The S3 object's name. | +| `Object.lastModified` | number | The S3 object's last modification date. | +| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | +| `Object.size` | size | The S3 object's size in bytes. | +| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | +| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | ### Example @@ -59,4 +58,3 @@ export default async function () { _A k6 script that will query a S3 bucket's objects and print its content and metadata_ {{< /code >}} - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md new file mode 100755 index 0000000000..97fc171d0e --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md @@ -0,0 +1,82 @@ +--- +title: 'S3Part' +head_title: 'S3Part' +slug: 's3part' +description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +--- + +# S3Part + +S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/uploadpart) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. + +| Name | Type | Description | +| :-------------------- | :----- | :----------------- | +| `S3Part.partNumber` | number | The S3 Part'number | +| `S3Part.eTag ` | String | The S3 Part's etag | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/_index.md index 633be6816c..e1f2520bb5 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/_index.md @@ -18,18 +18,18 @@ Both the dedicated `s3.js` jslib bundle and the all-encompassing `aws.js` bundle ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | -| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 listBuckets()) | List the buckets the authenticated user has access to | -| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects/) | List the objects contained in a bucket | -| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 getObject(bucketName, objectKey)) | Download an object from a bucket | -| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 putObject(bucketName, objectKey, data)) | Upload an object to a bucket | -| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 deleteObject(bucketName, objectKey)) | Delete an object from a bucket | -| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 copyObject) | Copy an object from one bucket to another | -| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 createMultipartUpload(bucketName, objectKey)) | Create a multipart upload for a given objectKey to a bucket | -| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy) | Upload a part in a multipart upload | -| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts)) | Complete a previously assembled multipart upload | -| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 abortMultipartUpload(bucketName, objectKey, uploadId)) | Abort a multipart upload | +| Function | Description | +| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | +| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listbuckets) | List the buckets the authenticated user has access to | +| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listobjects) | List the objects contained in a bucket | +| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/getobject) | Download an object from a bucket | +| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/putobject) | Upload an object to a bucket | +| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/deleteobject) | Delete an object from a bucket | +| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/copyobject) | Copy an object from one bucket to another | +| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/createmultipartupload) | Create a multipart upload for a given objectKey to a bucket | +| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/uploadpart) | Upload a part in a multipart upload | +| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/completemultipartupload) | Complete a previously assembled multipart upload | +| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/abortmultipartupload) | Abort a multipart upload | ### Throws @@ -145,14 +145,29 @@ export default async function () { // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 1, firstPartData); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 2, secondPartData); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [firstPart, secondPart]); + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); // Let's redownload it verify it's correct, and delete it const obj = await s3.getObject(testBucketName, testFileKey); diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md new file mode 100755 index 0000000000..d63ce836ad --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -0,0 +1,55 @@ +--- +title: 'abortMultipartUpload' +head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' +description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +--- + +# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) + +`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 + +{{< 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload and abort the multipart_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md new file mode 100755 index 0000000000..6546cc335c --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -0,0 +1,100 @@ +--- +title: 'completeMultipartUpload' +head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' +description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +--- + +# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) + +`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. | +| objectKey | string | Name of the uploaded object. | +| uploadId | number | UploadId of the multipart upload to complete. | +| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // List the buckets the AWS authentication configuration + // gives us access to. + const buckets = await s3.listBuckets(); + + // If our test bucket does not exist, abort the execution. + if (buckets.filter((b) => b.name === testBucketName).length == 0) { + exec.test.abort(); + } + + // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 copyObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md similarity index 85% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 copyObject.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md index 07b0f65d74..b3dbbaebf5 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 copyObject.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.copyObject' +title: 'copyObject' head_title: 'S3Client.copyObject' -slug: 's3client-copyobject' description: 'S3Client.copyObject copies an object from a bucket to another' --- @@ -33,7 +32,6 @@ import exec from 'k6/execution'; 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, @@ -47,11 +45,11 @@ const testFileKey = 'bonjour.txt'; const testDestinationBucketName = 'test-jslib-aws-destination'; export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile); + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile); - // Let's create our destination bucket - await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); + // Let's create our destination bucket + await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); } ``` diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md new file mode 100755 index 0000000000..b0ce51a4d2 --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -0,0 +1,52 @@ +--- +title: 'createMultipartUpload' +head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' +description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +--- + +# S3Client.createMultipartUpload(bucketName, objectKey) + +`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. + +| Parameter | Type | Description | +| :--------- | :----- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the uploaded object. | + +### Returns + +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | + +### 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md similarity index 70% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md index 09019d3d7f..154f85075e 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.deleteObject(bucketName, objectKey)' +title: 'deleteObject' head_title: 'S3Client.deleteObject(bucketName, objectKey)' -slug: 's3client-deleteobject' description: 'S3Client.deleteObject deletes an object from a bucket' --- @@ -11,16 +10,16 @@ description: '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. | +| 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. | +| Type | Description | +| :-------------- | :---------------------------------------------------------------- | +| `Promise` | A promise that fulfills when the object has been deleted from S3. | ### Example @@ -55,4 +54,4 @@ export default async function () { _A k6 script that will delete an object from a S3 bucket_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md similarity index 80% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md index a273220fb4..0d66a1c4c5 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.getObject(bucketName, objectKey)' +title: 'getObject' head_title: 'S3Client.getObject(bucketName, objectKey)' -slug: 's3client-getobject' description: 'S3Client.getObject downloads an object from a bucket' --- @@ -18,8 +17,8 @@ description: 'S3Client.getObject downloads an object from a bucket' ### Returns -| Type | Description | -| :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | ### Example @@ -57,4 +56,4 @@ export default async function () { _A k6 script that will download an object from a bucket_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md similarity index 78% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md index c49f247344..25272099ea 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listBuckets().md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.listBuckets()' +title: 'listBuckets' head_title: 'S3Client.listBuckets()' -slug: 's3client-listbuckets' description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' --- @@ -11,8 +10,8 @@ description: 'S3Client.listBuckets lists the buckets the authenticated user has ### Returns -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/bucket) objects. | ### Example @@ -48,5 +47,3 @@ export default async function () { ``` {{< /code >}} - - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md similarity index 81% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md index aed563dd21..3500c002e2 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md @@ -1,7 +1,6 @@ --- -title: 'S3Client.listObjects(bucketName, [prefix])' +title: 'listObjects' head_title: 'S3Client.listObjects(bucketName, [prefix])' -slug: 's3client-listobjects' description: 'S3Client.listObjects lists the objects contained in a bucket' --- @@ -18,8 +17,8 @@ description: 'S3Client.listObjects lists the objects contained in a bucket' ### Returns -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) objects. | ### Example @@ -55,4 +54,4 @@ export default async function () { } ``` -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md new file mode 100755 index 0000000000..e3961bcebb --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md @@ -0,0 +1,69 @@ +--- +title: 'putObject' +head_title: 'S3Client.putObject(bucketName, objectKey, data)' +description: 'S3Client.putObject uploads an object to a bucket' +--- + +# S3Client.putObject(bucketName, objectKey, data) + +`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. | +| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | + +#### PutObjectParams + +| Name | Type | Description | +| :------------------- | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | +| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | +| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | +| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | +| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | + +### Returns + +| Type | Description | +| :-------------- | :-------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | + +### 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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; +const testFile = open('./bonjour.txt', 'r'); + +export default async function () { + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile, { + contentType: 'text/plain', + contentLength: testFile.length, + }); + + // And let's redownload it to verify it's correct + const obj = await s3.getObject(testBucketName, testFileKey); + console.log(JSON.stringify(obj)); +} +``` + +_A k6 script that will upload an object to a S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md new file mode 100755 index 0000000000..92dd1ccb41 --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -0,0 +1,90 @@ +--- +title: 'uploadPart' +head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' +description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +--- + +# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) + +`S3Client.uploadPart` uploads a part to multipart upload in a bucket. + +| Parameter | Type | Description | +| :--------- | :-------------------- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the object to upload. | +| uploadId | string | UploadId of the multipart upload. | +| partNumber | number | The Part number of the Part to upload. | +| data | string \| ArrayBuffer | Content of the part to upload. | + +### Returns + +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md deleted file mode 100644 index d422aa0459..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 listQueues.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'SQSClient.listQueues()' -head_title: 'SQSClient.listQueues()' -slug: 'sqsclient-listqueues' -description: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" -excerpt: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" ---- - -# SQSClient.listQueues() - -`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | - -### Returns - -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // List all queues in the AWS account - const queuesResponse = await sqs.listQueues() - - // If our test queue does not exist, abort the execution. - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md deleted file mode 100644 index 8d34b18c8f..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/00 sendMessage.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'SQSClient.sendMessage()' -head_title: 'SQSClient.sendMessage()' -slug: 'sqsclient-sendmessage' -description: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" -excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" ---- - -# SQSClient.sendMessage() - -`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | -| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | -| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | - -#### SendMessageOptions - -| Name | Type | Description | -| :------------------------ | :----- | :---------------------------------------------------------------------------------------------- | -| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | -| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | -| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | -| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | - -### Returns - -| Type | Description | -| :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // If our test queue does not exist, abort the execution. - const queuesResponse = await sqs.listQueues() - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, 'test', { - messageAttributes: { - 'test-string': { - type: 'String', - value: 'test' - }, - 'test-number': { - type: 'Number', - value: '23' - }, - 'test-binary': { - type: 'Binary', - value: 'dGVzdA==' - } - } - }); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/_index.md index 39f426c236..b7681af3d6 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/_index.md @@ -16,10 +16,10 @@ With it, the user can send messages to specified queues and list available queue ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | -| [`sendMessage`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 sendMessage) | Delivers a message to the specified queue. | -| [`listQueues`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 listQueues) | Returns a list of your queues in the current region. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | +| [`sendMessage`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/sendmessage) | Delivers a message to the specified queue. | +| [`listQueues`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/listqueues) | Returns a list of your queues in the current region. | ### Throws diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md new file mode 100644 index 0000000000..50fa5f290f --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -0,0 +1,58 @@ +--- +title: 'listQueues' +head_title: 'SQSClient.listQueues()' +slug: 'sqsclient-listqueues' +description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +--- + +# SQSClient.listQueues() + +`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. + +### Parameters + +| Name | Type | Description | +| :-------- | :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // List all queues in the AWS account + const queuesResponse = await sqs.listQueues(); + + // If our test queue does not exist, abort the execution. + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, JSON.stringify({ value: '123' })); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md new file mode 100644 index 0000000000..473877e93f --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -0,0 +1,82 @@ +--- +title: 'sendMessage' +head_title: 'SQSClient.sendMessage()' +slug: 'sqsclient-sendmessage' +description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +--- + +# SQSClient.sendMessage() + +`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. + +### Parameters + +| Name | Type | Description | +| :------------ | :--------------------------------------------------- | :--------------------------------------------------------------------------------------------------- | +| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | +| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | +| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | + +#### SendMessageOptions + +| Name | Type | Description | +| :----------------------- | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | +| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | +| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | +| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // If our test queue does not exist, abort the execution. + const queuesResponse = await sqs.listQueues(); + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, 'test', { + messageAttributes: { + 'test-string': { + type: 'String', + value: 'test', + }, + 'test-number': { + type: 'Number', + value: '23', + }, + 'test-binary': { + type: 'Binary', + value: 'dGVzdA==', + }, + }, + }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md similarity index 83% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md index 9f84df3426..fb701d0f73 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -1,16 +1,15 @@ --- title: 'Secret' head_title: 'Secret' -slug: 'secret' description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' --- # Secret -Secret is returned by the SecretsManagerClient.* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets/), -[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret), -[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret), and -[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. +Secret is returned by the SecretsManagerClient.\* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets/), +[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret), +[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret), and +[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. | Name | Type | Description | | :----------------------- | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | @@ -58,4 +57,3 @@ export default async function () { _A k6 script that will query the user's secrets and print a test secret's value_ {{< /code >}} - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md index 4e8b408c48..a9f3ce9819 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/_index.md @@ -15,13 +15,13 @@ With it, you can perform several operations such as listing, creating and downlo ### Methods -| Function | Description | -| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | -| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets) | List secrets owned by the authenticated user | -| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret) | Download a secret | -| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret) | Create a new secret | -| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) | Update a secret | -| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-deletesecret) | Delete a secret | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------- | +| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets) | List secrets owned by the authenticated user | +| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret) | Download a secret | +| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret) | Create a new secret | +| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) | Update a secret | +| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/deletesecret) | Delete a secret | ### Throws diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md similarity index 85% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md index b078ed890e..6f0afe7f7b 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' +title: 'createSecret' head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' -slug: 'secretsmanagerclient-createsecret' description: 'SecretsManagerClient.createSecret creates a new secret' --- @@ -16,13 +15,13 @@ description: 'SecretsManagerClient.createSecret creates a new secret' | name | string | The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. | | secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value. | | description | string | The description of the 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. | +| 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 | -| :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) object that contains the details of the created secret. | ### Example @@ -58,4 +57,4 @@ export default async function () { _A k6 script that will create a secret in AWS secrets manager_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md similarity index 72% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md index e43adb5bf0..0a11bd591a 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' +title: 'deleteSecret' head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' -slug: 'secretsmanagerclient-deletesecret' description: 'SecretsManagerClient.deleteSecret deletes a secret' --- @@ -11,9 +10,9 @@ description: 'SecretsManagerClient.deleteSecret deletes a secret' ### Parameters -| Parameter | Type | Description | -| :-------- | :---------------------------------------- | :--------------------------------------- | -| secretID | string | The ARN or name of the secret to update. | +| 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 @@ -55,4 +54,3 @@ export default async function () { _A k6 script that will delete a secret in AWS secrets manager_ {{< /code >}} - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md similarity index 71% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md index 9b54abbc43..3cd399502c 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.getSecret(secretID)' +title: 'getSecret' head_title: 'SecretsManagerClient.getSecret(secretID)' -slug: 'secretsmanagerclient-getsecret' description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' --- @@ -9,14 +8,14 @@ description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from A `SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. -| Parameter | Type | Description | -| :--------- | :----- | :------------------------------------------- | -| secretID | string | The ARN or name of the secret to retrieve. | +| Parameter | Type | Description | +| :-------- | :----- | :----------------------------------------- | +| secretID | string | The ARN or name of the secret to retrieve. | ### Returns -| Type | Description | -| :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | ### Example @@ -54,4 +53,3 @@ export default async function () { _A k6 script that will download a user's secret from AWS secrets manager_ {{< /code >}} - diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md similarity index 78% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md index 78ced1a9c0..27586084ff 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.listSecrets()' +title: 'listSecrets' head_title: 'SecretsManagerClient.listSecrets()' -slug: 'secretsmanagerclient-listsecrets' description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' --- @@ -11,8 +10,8 @@ description: 'SecretsManagerClient.listSecrets lists the secrets the authenticat ### Returns -| Type | Description | -| :--------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| Type | Description | +| :---------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise/javascript-api/jslib/aws/secretsmanagerclient/secret)>> | A Promise that fulfills with an array of [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | ### Example diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md similarity index 84% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md index 102f760d1e..1d87a33197 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -1,7 +1,6 @@ --- -title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' +title: 'putSecretValue' head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' -slug: 'secretsmanagerclient-putsecretvalue' description: "SecretsManagerClient.putSecretValue updates an existing secret's value" --- @@ -13,13 +12,13 @@ description: "SecretsManagerClient.putSecretValue updates an existing secret's v | :------------------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | secretID | string | The ARN or name of the secret to update. | | secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret 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. | +| 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 | -| :--- | ----------- | +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with the updated [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret). | ### Example @@ -63,4 +62,4 @@ export default async function () { _A k6 script that will update a secret's value in AWS secrets manager_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 presign().md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 presign().md deleted file mode 100644 index 707b73432f..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 presign().md +++ /dev/null @@ -1,202 +0,0 @@ ---- -title: 'presign' -head_title: 'presign' -slug: 'presign' -description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' ---- - -# presign - -`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. - -### Parameters - -The first parameter of the `presign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | - -You can provide further options and override SignatureV4 options in the context of this specific request. -To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :------------ | :------------------------------------------------------------------------- | -| expiresIn | number | The number of seconds before the pre-signed URL expires | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -The `presign` operation returns an Object with the following properties. - -| Property | Type | Description | -| :------- | :----- | :------------------------------------------------------------------------- | -| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | -| url | string | The pre-signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' -import { check } from 'k6' - -import { - AWSConfig, - SignatureV4, - AMZ_CONTENT_SHA256_HEADER, - UNSIGNED_PAYLOAD, -} 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - // In order to be able to produce pre-signed URLs, - // we need to instantiate a SignatureV4 object. - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - // We can now use the signer to produce a pre-signed URL. - const signedRequest = signer.presign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'my-bucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/my-file.txt', - - /** - * The headers we will be sending in the request. - * - * Note that in the specific case of this example, requesting - * an object from S3, we want to set the `x-amz-content-sha256` - * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload - * hash calculation, and communicate that value instead, as specified. - */ - headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, - }, - - /** - * (optional) pre-sign operation options. - */ - { - /** - * The number of seconds before the pre-signed URL expires - */ - expiresIn: 86400, - - /** - * A set of strings whose representing headers that should not be hoisted - * to pre-signed request's query string. If not supplied, the pre-signer - * moves all the AWS-specific headers (starting with `x-amz-`) to the request - * query string. If supplied, these headers remain in the pre-signed request's - * header. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unhoistableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that cannot be signed. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unsignableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that should be signed. - * Any values passed here will override those provided via unsignableHeaders, - * allowing them to be signed. - * - * All headers in the provided request will have their names converted to - * lower case before signing. - */ - signableHeaders: new Set(), - - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The signingRegion and signingService options let the user - * specify a different region or service to pre-sign the request for. - */ - signingRegion: 'us-east-1', - } - ) - - console.log(`presigned URL: ${signedRequest.url}`) - - /** - * Our URL is now ready to be used. - */ - const res = http.get(signedRequest.url, { - headers: signedRequest.headers, - }) - - check(res, { 'status is 200': (r) => r.status === 200 }) -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 sign().md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 sign().md deleted file mode 100644 index b3588fccd6..0000000000 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/00 sign().md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: 'sign' -head_title: 'sign' -slug: 'sign' -description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' ---- - -# sign - -`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. - -### Parameters - -The first parameter of the `sign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | -| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | -| query (optional) | `Object.>` | The optional query parameters of the HTTP request | - - -You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :---------- | :------------------------------------------------------------------------- | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -| Property | Type | Description | -| :------- | :----- | :---------------------------------------------------------------------- | -| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | -| url | string | The signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' - -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - /** - * In order to be able to sign an HTTP request's, - * we need to instantiate a SignatureV4 object. - */ - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - /** - * The sign operation will return a new HTTP request with the - * AWS signature v4 protocol headers added. It returns an Object - * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` - * properties, ready to use in the context of k6's http call. - */ - const signedRequest = signer.sign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'mybucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/myfile.txt', - - /** - * The headers we will be sending in the request. - */ - headers: {}, - }, - - /** - * (optional) Signature operation options allows to override the - * SignatureV4's options in the context of this specific request. - */ - { - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The region name to sign the request. It will override the signing region of the - * signer in current invocation - */ - signingRegion: 'us-east-1', - } - ) - - http.get(signedRequest.url, { headers: signedRequest.headers }) -} -``` - -{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/_index.md index b35913292f..4303527393 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/_index.md @@ -29,10 +29,10 @@ Instantiating a new `SignatureV4` requires a single options object argument with -| Method | Description | -| :---------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | -| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 sign()) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | -| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 presign()) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | +| Method | Description | +| :------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | +| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/sign) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | +| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/presign) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/presign.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/presign.md new file mode 100644 index 0000000000..c9aa2031fb --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/presign.md @@ -0,0 +1,202 @@ +--- +title: 'presign' +head_title: 'presign' +slug: 'presign' +description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' +--- + +# presign + +`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. + +### Parameters + +The first parameter of the `presign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :------- | :----------------------- | :---------------------------------- | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | + +You can provide further options and override SignatureV4 options in the context of this specific request. +To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| expiresIn | number | The number of seconds before the pre-signed URL expires | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +The `presign` operation returns an Object with the following properties. + +| Property | Type | Description | +| :------- | :----- | :------------------------------------------------------------------------ | +| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | +| url | string | The pre-signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; +import { check } from 'k6'; + +import { + AWSConfig, + SignatureV4, + AMZ_CONTENT_SHA256_HEADER, + UNSIGNED_PAYLOAD, +} 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + // In order to be able to produce pre-signed URLs, + // we need to instantiate a SignatureV4 object. + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + // We can now use the signer to produce a pre-signed URL. + const signedRequest = signer.presign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'my-bucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/my-file.txt', + + /** + * The headers we will be sending in the request. + * + * Note that in the specific case of this example, requesting + * an object from S3, we want to set the `x-amz-content-sha256` + * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload + * hash calculation, and communicate that value instead, as specified. + */ + headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, + }, + + /** + * (optional) pre-sign operation options. + */ + { + /** + * The number of seconds before the pre-signed URL expires + */ + expiresIn: 86400, + + /** + * A set of strings whose representing headers that should not be hoisted + * to pre-signed request's query string. If not supplied, the pre-signer + * moves all the AWS-specific headers (starting with `x-amz-`) to the request + * query string. If supplied, these headers remain in the pre-signed request's + * header. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unhoistableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that cannot be signed. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unsignableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that should be signed. + * Any values passed here will override those provided via unsignableHeaders, + * allowing them to be signed. + * + * All headers in the provided request will have their names converted to + * lower case before signing. + */ + signableHeaders: new Set(), + + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The signingRegion and signingService options let the user + * specify a different region or service to pre-sign the request for. + */ + signingRegion: 'us-east-1', + } + ); + + console.log(`presigned URL: ${signedRequest.url}`); + + /** + * Our URL is now ready to be used. + */ + const res = http.get(signedRequest.url, { + headers: signedRequest.headers, + }); + + check(res, { 'status is 200': (r) => r.status === 200 }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/sign.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/sign.md new file mode 100644 index 0000000000..da7132db3a --- /dev/null +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SignatureV4/sign.md @@ -0,0 +1,145 @@ +--- +title: 'sign' +head_title: 'sign' +slug: 'sign' +description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' +--- + +# sign + +`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. + +### Parameters + +The first parameter of the `sign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :--------------- | :------------------------------------------ | :------------------------------------------------ | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | +| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | +| query (optional) | `Object.>` | The optional query parameters of the HTTP request | + +You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +| Property | Type | Description | +| :------- | :----- | :---------------------------------------------------------------------- | +| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | +| url | string | The signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; + +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + /** + * In order to be able to sign an HTTP request's, + * we need to instantiate a SignatureV4 object. + */ + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + /** + * The sign operation will return a new HTTP request with the + * AWS signature v4 protocol headers added. It returns an Object + * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` + * properties, ready to use in the context of k6's http call. + */ + const signedRequest = signer.sign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'mybucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/myfile.txt', + + /** + * The headers we will be sending in the request. + */ + headers: {}, + }, + + /** + * (optional) Signature operation options allows to override the + * SignatureV4's options in the context of this specific request. + */ + { + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The region name to sign the request. It will override the signing region of the + * signer in current invocation + */ + signingRegion: 'us-east-1', + } + ); + + http.get(signedRequest.url, { headers: signedRequest.headers }); +} +``` + +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md similarity index 99% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md index 98e35dee3d..075c991914 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -68,4 +68,4 @@ export default async function () { _A k6 script querying a user Systems Manager Service parameter_ -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md index af4643d9a2..0b86250a04 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/_index.md @@ -15,9 +15,9 @@ Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------- | -| [getParameter](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerclient-getparameter) | Retrieves a parameter from Amazon Systems Manager. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------- | +| [getParameter](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/getparameter) | Retrieves a parameter from Amazon Systems Manager. | ### Throws @@ -63,7 +63,10 @@ export default async function () { // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = await systemsManager.getParameter(testParameterSecretName, true); + const { value: encryptedParameterValue } = await systemsManager.getParameter( + testParameterSecretName, + true + ); if (encryptedParameterValue !== testParameterSecretValue) { exec.test.abort('encrypted test parameter not found'); } diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md similarity index 75% rename from docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md rename to docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md index 5e1e6cbbcd..14bca786f6 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -1,7 +1,6 @@ --- -title: 'SystemsManagerClient.getParameter()' +title: 'getParameter' head_title: 'SystemsManagerClient.getParameter()' -slug: 'systemsmanagerclient-getparameter' description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" --- @@ -11,8 +10,8 @@ description: "SystemsManagerClient.getParameter gets a Systems Manager parameter ### Returns -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [`Promise`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | A Promise that fulfills with an array of [`SystemsManagerParameter`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | ### Example @@ -63,5 +62,3 @@ export default async function () { _A k6 script querying a user's Systems Manager Service parameter_ {{< /code >}} - - From 7a487e4a3dc3f0c943c600b2df913dfa62cbff67 Mon Sep 17 00:00:00 2001 From: oleiade Date: Tue, 12 Dec 2023 12:00:09 +0100 Subject: [PATCH 3/5] Replicate jslib-aws v0.48 changes in next docs --- .../jslib/aws/EventBridgeClient/putEvents.md | 58 +++-- .../jslib/aws/KMSClient/KMSDataKey.md | 55 +++++ .../jslib/aws/KMSClient/KMSKey.md | 49 +++++ .../jslib/aws/KMSClient/_index.md | 10 +- .../jslib/aws/KMSClient/generateDataKey.md | 60 ++++++ .../jslib/aws/KMSClient/listKeys.md | 50 +++++ .../jslib/aws/S3Client/Bucket.md | 41 ++++ .../jslib/aws/S3Client/Object.md | 60 ++++++ .../jslib/aws/S3Client/S3Part.md | 82 +++++++ .../jslib/aws/S3Client/_index.md | 45 ++-- .../aws/S3Client/abortMultipartUpload.md | 55 +++++ .../aws/S3Client/completeMultipartUpload.md | 100 +++++++++ .../jslib/aws/S3Client/copyObject.md | 58 +++++ .../aws/S3Client/createMultipartUpload.md | 52 +++++ .../jslib/aws/S3Client/deleteObject.md | 57 +++++ .../jslib/aws/S3Client/getObject.md | 59 +++++ .../jslib/aws/S3Client/listBuckets.md | 49 +++++ .../jslib/aws/S3Client/listObjects.md | 57 +++++ .../jslib/aws/S3Client/putObject.md | 69 ++++++ .../jslib/aws/S3Client/uploadPart.md | 90 ++++++++ .../jslib/aws/SQSClient/_index.md | 8 +- .../jslib/aws/SQSClient/listQueues.md | 58 +++++ .../jslib/aws/SQSClient/sendMessage.md | 82 +++++++ .../jslib/aws/SecretsManagerClient/Secret.md | 59 +++++ .../jslib/aws/SecretsManagerClient/_index.md | 14 +- .../aws/SecretsManagerClient/createSecret.md | 60 ++++++ .../aws/SecretsManagerClient/deleteSecret.md | 56 +++++ .../aws/SecretsManagerClient/getSecret.md | 55 +++++ .../aws/SecretsManagerClient/listSecrets.md | 49 +++++ .../SecretsManagerClient/putSecretValue.md | 65 ++++++ .../jslib/aws/SignatureV4/_index.md | 8 +- .../jslib/aws/SignatureV4/presign.md | 202 ++++++++++++++++++ .../jslib/aws/SignatureV4/sign.md | 145 +++++++++++++ .../SystemsManagerParameter.md | 71 ++++++ .../jslib/aws/SystemsManagerClient/_index.md | 11 +- .../aws/SystemsManagerClient/getParameter.md | 64 ++++++ 36 files changed, 2094 insertions(+), 69 deletions(-) create mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md create mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SignatureV4/presign.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SignatureV4/sign.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md create mode 100644 docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md diff --git a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index 994492d6d4..cb0399ccca 100644 --- a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -1,7 +1,6 @@ --- -title: 'EventBridgeClient.putEvents' +title: 'putEvents' head_title: 'EventBridgeClient.putEvents' -slug: 'eventbridgeclient-putevents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' --- @@ -12,33 +11,32 @@ excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' ### Parameters -| Parameter | Type | Description | -| :------------ | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | +| Parameter | Type | Description | +| :-------- | :-------------------------------- | :------------------------------------------------------- | +| input | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. | #### PutEventsInput -| Parameter | Type | Description | -| :-------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------- | -| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | -| EndpointId | string (optional) | The ID of the target to receive the event. | +| Parameter | Type | Description | +| :--------- | :-------------------------------------- | :------------------------------------------------------- | +| Entries | [EventBridgeEntry](#eventbridgeentry)[] | An array of objects representing events to be submitted. | +| EndpointId | string (optional) | The ID of the target to receive the event. | #### EventBridgeEntry -| Parameter | Type | Description | -| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------------- | -| Source | string | The source of the event. | -| Detail | object | A JSON object containing event data. | -| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | -| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | -| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | - +| Parameter | Type | Description | +| :----------- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Source | string | The source of the event. | +| Detail | object | A JSON object containing event data. | +| DetailType | string | Free-form string used to decide what fields to expect in the event detail. | +| Resources | string[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. | +| EventBusName | string (optional) | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. | ### Returns -| Type | Description | -| :-------------- | :---------------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | +| Type | Description | +| :-------------- | :---------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the events have been sent to Amazon EventBridge. | ### Example @@ -56,19 +54,19 @@ const awsConfig = new AWSConfig({ const eventBridge = new EventBridgeClient(awsConfig); const eventEntry = { - Source: "my.source", - Detail: { - key: "value" - }, - DetailType: "MyDetailType", - Resources: ["resource-arn"], + Source: 'my.source', + Detail: { + key: 'value', + }, + DetailType: 'MyDetailType', + Resources: ['resource-arn'], }; export default async function () { - await eventBridge.putEvents({ - Entries: [eventEntry] - }); + await eventBridge.putEvents({ + Entries: [eventEntry], + }); } ``` -{{< /code >}} \ No newline at end of file +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md new file mode 100644 index 0000000000..f4b836b143 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -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//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 >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md new file mode 100644 index 0000000000..3651e3721d --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -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 >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/_index.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/_index.md index 5fca4ba3d6..2b533eb675 100644 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/_index.md @@ -18,10 +18,10 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | -| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/00 generateDataKey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | +| [listKeys](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/listkeys) | List the all the Key Management Service keys in the caller's AWS account and region. | +| [generateDataKey](https://grafana.com/docs/k6//javascript-api/jslib/aws/kmsclient/generatedatakey) | Generate a symmetric data key for use outside of the AWS Key Management Service. | ### Throws @@ -63,7 +63,7 @@ export default async function (data) { export function handleSummary(data) { return { - stdout: textSummary(data, { indent: ' ', enableColors: true }), + 'stdout': textSummary(data, { indent: ' ', enableColors: true }), './test-run.key': data.dataKey, }; } diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md new file mode 100644 index 0000000000..a217e48cfa --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -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//javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6//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 >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md new file mode 100644 index 0000000000..26337a008c --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -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//javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6//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 >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md new file mode 100755 index 0000000000..491ca77260 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md @@ -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 >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md new file mode 100755 index 0000000000..e9891f93bb --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md @@ -0,0 +1,60 @@ +--- +title: 'Object' +head_title: 'Object' +description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." +--- + +# Object + +Object is returned by the S3Client.\* methods that query S3 buckets' objects. Namely, [`listObjects`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listobjects), [`getObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/getobject), [`putObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/putobject), +and [`deleteObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/deleteobject). The Object construct describes an Amazon S3 object. + +| Name | Type | Description | +| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Object.key` | string | The S3 object's name. | +| `Object.lastModified` | number | The S3 object's last modification date. | +| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | +| `Object.size` | size | The S3 object's size in bytes. | +| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | +| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { + // listBuckets, + 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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; + +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) { + exec.test.abort(); + } + + // Let's download our test object and print its content + const object = await s3.getObject(testBucketName, testFileKey); + console.log(JSON.stringify(object)); +} +``` + +_A k6 script that will query a S3 bucket's objects and print its content and metadata_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md new file mode 100755 index 0000000000..97fc171d0e --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md @@ -0,0 +1,82 @@ +--- +title: 'S3Part' +head_title: 'S3Part' +slug: 's3part' +description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +--- + +# S3Part + +S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/uploadpart) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. + +| Name | Type | Description | +| :-------------------- | :----- | :----------------- | +| `S3Part.partNumber` | number | The S3 Part'number | +| `S3Part.eTag ` | String | The S3 Part's etag | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/_index.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/_index.md index 633be6816c..e1f2520bb5 100644 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/_index.md @@ -18,18 +18,18 @@ Both the dedicated `s3.js` jslib bundle and the all-encompassing `aws.js` bundle ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | -| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 listBuckets()) | List the buckets the authenticated user has access to | -| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects/) | List the objects contained in a bucket | -| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 getObject(bucketName, objectKey)) | Download an object from a bucket | -| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 putObject(bucketName, objectKey, data)) | Upload an object to a bucket | -| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 deleteObject(bucketName, objectKey)) | Delete an object from a bucket | -| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 copyObject) | Copy an object from one bucket to another | -| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 createMultipartUpload(bucketName, objectKey)) | Create a multipart upload for a given objectKey to a bucket | -| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy) | Upload a part in a multipart upload | -| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts)) | Complete a previously assembled multipart upload | -| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/00 abortMultipartUpload(bucketName, objectKey, uploadId)) | Abort a multipart upload | +| Function | Description | +| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | +| [listBuckets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listbuckets) | List the buckets the authenticated user has access to | +| [listObjects(bucketName, [prefix])](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/listobjects) | List the objects contained in a bucket | +| [getObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/getobject) | Download an object from a bucket | +| [putObject(bucketName, objectKey, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/putobject) | Upload an object to a bucket | +| [deleteObject(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/deleteobject) | Delete an object from a bucket | +| [copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/copyobject) | Copy an object from one bucket to another | +| [createMultipartUpload(bucketName, objectKey)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/createmultipartupload) | Create a multipart upload for a given objectKey to a bucket | +| [uploadPart(bucketName, objectKey, uploadId, partNumber, data)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/uploadpart) | Upload a part in a multipart upload | +| [completeMultipartUpload(bucketName, objectKey, uploadId, parts)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/completemultipartupload) | Complete a previously assembled multipart upload | +| [abortMultipartUpload(bucketName, objectKey, uploadId)](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/abortmultipartupload) | Abort a multipart upload | ### Throws @@ -145,14 +145,29 @@ export default async function () { // Upload the first part const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 1, firstPartData); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); // Upload the second part const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart(testBucketName, testFileKey, multipartUpload.uploadId, 2, secondPartData); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [firstPart, secondPart]); + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); // Let's redownload it verify it's correct, and delete it const obj = await s3.getObject(testBucketName, testFileKey); diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md new file mode 100755 index 0000000000..d63ce836ad --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -0,0 +1,55 @@ +--- +title: 'abortMultipartUpload' +head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' +description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +--- + +# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) + +`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 + +{{< 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload and abort the multipart_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md new file mode 100755 index 0000000000..6546cc335c --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -0,0 +1,100 @@ +--- +title: 'completeMultipartUpload' +head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' +description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +--- + +# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) + +`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. | +| objectKey | string | Name of the uploaded object. | +| uploadId | number | UploadId of the multipart upload to complete. | +| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // List the buckets the AWS authentication configuration + // gives us access to. + const buckets = await s3.listBuckets(); + + // If our test bucket does not exist, abort the execution. + if (buckets.filter((b) => b.name === testBucketName).length == 0) { + exec.test.abort(); + } + + // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md new file mode 100644 index 0000000000..b3dbbaebf5 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md @@ -0,0 +1,58 @@ +--- +title: 'copyObject' +head_title: 'S3Client.copyObject' +description: 'S3Client.copyObject copies an object from a bucket to another' +--- + +# S3Client.copyObject + +`S3Client.copyObject` copies an object from one bucket to another. + +### Parameters + +| Parameter | Type | Description | +| :---------------- | :----- | :------------------------------------------------- | +| sourceBucket | string | Name of the bucket to copy the object from. | +| sourceKey | string | Name of the object to copy from the source bucket. | +| 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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +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 testFile = open('./bonjour.txt', 'r'); +const s3 = new S3Client(awsConfig); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; +const testDestinationBucketName = 'test-jslib-aws-destination'; + +export default async function () { + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile); + + // Let's create our destination bucket + await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); +} +``` + +_A k6 script that will copy an object from a source S3 bucket to a destination bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md new file mode 100755 index 0000000000..b0ce51a4d2 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -0,0 +1,52 @@ +--- +title: 'createMultipartUpload' +head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' +description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +--- + +# S3Client.createMultipartUpload(bucketName, objectKey) + +`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. + +| Parameter | Type | Description | +| :--------- | :----- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the uploaded object. | + +### Returns + +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | + +### 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +export default async function () { + // Initialize a multipart upload + const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Abort multipart upload + await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); +} +``` + +_A k6 script that will create a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md new file mode 100755 index 0000000000..154f85075e --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -0,0 +1,57 @@ +--- +title: 'deleteObject' +head_title: 'S3Client.deleteObject(bucketName, objectKey)' +description: 'S3Client.deleteObject deletes an object from a bucket' +--- + +# S3Client.deleteObject(bucketName, objectKey) + +`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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; + +export default async function () { + // Let's delete our test object + await s3.deleteObject(testBucketName, testFileKey); + + // And make sure it was indeed deleted + const objects = await s3.listObjects(); + if (objects.filter((o) => o.name === testBucketName).length != 0) { + exec.test.abort(); + } +} +``` + +_A k6 script that will delete an object from a S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md new file mode 100755 index 0000000000..0d66a1c4c5 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md @@ -0,0 +1,59 @@ +--- +title: 'getObject' +head_title: 'S3Client.getObject(bucketName, objectKey)' +description: 'S3Client.getObject downloads an object from a bucket' +--- + +# S3Client.getObject(bucketName, objectKey) + +`S3Client.getObject` downloads an object from a bucket. + +### Parameters + +| Parameter | Type | Description | +| :--------- | :----- | :------------------------------------------- | +| bucketName | string | Name of the bucket to fetch the object from. | +| objectKey | string | Name of the object to download. | + +### Returns + +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; + +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) { + exec.test.abort(); + } + + // Let's download our test object and print its content + const object = await s3.getObject(testBucketName, testFileKey); + console.log(JSON.stringify(object)); +} +``` + +_A k6 script that will download an object from a bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md new file mode 100644 index 0000000000..25272099ea --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -0,0 +1,49 @@ +--- +title: 'listBuckets' +head_title: 'S3Client.listBuckets()' +description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' +--- + +# S3Client.listBuckets() + +`S3Client.listBuckets()` lists the buckets the authenticated user has access to in the region set by the `S3Client` instance's configuration. + +### Returns + +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/bucket) objects. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +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); +const testBucketName = 'test-jslib-aws'; + +export default async function () { + // List the buckets the AWS authentication configuration + // gives us access to. + const buckets = await s3.listBuckets(); + + // If our test bucket does not exist, abort the execution. + if (buckets.filter((b) => b.name === testBucketName).length == 0) { + exec.test.abort(); + } + + // ... work with the bucket's content +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md new file mode 100755 index 0000000000..3500c002e2 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md @@ -0,0 +1,57 @@ +--- +title: 'listObjects' +head_title: 'S3Client.listObjects(bucketName, [prefix])' +description: 'S3Client.listObjects lists the objects contained in a bucket' +--- + +# S3Client.listObjects(bucketName, [prefix]) + +`S3Client.listObjects()` lists the objects contained in a bucket. + +### Parameters + +| Parameter | Type | Description | +| :---------------- | :----- | :---------------------------------------------------------------- | +| bucketName | string | Name of the bucket to fetch the object from. | +| prefix (optional) | string | Limits the response to keys that begin with the specified prefix. | + +### Returns + +| Type | Description | +| :---------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) objects. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; + +export default async function () { + // List our bucket's objects + 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) { + exec.test.abort(); + } + + // ... work with the bucket's objects + console.log(JSON.stringify(objects)); +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md new file mode 100755 index 0000000000..e3961bcebb --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md @@ -0,0 +1,69 @@ +--- +title: 'putObject' +head_title: 'S3Client.putObject(bucketName, objectKey, data)' +description: 'S3Client.putObject uploads an object to a bucket' +--- + +# S3Client.putObject(bucketName, objectKey, data) + +`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. | +| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | + +#### PutObjectParams + +| Name | Type | Description | +| :------------------- | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | +| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | +| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | +| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | +| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | + +### Returns + +| Type | Description | +| :-------------- | :-------------------------------------------------------------------------- | +| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | + +### 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); +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'bonjour.txt'; +const testFile = open('./bonjour.txt', 'r'); + +export default async function () { + // Let's upload our test file to the bucket + await s3.putObject(testBucketName, testFileKey, testFile, { + contentType: 'text/plain', + contentLength: testFile.length, + }); + + // And let's redownload it to verify it's correct + const obj = await s3.getObject(testBucketName, testFileKey); + console.log(JSON.stringify(obj)); +} +``` + +_A k6 script that will upload an object to a S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md new file mode 100755 index 0000000000..92dd1ccb41 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -0,0 +1,90 @@ +--- +title: 'uploadPart' +head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' +description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +--- + +# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) + +`S3Client.uploadPart` uploads a part to multipart upload in a bucket. + +| Parameter | Type | Description | +| :--------- | :-------------------- | :------------------------------------------ | +| bucketName | string | Name of the bucket to upload the object to. | +| objectKey | string | Name of the object to upload. | +| uploadId | string | UploadId of the multipart upload. | +| partNumber | number | The Part number of the Part to upload. | +| data | string \| ArrayBuffer | Content of the part to upload. | + +### Returns + +| Type | Description | +| :--------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | + +### Example + +{{< code >}} + +```javascript +import crypto from 'k6/crypto'; +import exec from 'k6/execution'; + +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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const s3 = new S3Client(awsConfig); + +const testBucketName = 'test-jslib-aws'; +const testFileKey = 'multipart.txt'; + +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 = await s3.createMultipartUpload(testBucketName, testFileKey); + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); + const firstPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ); + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); + const secondPart = await s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ); + + // Complete the multipart upload + await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]); + + // Let's redownload it verify it's correct, and delete it + const obj = await s3.getObject(testBucketName, testFileKey); + await s3.deleteObject(testBucketName, testFileKey); +} +``` + +_A k6 script that will upload a part in a multipart upload to an S3 bucket_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/_index.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/_index.md index 39f426c236..b7681af3d6 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SQSClient/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/SQSClient/_index.md @@ -16,10 +16,10 @@ With it, the user can send messages to specified queues and list available queue ### Methods -| Function | Description | -| :-------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | -| [`sendMessage`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 sendMessage) | Delivers a message to the specified queue. | -| [`listQueues`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/00 listQueues) | Returns a list of your queues in the current region. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | +| [`sendMessage`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/sendmessage) | Delivers a message to the specified queue. | +| [`listQueues`](https://grafana.com/docs/k6//javascript-api/jslib/aws/sqsclient/listqueues) | Returns a list of your queues in the current region. | ### Throws diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md new file mode 100644 index 0000000000..50fa5f290f --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -0,0 +1,58 @@ +--- +title: 'listQueues' +head_title: 'SQSClient.listQueues()' +slug: 'sqsclient-listqueues' +description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +--- + +# SQSClient.listQueues() + +`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. + +### Parameters + +| Name | Type | Description | +| :-------- | :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // List all queues in the AWS account + const queuesResponse = await sqs.listQueues(); + + // If our test queue does not exist, abort the execution. + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, JSON.stringify({ value: '123' })); +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md new file mode 100644 index 0000000000..473877e93f --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -0,0 +1,82 @@ +--- +title: 'sendMessage' +head_title: 'SQSClient.sendMessage()' +slug: 'sqsclient-sendmessage' +description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +--- + +# SQSClient.sendMessage() + +`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. + +### Parameters + +| Name | Type | Description | +| :------------ | :--------------------------------------------------- | :--------------------------------------------------------------------------------------------------- | +| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | +| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | +| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | + +#### SendMessageOptions + +| Name | Type | Description | +| :----------------------- | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | +| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | +| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | +| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | + +### Returns + +| Type | Description | +| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const sqs = new SQSClient(awsConfig); +const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'; + +export default async function () { + // If our test queue does not exist, abort the execution. + const queuesResponse = await sqs.listQueues(); + if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { + exec.test.abort(); + } + + // Send message to test queue + await sqs.sendMessage(testQueue, 'test', { + messageAttributes: { + 'test-string': { + type: 'String', + value: 'test', + }, + 'test-number': { + type: 'Number', + value: '23', + }, + 'test-binary': { + type: 'Binary', + value: 'dGVzdA==', + }, + }, + }); +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md new file mode 100644 index 0000000000..fb701d0f73 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -0,0 +1,59 @@ +--- +title: 'Secret' +head_title: 'Secret' +description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' +--- + +# Secret + +Secret is returned by the SecretsManagerClient.\* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets/), +[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret), +[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret), and +[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. + +| Name | Type | Description | +| :----------------------- | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | +| `Secret.name` | string | The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. | +| `Secret.arn` | string | The Amazon Resource Name (ARN) of the secret. | +| `Secret.createdAt` | number | The date and time (timestamp) when a secret was created. | +| `Secret.lastAccessDate` | number | The last date that this secret was accessed. This value is truncated to midnight of the date and therefore shows only the date, not the time. | +| `Secret.lastChangedDate` | number | The last date and time that this secret was modified in any way. | +| `Secret.tags` | Array<{"key": "value"}> | The list of user-defined tags associated with the secret. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; + +export default async function () { + // List the secrets the AWS authentication configuration + // gives us access to. + const secrets = await secretsManager.listSecrets(); + + // If our test secret does not exist, abort the execution. + if (secrets.filter((s) => s.name === testSecretName).length == 0) { + exec.test.abort('test secret not found'); + } + + // Let's get it and print its content + const downloadedSecret = await secretsManager.getSecret(testSecretName); + console.log(downloadedSecret.secret); +} +``` + +_A k6 script that will query the user's secrets and print a test secret's value_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/_index.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/_index.md index 4e8b408c48..a9f3ce9819 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/_index.md @@ -15,13 +15,13 @@ With it, you can perform several operations such as listing, creating and downlo ### Methods -| Function | Description | -| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | -| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets) | List secrets owned by the authenticated user | -| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret) | Download a secret | -| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret) | Create a new secret | -| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) | Update a secret | -| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-deletesecret) | Delete a secret | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------- | +| [listSecrets()](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/listsecrets) | List secrets owned by the authenticated user | +| [getSecret(secretID)](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/getsecret) | Download a secret | +| [createSecret(name, secretString, description, [versionID], [tags])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/createsecret) | Create a new secret | +| [putSecretValue(secretID, secretString, [versionID])](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/putsecretvalue) | Update a secret | +| [deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/deletesecret) | Delete a secret | ### Throws diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md new file mode 100644 index 0000000000..6f0afe7f7b --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -0,0 +1,60 @@ +--- +title: 'createSecret' +head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' +description: 'SecretsManagerClient.createSecret creates a new secret' +--- + +# SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags]) + +`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. | +| secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value. | +| description | string | The description of the 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](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) object that contains the details of the created secret. | + +### Example + +{{< code >}} + +```javascript +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; +const testSecretValue = 'jslib-test-value'; + +export default async function () { + // Let's create our test secret. + 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 = await secretsManager.getSecret(testSecretName); + console.log(JSON.stringify(createdSecret)); +} +``` + +_A k6 script that will create a secret in AWS secrets manager_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md new file mode 100644 index 0000000000..0a11bd591a --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -0,0 +1,56 @@ +--- +title: 'deleteSecret' +head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' +description: 'SecretsManagerClient.deleteSecret deletes a secret' +--- + +# SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}}) + +`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 + +{{< code >}} + +```javascript +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; +const testSecretValue = 'jslib-test-value'; + +export default async function () { + // Let's make sure our test secret is created + 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 + await secretsManager.deleteSecret(testSecretName, { noRecovery: true }); +} +``` + +_A k6 script that will delete a secret in AWS secrets manager_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md new file mode 100644 index 0000000000..3cd399502c --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -0,0 +1,55 @@ +--- +title: 'getSecret' +head_title: 'SecretsManagerClient.getSecret(secretID)' +description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' +--- + +# SecretsManagerClient.getSecret(secretID) + +`SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. + +| Parameter | Type | Description | +| :-------- | :----- | :----------------------------------------- | +| secretID | string | The ARN or name of the secret to retrieve. | + +### Returns + +| Type | Description | +| :--------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; + +export default async function () { + // List the secrets the AWS authentication configuration + // gives us access to. + 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 = await secretsManager.getSecret(testSecretName); + console.log(JSON.stringify(secret)); +} +``` + +_A k6 script that will download a user's secret from AWS secrets manager_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md new file mode 100644 index 0000000000..27586084ff --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -0,0 +1,49 @@ +--- +title: 'listSecrets' +head_title: 'SecretsManagerClient.listSecrets()' +description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' +--- + +# SecretsManagerClient.listSecrets() + +`S3Client.listSecrets` lists the secrets the authenticated user has access to in the region set by the `SecretsManagerClient` instance's configuration. + +### Returns + +| Type | Description | +| :---------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Promise/javascript-api/jslib/aws/secretsmanagerclient/secret)>> | A Promise that fulfills with an array of [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; + +export default async function () { + // List the secrets the AWS authentication configuration + // gives us access to, and verify the test secret exists. + const secrets = await secretsManager.listSecrets(); + if (secrets.filter((s) => s.name === testSecretName).length == 0) { + exec.test.abort('test secret not found'); + } + + console.log(JSON.stringify(secrets)); +} +``` + +_A k6 script that will list a user's secrets from AWS secrets manager_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md new file mode 100644 index 0000000000..1d87a33197 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -0,0 +1,65 @@ +--- +title: 'putSecretValue' +head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' +description: "SecretsManagerClient.putSecretValue updates an existing secret's value" +--- + +# SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags]) + +`SecretsManagerClient.putSecretValue` updates a secret's value in AWS' secrets manager. + +| Parameter | Type | Description | +| :------------------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | +| secretID | string | The ARN or name of the secret to update. | +| secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret 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](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with the updated [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret). | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, +}); + +const secretsManager = new SecretsManagerClient(awsConfig); +const testSecretName = 'jslib-test-secret'; +const testSecretValue = 'jslib-test-value'; + +export default async function () { + // Let's make sure our test secret is created + const testSecret = await secretsManager.createSecret( + testSecretName, + testSecretValue, + 'this is a test secret, delete me.' + ); + + // Now that we know the secret exist, let's update its value + const newTestSecretValue = 'new-test-value'; + const u = await secretsManager.putSecretValue(testSecretName, newTestSecretValue); + + // Let's get its value back and verify it was indeed updated + const updatedSecret = await secretsManager.getSecret(testSecretName); + if (updatedSecret.secret !== newTestSecretValue) { + exec.test.abort('unable to update test secret'); + } +} +``` + +_A k6 script that will update a secret's value in AWS secrets manager_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/_index.md b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/_index.md index b35913292f..4303527393 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/_index.md @@ -29,10 +29,10 @@ Instantiating a new `SignatureV4` requires a single options object argument with -| Method | Description | -| :---------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | -| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 sign()) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | -| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/00 presign()) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | +| Method | Description | +| :------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | +| [sign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/sign) | Signs an authenticated HTTP request using the AWS signature v4 algorithm | +| [presign()](https://grafana.com/docs/k6//javascript-api/jslib/aws/signaturev4/presign) | Produces an authenticated pre-signed URL using the AWS signature v4 algorithm | diff --git a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/presign.md b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/presign.md new file mode 100644 index 0000000000..c9aa2031fb --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/presign.md @@ -0,0 +1,202 @@ +--- +title: 'presign' +head_title: 'presign' +slug: 'presign' +description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' +--- + +# presign + +`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. + +### Parameters + +The first parameter of the `presign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :------- | :----------------------- | :---------------------------------- | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | + +You can provide further options and override SignatureV4 options in the context of this specific request. +To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| expiresIn | number | The number of seconds before the pre-signed URL expires | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +The `presign` operation returns an Object with the following properties. + +| Property | Type | Description | +| :------- | :----- | :------------------------------------------------------------------------ | +| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | +| url | string | The pre-signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; +import { check } from 'k6'; + +import { + AWSConfig, + SignatureV4, + AMZ_CONTENT_SHA256_HEADER, + UNSIGNED_PAYLOAD, +} 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, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + // In order to be able to produce pre-signed URLs, + // we need to instantiate a SignatureV4 object. + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + // We can now use the signer to produce a pre-signed URL. + const signedRequest = signer.presign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'my-bucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/my-file.txt', + + /** + * The headers we will be sending in the request. + * + * Note that in the specific case of this example, requesting + * an object from S3, we want to set the `x-amz-content-sha256` + * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload + * hash calculation, and communicate that value instead, as specified. + */ + headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, + }, + + /** + * (optional) pre-sign operation options. + */ + { + /** + * The number of seconds before the pre-signed URL expires + */ + expiresIn: 86400, + + /** + * A set of strings whose representing headers that should not be hoisted + * to pre-signed request's query string. If not supplied, the pre-signer + * moves all the AWS-specific headers (starting with `x-amz-`) to the request + * query string. If supplied, these headers remain in the pre-signed request's + * header. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unhoistableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that cannot be signed. + * All headers in the provided request will have their names converted to + * lower case and then checked for existence in the unsignableHeaders set. + * + * In the case of pre-signing S3 URLs, the body needs to be empty. + * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to + * UNSIGNED_PAYLOAD. To do this, we need to set the header, + * but declare it as unhoistable, and unsignable. + */ + unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), + + /** + * A set of strings whose members represents headers that should be signed. + * Any values passed here will override those provided via unsignableHeaders, + * allowing them to be signed. + * + * All headers in the provided request will have their names converted to + * lower case before signing. + */ + signableHeaders: new Set(), + + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The signingRegion and signingService options let the user + * specify a different region or service to pre-sign the request for. + */ + signingRegion: 'us-east-1', + } + ); + + console.log(`presigned URL: ${signedRequest.url}`); + + /** + * Our URL is now ready to be used. + */ + const res = http.get(signedRequest.url, { + headers: signedRequest.headers, + }); + + check(res, { 'status is 200': (r) => r.status === 200 }); +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/sign.md b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/sign.md new file mode 100644 index 0000000000..da7132db3a --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/sign.md @@ -0,0 +1,145 @@ +--- +title: 'sign' +head_title: 'sign' +slug: 'sign' +description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' +excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' +--- + +# sign + +`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. + +### Parameters + +The first parameter of the `sign` method consists of an Object with the following properties. + +| Property | Type | Description | +| :--------------- | :------------------------------------------ | :------------------------------------------------ | +| method | string | The HTTP method of the request | +| protocol | `http` or `https` string | The network protocol of the request | +| hostname | string | The hostname the request is sent to | +| path | string | The path of the request | +| headers | Object | The headers of the HTTP request | +| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | +| query (optional) | `Object.>` | The optional query parameters of the HTTP request | + +You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. + +| Property | Type | Description | +| :---------------- | :------------ | :------------------------------------------------------------------------- | +| signingDate | Date | overrides the Date used in the signing operation | +| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | +| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | +| unsignableHeaders | `Set` | excludes headers from the signing process | +| signableHeaders | `Set` | mark headers as signed | + +### Returns + +| Property | Type | Description | +| :------- | :----- | :---------------------------------------------------------------------- | +| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | +| url | string | The signed url to use in the context of a k6 HTTP request | + +### Example + +{{< code >}} + +```javascript +import http from 'k6/http'; + +import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +export default function () { + /** + * In order to be able to sign an HTTP request's, + * we need to instantiate a SignatureV4 object. + */ + const signer = new SignatureV4({ + service: 's3', + region: awsConfig.region, + credentials: { + accessKeyId: awsConfig.accessKeyId, + secretAccessKey: awsConfig.secretAccessKey, + sessionToken: awsConfig.sessionToken, + }, + uriEscapePath: false, + applyChecksum: false, + }); + + /** + * The sign operation will return a new HTTP request with the + * AWS signature v4 protocol headers added. It returns an Object + * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` + * properties, ready to use in the context of k6's http call. + */ + const signedRequest = signer.sign( + /** + * HTTP request description + */ + { + /** + * The HTTP method we will use in the request. + */ + method: 'GET', + + /** + * The network protocol we will use to make the request. + */ + protocol: 'https', + + /** + * The hostname of the service we will be making the request to. + */ + hostname: 'mybucket.s3.us-east-1.amazonaws.com', + + /** + * The path of the request. + */ + path: '/myfile.txt', + + /** + * The headers we will be sending in the request. + */ + headers: {}, + }, + + /** + * (optional) Signature operation options allows to override the + * SignatureV4's options in the context of this specific request. + */ + { + /** + * The date and time to be used as signature metadata. This value should be + * a Date object, a unix (epoch) timestamp, or a string that can be + * understood by the JavaScript `Date` constructor.If not supplied, the + * value returned by `new Date()` will be used. + */ + signingDate: new Date(), + + /** + * The service signing name. It will override the service name of the signer + * in current invocation + */ + signingService: 's3', + + /** + * The region name to sign the request. It will override the signing region of the + * signer in current invocation + */ + signingRegion: 'us-east-1', + } + ); + + http.get(signedRequest.url, { headers: signedRequest.headers }); +} +``` + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md new file mode 100644 index 0000000000..075c991914 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -0,0 +1,71 @@ +--- +title: 'SystemsManagerParameter' +head_title: 'SystemsManagerParameter' +slug: 'systemsmanagerparameter' +description: 'SystemsManagerParameter is returned by the SystemsManagerClient.* methods that query parameters' +--- + +# SystemsManagerParameter + +`SystemsManagerParameter.*` methods querying the Systems Manager Service parameters return some `SystemsManagerParameter` instances. Namely, `getParameter` returns an array of `SystemsManagerParameter` objects. The `SystemsManagerParameter` object describes an Amazon Systems Manager Service parameter. + +| Name | Type | Description | +| :----------------------------------------- | :----- | :------------------------------------------------------------------------------------ | +| `SystemsManagerParameter.arn` | string | The Amazon Resource Name (ARN) of the parameter | +| `SystemsManagerParameter.dataType` | string | The data type of the parameter, such as text or aws:ec2:image. The default is text. | +| `SystemsManagerParameter.lastModifiedDate` | number | Date the parameter was last changed or updated and the parameter version was created. | +| `SystemsManagerParameter.name` | string | The friendly name of the parameter. | +| `SystemsManagerParameter.selector` | string | Either the version number or the label used to retrieve the parameter value | +| `SystemsManagerParameter.sourceResult` | string | The raw result or response from the source. | +| `SystemsManagerParameter.type` | string | The type of parameter | +| `SystemsManagerParameter.value` | string | The parameter value | +| `SystemsManagerParameter.version` | string | The parameter version | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/ssm.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const systemsManager = new SystemsManagerClient(awsConfig); +const testParameterName = 'jslib-test-parameter'; +const testParameterValue = 'jslib-test-value'; +const testParameterSecretName = 'jslib-test-parameter-secret'; +// this value was created with --type SecureString +const testParameterSecretValue = 'jslib-test-secret-value'; + +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 = 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 } = await systemsManager.getParameter( + testParameterSecretName, + true + ); + if (encryptedParameterValue !== testParameterSecretValue) { + exec.test.abort('encrypted test parameter not found'); + } +} +``` + +_A k6 script querying a user Systems Manager Service parameter_ + +{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/_index.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/_index.md index af4643d9a2..0b86250a04 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/_index.md +++ b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/_index.md @@ -15,9 +15,9 @@ Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundl ### Methods -| Function | Description | -| :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------- | -| [getParameter](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerclient-getparameter) | Retrieves a parameter from Amazon Systems Manager. | +| Function | Description | +| :------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------- | +| [getParameter](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/getparameter) | Retrieves a parameter from Amazon Systems Manager. | ### Throws @@ -63,7 +63,10 @@ export default async function () { // Let's get the secret value with decryption // destructure the parameter object to get to the values you want - const { value: encryptedParameterValue } = await systemsManager.getParameter(testParameterSecretName, true); + const { value: encryptedParameterValue } = await systemsManager.getParameter( + testParameterSecretName, + true + ); if (encryptedParameterValue !== testParameterSecretValue) { exec.test.abort('encrypted test parameter not found'); } diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md new file mode 100644 index 0000000000..14bca786f6 --- /dev/null +++ b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -0,0 +1,64 @@ +--- +title: 'getParameter' +head_title: 'SystemsManagerClient.getParameter()' +description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" +--- + +# SystemsManagerClient.getParameter() + +`SystemsManagerClient.getParameter` gets a Systems Manager parameter in the caller's AWS account and region. + +### Returns + +| Type | Description | +| :------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`Promise`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | A Promise that fulfills with an array of [`SystemsManagerParameter`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | + +### Example + +{{< code >}} + +```javascript +import exec from 'k6/execution'; + +import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/ssm.js'; + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}); + +const systemsManager = new SystemsManagerClient(awsConfig); +const testParameterName = 'jslib-test-parameter'; +const testParameterValue = 'jslib-test-value'; +const testParameterSecretName = 'jslib-test-parameter-secret'; +// this value was created with --type SecureString +const testParameterSecretValue = 'jslib-test-secret-value'; + +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 = 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 } = await systemsManager.getParameter( + testParameterSecretName, + true + ); + if (encryptedParameterValue !== testParameterSecretValue) { + exec.test.abort('encrypted test parameter not found'); + } +} +``` + +_A k6 script querying a user's Systems Manager Service parameter_ + +{{< /code >}} From f1931d1b295426dfbfd926459d1a79ea20e3cf12 Mon Sep 17 00:00:00 2001 From: oleiade Date: Wed, 20 Dec 2023 15:40:49 +0100 Subject: [PATCH 4/5] Apply Pull Request Review Suggestions --- .../jslib/aws/EventBridgeClient/putEvents.md | 3 +- .../jslib/aws/KMSClient/00 generateDataKey.md | 63 ------ .../jslib/aws/KMSClient/00 listKeys.md | 53 ----- .../jslib/aws/KMSClient/90 KMSDataKey.md | 56 ----- .../jslib/aws/KMSClient/90 KMSKey.md | 50 ----- .../jslib/aws/KMSClient/KMSDataKey.md | 1 + .../jslib/aws/KMSClient/KMSKey.md | 1 + .../jslib/aws/KMSClient/generateDataKey.md | 3 +- .../jslib/aws/KMSClient/listKeys.md | 3 +- ...Upload(bucketName, objectKey, uploadId).md | 56 ----- ...bucketName, objectKey, uploadId, parts).md | 101 --------- .../jslib/aws/S3Client/00 copyObject.md | 60 ------ ...eMultipartUpload(bucketName, objectKey).md | 53 ----- .../00 deleteObject(bucketName, objectKey).md | 58 ----- .../00 getObject(bucketName, objectKey).md | 60 ------ .../jslib/aws/S3Client/00 listBuckets().md | 52 ----- .../00 listObjects(bucketName, [prefix]).md | 58 ----- ... putObject(bucketName, objectKey, data).md | 70 ------ ...ctKey, uploadId, partNumber, data) copy.md | 91 -------- .../jslib/aws/S3Client/90 Bucket.md | 42 ---- .../jslib/aws/S3Client/90 Object.md | 62 ------ .../aws/S3Client/90 S3MultipartUpload.md | 48 ----- .../jslib/aws/S3Client/90 S3Part.md | 82 ------- .../jslib/aws/S3Client/Bucket.md | 1 + .../jslib/aws/S3Client/Object.md | 1 + .../jslib/aws/S3Client/S3Part.md | 1 + .../aws/S3Client/abortMultipartUpload.md | 3 +- .../aws/S3Client/completeMultipartUpload.md | 3 +- .../jslib/aws/S3Client/copyObject.md | 3 +- .../aws/S3Client/createMultipartUpload.md | 3 +- .../jslib/aws/S3Client/deleteObject.md | 3 +- .../jslib/aws/S3Client/getObject.md | 3 +- .../jslib/aws/S3Client/listBuckets.md | 3 +- .../jslib/aws/S3Client/listObjects.md | 3 +- .../jslib/aws/S3Client/putObject.md | 3 +- .../jslib/aws/S3Client/uploadPart.md | 3 +- .../jslib/aws/SQSClient/00 listQueues.md | 58 ----- .../jslib/aws/SQSClient/00 sendMessage.md | 82 ------- .../jslib/aws/SQSClient/listQueues.md | 3 +- .../jslib/aws/SQSClient/sendMessage.md | 3 +- ...ring, description, [versionID], [tags]).md | 61 ------ .../SecretsManagerClient/00 deleteSecret.md | 58 ----- .../00 getSecret(secretID).md | 57 ----- .../SecretsManagerClient/00 listSecrets().md | 50 ----- ...ue(secretID, secretString, [versionID]).md | 66 ------ .../aws/SecretsManagerClient/99 Secret.md | 61 ------ .../jslib/aws/SecretsManagerClient/Secret.md | 1 + .../aws/SecretsManagerClient/createSecret.md | 3 +- .../aws/SecretsManagerClient/deleteSecret.md | 3 +- .../aws/SecretsManagerClient/getSecret.md | 3 +- .../aws/SecretsManagerClient/listSecrets.md | 3 +- .../SecretsManagerClient/putSecretValue.md | 3 +- .../jslib/aws/SignatureV4/00 presign().md | 202 ------------------ .../jslib/aws/SignatureV4/00 sign().md | 146 ------------- .../SystemsManagerClient/00 getParameter.md | 67 ------ .../90 SystemsManagerParameter.md | 71 ------ .../SystemsManagerParameter.md | 1 + .../aws/SystemsManagerClient/getParameter.md | 3 +- .../jslib/aws/EventBridgeClient/putEvents.md | 3 +- .../jslib/aws/KMSClient/KMSDataKey.md | 1 + .../jslib/aws/KMSClient/KMSKey.md | 1 + .../jslib/aws/KMSClient/generateDataKey.md | 3 +- .../jslib/aws/KMSClient/listKeys.md | 3 +- .../jslib/aws/S3Client/Bucket.md | 1 + .../jslib/aws/S3Client/Object.md | 1 + .../jslib/aws/S3Client/S3MultipartUpload.md | 1 + .../jslib/aws/S3Client/S3Part.md | 1 + .../aws/S3Client/abortMultipartUpload.md | 3 +- .../aws/S3Client/completeMultipartUpload.md | 3 +- .../jslib/aws/S3Client/copyObject.md | 3 +- .../aws/S3Client/createMultipartUpload.md | 3 +- .../jslib/aws/S3Client/deleteObject.md | 3 +- .../jslib/aws/S3Client/getObject.md | 3 +- .../jslib/aws/S3Client/listBuckets.md | 3 +- .../jslib/aws/S3Client/listObjects.md | 3 +- .../jslib/aws/S3Client/putObject.md | 3 +- .../jslib/aws/S3Client/uploadPart.md | 3 +- .../jslib/aws/SQSClient/listQueues.md | 3 +- .../jslib/aws/SQSClient/sendMessage.md | 3 +- .../jslib/aws/SecretsManagerClient/Secret.md | 1 + .../aws/SecretsManagerClient/createSecret.md | 3 +- .../aws/SecretsManagerClient/deleteSecret.md | 3 +- .../aws/SecretsManagerClient/getSecret.md | 3 +- .../aws/SecretsManagerClient/listSecrets.md | 3 +- .../SecretsManagerClient/putSecretValue.md | 3 +- .../SystemsManagerParameter.md | 1 + .../aws/SystemsManagerClient/getParameter.md | 3 +- .../jslib/aws/EventBridgeClient/putEvents.md | 3 +- .../jslib/aws/KMSClient/KMSDataKey.md | 1 + .../jslib/aws/KMSClient/KMSKey.md | 1 + .../jslib/aws/KMSClient/generateDataKey.md | 3 +- .../jslib/aws/KMSClient/listKeys.md | 3 +- .../jslib/aws/S3Client/Bucket.md | 1 + .../jslib/aws/S3Client/Object.md | 1 + .../jslib/aws/S3Client/S3Part.md | 1 + .../aws/S3Client/abortMultipartUpload.md | 3 +- .../aws/S3Client/completeMultipartUpload.md | 3 +- .../jslib/aws/S3Client/copyObject.md | 3 +- .../aws/S3Client/createMultipartUpload.md | 3 +- .../jslib/aws/S3Client/deleteObject.md | 3 +- .../jslib/aws/S3Client/getObject.md | 3 +- .../jslib/aws/S3Client/listBuckets.md | 3 +- .../jslib/aws/S3Client/listObjects.md | 3 +- .../jslib/aws/S3Client/putObject.md | 3 +- .../jslib/aws/S3Client/uploadPart.md | 3 +- .../jslib/aws/SQSClient/listQueues.md | 3 +- .../jslib/aws/SQSClient/sendMessage.md | 3 +- .../jslib/aws/SecretsManagerClient/Secret.md | 1 + .../aws/SecretsManagerClient/createSecret.md | 3 +- .../aws/SecretsManagerClient/deleteSecret.md | 3 +- .../aws/SecretsManagerClient/getSecret.md | 3 +- .../aws/SecretsManagerClient/listSecrets.md | 3 +- .../SecretsManagerClient/putSecretValue.md | 3 +- .../SystemsManagerParameter.md | 1 + .../aws/SystemsManagerClient/getParameter.md | 3 +- 115 files changed, 148 insertions(+), 2157 deletions(-) delete mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/00 listKeys.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSKey.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/S3Client/00 copyObject.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/S3Client/00 listBuckets().md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/90 Bucket.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/90 Object.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md delete mode 100755 docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3Part.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SQSClient/00 listQueues.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SQSClient/00 sendMessage.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 presign().md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 sign().md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md delete mode 100644 docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md diff --git a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index cb0399ccca..fe7c0d9766 100644 --- a/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -3,9 +3,10 @@ title: 'putEvents' head_title: 'EventBridgeClient.putEvents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' +weight: 10 --- -# EventBridgeClient.putEvents +# putEvents `EventBridgeClient.putEvents` sends custom events to Amazon EventBridge so that they can be matched to rules. diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md deleted file mode 100644 index e350f54bc7..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 generateDataKey.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: 'KMSClient.generateDataKey' -head_title: 'KMSClient.generateDataKey' -slug: '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//javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6//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 >}} - - diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 listKeys.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 listKeys.md deleted file mode 100644 index 0b89ce35cc..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/00 listKeys.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 'KMSClient.listKeys()' -head_title: 'KMSClient.listKeys()' -slug: '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//javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6//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 >}} - - diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md deleted file mode 100644 index baffa9e1e3..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSDataKey.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -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//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 >}} - diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSKey.md deleted file mode 100644 index 75270b4b55..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/90 KMSKey.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: 'KMSKey' -slug: '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 >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md index f4b836b143..cb182bdb01 100644 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -3,6 +3,7 @@ title: 'KMSDataKey' slug: 'kmsdatakey' head_title: 'KMSDataKey' description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys' +weight: 20 --- # KMSDataKey diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md index 3651e3721d..448732100a 100644 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -3,6 +3,7 @@ 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' +weight: 20 --- # KMSKey diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md index a217e48cfa..022f5461a2 100644 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -3,9 +3,10 @@ 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' +weight: 10 --- -# KMSClient.generateDataKey +# generateDataKey `KMSClient.generateDataKey` generates a symmetric data key for use outside of the AWS Key Management Service. diff --git a/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md b/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md index 26337a008c..88fabd153f 100644 --- a/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md +++ b/docs/sources/next/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -3,9 +3,10 @@ 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" +weight: 10 --- -# KMSClient.listKeys() +# listKeys `KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md deleted file mode 100755 index 04ec6b6d2a..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 abortMultipartUpload(bucketName, objectKey, uploadId).md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' -slug: 's3client-abortmultipartupload' -description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' ---- - -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) - -`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 - -{{< 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload and abort the multipart_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md deleted file mode 100755 index e41ff6f807..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 completeMultipartUpload(bucketName, objectKey, uploadId, parts).md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' -slug: 's3client-completemultipartupload' -description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' ---- - -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) - -`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. | -| objectKey | string | Name of the uploaded object. | -| uploadId | number | UploadId of the multipart upload to complete. | -| parts | Array<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6//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 - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // List the buckets the AWS authentication configuration - // gives us access to. - const buckets = await s3.listBuckets(); - - // If our test bucket does not exist, abort the execution. - if (buckets.filter((b) => b.name === testBucketName).length == 0) { - exec.test.abort(); - } - - // 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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 copyObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 copyObject.md deleted file mode 100644 index 07b0f65d74..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 copyObject.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: 'S3Client.copyObject' -head_title: 'S3Client.copyObject' -slug: 's3client-copyobject' -description: 'S3Client.copyObject copies an object from a bucket to another' ---- - -# S3Client.copyObject - -`S3Client.copyObject` copies an object from one bucket to another. - -### Parameters - -| Parameter | Type | Description | -| :---------------- | :----- | :------------------------------------------------- | -| sourceBucket | string | Name of the bucket to copy the object from. | -| sourceKey | string | Name of the object to copy from the source bucket. | -| 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 - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -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 testFile = open('./bonjour.txt', 'r'); -const s3 = new S3Client(awsConfig); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; -const testDestinationBucketName = 'test-jslib-aws-destination'; - -export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile); - - // Let's create our destination bucket - await s3.copyObject(testBucketName, testFileKey, testDestinationBucketName, testFileKey); -} -``` - -_A k6 script that will copy an object from a source S3 bucket to a destination bucket_ - -{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md deleted file mode 100755 index 717866d28b..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 createMultipartUpload(bucketName, objectKey).md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' -slug: 's3client-createmultipartupload' -description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' ---- - -# S3Client.createMultipartUpload(bucketName, objectKey) - -`S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the uploaded object. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. | - -### 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md deleted file mode 100755 index 09019d3d7f..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 deleteObject(bucketName, objectKey).md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'S3Client.deleteObject(bucketName, objectKey)' -head_title: 'S3Client.deleteObject(bucketName, objectKey)' -slug: 's3client-deleteobject' -description: 'S3Client.deleteObject deletes an object from a bucket' ---- - -# S3Client.deleteObject(bucketName, objectKey) - -`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 - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; - -export default async function () { - // Let's delete our test object - await s3.deleteObject(testBucketName, testFileKey); - - // And make sure it was indeed deleted - const objects = await s3.listObjects(); - if (objects.filter((o) => o.name === testBucketName).length != 0) { - exec.test.abort(); - } -} -``` - -_A k6 script that will delete an object from a S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md deleted file mode 100755 index a273220fb4..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 getObject(bucketName, objectKey).md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: 'S3Client.getObject(bucketName, objectKey)' -head_title: 'S3Client.getObject(bucketName, objectKey)' -slug: 's3client-getobject' -description: 'S3Client.getObject downloads an object from a bucket' ---- - -# S3Client.getObject(bucketName, objectKey) - -`S3Client.getObject` downloads an object from a bucket. - -### Parameters - -| Parameter | Type | Description | -| :--------- | :----- | :------------------------------------------- | -| bucketName | string | Name of the bucket to fetch the object from. | -| objectKey | string | Name of the object to download. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | -| Promise<[Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; - -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) { - exec.test.abort(); - } - - // Let's download our test object and print its content - const object = await s3.getObject(testBucketName, testFileKey); - console.log(JSON.stringify(object)); -} -``` - -_A k6 script that will download an object from a bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listBuckets().md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listBuckets().md deleted file mode 100644 index c49f247344..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listBuckets().md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: 'S3Client.listBuckets()' -head_title: 'S3Client.listBuckets()' -slug: 's3client-listbuckets' -description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' ---- - -# S3Client.listBuckets() - -`S3Client.listBuckets()` lists the buckets the authenticated user has access to in the region set by the `S3Client` instance's configuration. - -### Returns - -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | -| Promise/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/bucket) objects. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -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); -const testBucketName = 'test-jslib-aws'; - -export default async function () { - // List the buckets the AWS authentication configuration - // gives us access to. - const buckets = await s3.listBuckets(); - - // If our test bucket does not exist, abort the execution. - if (buckets.filter((b) => b.name === testBucketName).length == 0) { - exec.test.abort(); - } - - // ... work with the bucket's content -} -``` - -{{< /code >}} - - diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md deleted file mode 100755 index aed563dd21..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 listObjects(bucketName, [prefix]).md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'S3Client.listObjects(bucketName, [prefix])' -head_title: 'S3Client.listObjects(bucketName, [prefix])' -slug: 's3client-listobjects' -description: 'S3Client.listObjects lists the objects contained in a bucket' ---- - -# S3Client.listObjects(bucketName, [prefix]) - -`S3Client.listObjects()` lists the objects contained in a bucket. - -### Parameters - -| Parameter | Type | Description | -| :---------------- | :----- | :---------------------------------------------------------------- | -| bucketName | string | Name of the bucket to fetch the object from. | -| prefix (optional) | string | Limits the response to keys that begin with the specified prefix. | - -### Returns - -| Type | Description | -| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | -| Promise/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/object) objects. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; - -export default async function () { - // List our bucket's objects - 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) { - exec.test.abort(); - } - - // ... work with the bucket's objects - console.log(JSON.stringify(objects)); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md deleted file mode 100755 index 7c61a48733..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 putObject(bucketName, objectKey, data).md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: 'S3Client.putObject(bucketName, objectKey, data)' -head_title: 'S3Client.putObject(bucketName, objectKey, data)' -slug: 's3client-putobject' -description: 'S3Client.putObject uploads an object to a bucket' ---- - -# S3Client.putObject(bucketName, objectKey, data) - -`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. | -| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. | - -#### PutObjectParams - -| Name | Type | Description | -| :-------------------- | :---------------- | :---------- | -| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). | -| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | -| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. | -| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. | -| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). | - -### Returns - -| Type | Description | -| :-------------- | :-------------------------------------------------------------------------- | -| `Promise` | A Promise that fulfills when the object has been uploaded to the S3 bucket. | - -### 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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; -const testFile = open('./bonjour.txt', 'r'); - -export default async function () { - // Let's upload our test file to the bucket - await s3.putObject(testBucketName, testFileKey, testFile, { - contentType: 'text/plain', - contentLength: testFile.length, - }); - - // And let's redownload it to verify it's correct - const obj = await s3.getObject(testBucketName, testFileKey); - console.log(JSON.stringify(obj)); -} -``` - -_A k6 script that will upload an object to a S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md deleted file mode 100755 index 6fa49213ae..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/00 uploadPart(bucketName, objectKey, uploadId, partNumber, data) copy.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' -slug: 's3client-uploadpart' -description: 'S3Client.uploadPart a part in a multipart upload to a bucket' ---- - -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) - -`S3Client.uploadPart` uploads a part to multipart upload in a bucket. - -| Parameter | Type | Description | -| :--------- | :-------------------- | :------------------------------------------- | -| bucketName | string | Name of the bucket to upload the object to. | -| objectKey | string | Name of the object to upload. | -| uploadId | string | UploadId of the multipart upload. | -| partNumber | number | The Part number of the Part to upload. | -| data | string \| ArrayBuffer | Content of the part to upload. | - -### Returns - -| Type | Description | -| :----------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | -| Promise<[S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part)> | A Promise that fulfills with a [S3Part](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3part) representing a S3 Part Upload. | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Bucket.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Bucket.md deleted file mode 100755 index 1eeb62f020..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Bucket.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: 'Bucket' -head_title: 'Bucket' -slug: '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 >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Object.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Object.md deleted file mode 100755 index a49ed2dd7a..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 Object.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: 'Object' -head_title: 'Object' -slug: 'object' -description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." ---- - -# Object - -Object is returned by the S3Client.\* methods that query S3 buckets' objects. Namely, [`listObjects`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-listobjects), [`getObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-getobject), [`putObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-putobject), -and [`deleteObject`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-deleteobject). The Object construct describes an Amazon S3 object. - -| Name | Type | Description | -| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Object.key` | string | The S3 object's name. | -| `Object.lastModified` | number | The S3 object's last modification date. | -| `Object.etag` | string | The S3 object's `etag` is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. | -| `Object.size` | size | The S3 object's size in bytes. | -| `Object.storageClass` | `STANDARD` \| `REDUCED_REDUNDANCY` \| `GLACIER` \| `STANDARD_IA` \| `INTELLIGENT_TIERING` \| `DEEP_ARCHIVE` \| `OUTPOSTS` \| `GLACIER_IR` | The S3 object's class of storage used to store it. | -| `Object.data` | `string` or `bytes` or `null` | The S3 object's content. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { - // listBuckets, - 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); -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'bonjour.txt'; - -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) { - exec.test.abort(); - } - - // Let's download our test object and print its content - const object = await s3.getObject(testBucketName, testFileKey); - console.log(JSON.stringify(object)); -} -``` - -_A k6 script that will query a S3 bucket's objects and print its content and metadata_ - -{{< /code >}} - diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md deleted file mode 100755 index 5cb0daa2e8..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3MultipartUpload.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: 'S3MultipartUpload' -head_title: 'S3MultipartUpload' -slug: 's3multipartupload' -description: 'S3MultipartUpload is returned by the S3Client.createMultipartUpload method when creating a multipart upload.' ---- - -# S3MultipartUpload - -S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectKey)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-createmultipartupload/) method when creating a [multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html). - -| Name | Type | Description | -| :------------------------------ | :----- | :----------------------------- | -| `S3MultipartUpload.key` | string | The S3 Multipart object's key | -| `S3MultipartUpload.uploadId` | Date | The S3 Multipart upload Id | - -### 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -export default async function () { - // Initialize a multipart upload - const multipartUpload = await s3.createMultipartUpload(testBucketName, testFileKey); - console.log(multipartUpload.uploadId); - - // Abort multipart upload - await s3.abortMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId); -} -``` - -_A k6 script that will create a multipart upload and log the multipart `uploadId` and abort the multipart upload_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3Part.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3Part.md deleted file mode 100755 index 067ffe775d..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/90 S3Part.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'S3Part' -head_title: 'S3Part' -slug: 's3part' -description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' ---- - -# S3Part - -S3Part is returned by the [`uploadPart(bucketName, objectKey, uploadId, partNumber, data)`](https://grafana.com/docs/k6//javascript-api/jslib/aws/s3client/s3client-uploadpart/) method when uploading a part to a multipart upload. The S3Part object describes an Amazon S3 Part. - -| Name | Type | Description | -| :-------------------- | :----- | :---------------------- | -| `S3Part.partNumber` | number | The S3 Part'number | -| `S3Part.eTag ` | String | The S3 Part's etag | - -### Example - -{{< code >}} - -```javascript -import crypto from 'k6/crypto'; -import exec from 'k6/execution'; - -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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const s3 = new S3Client(awsConfig); - -const testBucketName = 'test-jslib-aws'; -const testFileKey = 'multipart.txt'; - -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 = await s3.createMultipartUpload(testBucketName, testFileKey); - - // Upload the first part - const firstPartData = bigFile.slice(0, 6 * 1024 * 1024); - const firstPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 1, - firstPartData - ); - - // Upload the second part - const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024); - const secondPart = await s3.uploadPart( - testBucketName, - testFileKey, - multipartUpload.uploadId, - 2, - secondPartData - ); - - // Complete the multipart upload - await s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ - firstPart, - secondPart, - ]); - - // Let's redownload it verify it's correct, and delete it - const obj = await s3.getObject(testBucketName, testFileKey); - await s3.deleteObject(testBucketName, testFileKey); -} -``` - -_A k6 script that will upload a part in a multipart upload to an S3 bucket_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md index 491ca77260..2870360952 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/Bucket.md @@ -2,6 +2,7 @@ title: 'Bucket' head_title: 'Bucket' description: 'Bucket is returned by the S3Client.* methods who query S3 buckets.' +weight: 20 --- # Bucket diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md index e9891f93bb..4031a34f5a 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/Object.md @@ -2,6 +2,7 @@ title: 'Object' head_title: 'Object' description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." +weight: 20 --- # Object diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md index 97fc171d0e..01dcd50c2f 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/S3Part.md @@ -3,6 +3,7 @@ title: 'S3Part' head_title: 'S3Part' slug: 's3part' description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +weight: 10 --- # S3Part diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md index d63ce836ad..a2a4377779 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -2,9 +2,10 @@ title: 'abortMultipartUpload' head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +weight: 10 --- -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) +# abortMultipartUpload `S3Client.abortMultipartUpload` aborts a multipart upload to an S3 bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md index 6546cc335c..73af544fe9 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -2,9 +2,10 @@ title: 'completeMultipartUpload' head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +weight: 10 --- -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) +# completeMultipartUpload `S3Client.completeMultipartUpload` uploads a multipart object to an S3 bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md index b3dbbaebf5..35fad4a8ad 100644 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/copyObject.md @@ -2,9 +2,10 @@ title: 'copyObject' head_title: 'S3Client.copyObject' description: 'S3Client.copyObject copies an object from a bucket to another' +weight: 10 --- -# S3Client.copyObject +# copyObject `S3Client.copyObject` copies an object from one bucket to another. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md index b0ce51a4d2..dfe9201da0 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -2,9 +2,10 @@ title: 'createMultipartUpload' head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +weight: 10 --- -# S3Client.createMultipartUpload(bucketName, objectKey) +# createMultipartUpload `S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md index 154f85075e..34d4b8a69b 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -2,9 +2,10 @@ title: 'deleteObject' head_title: 'S3Client.deleteObject(bucketName, objectKey)' description: 'S3Client.deleteObject deletes an object from a bucket' +weight: 10 --- -# S3Client.deleteObject(bucketName, objectKey) +# deleteObject `S3Client.deleteObject` deletes an object from a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md index 0d66a1c4c5..6bace543d6 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/getObject.md @@ -2,9 +2,10 @@ title: 'getObject' head_title: 'S3Client.getObject(bucketName, objectKey)' description: 'S3Client.getObject downloads an object from a bucket' +weight: 10 --- -# S3Client.getObject(bucketName, objectKey) +# getObject `S3Client.getObject` downloads an object from a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md index 25272099ea..50415e1eb1 100644 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -2,9 +2,10 @@ title: 'listBuckets' head_title: 'S3Client.listBuckets()' description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' +weight: 10 --- -# S3Client.listBuckets() +# listBuckets `S3Client.listBuckets()` lists the buckets the authenticated user has access to in the region set by the `S3Client` instance's configuration. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md index 3500c002e2..acdf5fb2cd 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/listObjects.md @@ -2,9 +2,10 @@ title: 'listObjects' head_title: 'S3Client.listObjects(bucketName, [prefix])' description: 'S3Client.listObjects lists the objects contained in a bucket' +weight: 10 --- -# S3Client.listObjects(bucketName, [prefix]) +# listObjects `S3Client.listObjects()` lists the objects contained in a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md index e3961bcebb..e95e8b9bcb 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/putObject.md @@ -2,9 +2,10 @@ title: 'putObject' head_title: 'S3Client.putObject(bucketName, objectKey, data)' description: 'S3Client.putObject uploads an object to a bucket' +weight: 10 --- -# S3Client.putObject(bucketName, objectKey, data) +# putObject `S3Client.putObject` uploads an object to a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md index 92dd1ccb41..a2eb64d96f 100755 --- a/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md +++ b/docs/sources/next/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -2,9 +2,10 @@ title: 'uploadPart' head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +weight: 10 --- -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) +# uploadPart `S3Client.uploadPart` uploads a part to multipart upload in a bucket. diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 listQueues.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 listQueues.md deleted file mode 100644 index d422aa0459..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 listQueues.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'SQSClient.listQueues()' -head_title: 'SQSClient.listQueues()' -slug: 'sqsclient-listqueues' -description: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" -excerpt: "SQSClient.listQueues retrieves a list of available Amazon SQS queues" ---- - -# SQSClient.listQueues() - -`SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `options` | object (optional) | Options for the request. Accepted properties are: `queueNamePrefix` (optional string) setting the prefix filter for the returned queue list, `maxResults` (optional number) setting the maximum number of results to include in the response (1 <= `maxResults` <= 1000>), and `nextToken` (optional string) setting the pagination token to request the next set of results. | - -### Returns - -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // List all queues in the AWS account - const queuesResponse = await sqs.listQueues() - - // If our test queue does not exist, abort the execution. - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, JSON.stringify({value: '123'})); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 sendMessage.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 sendMessage.md deleted file mode 100644 index 8d34b18c8f..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SQSClient/00 sendMessage.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 'SQSClient.sendMessage()' -head_title: 'SQSClient.sendMessage()' -slug: 'sqsclient-sendmessage' -description: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" -excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queue" ---- - -# SQSClient.sendMessage() - -`SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. - -### Parameters - -| Name | Type | Description | -| :------------ | :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. | -| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. | -| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. | - -#### SendMessageOptions - -| Name | Type | Description | -| :------------------------ | :----- | :---------------------------------------------------------------------------------------------- | -| `messageDeduplicationId` | string (optional) | The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval. | -| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order. | -| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). | -| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. | - -### Returns - -| Type | Description | -| :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 - -{{< code >}} - -```javascript -import exec from 'k6/execution' - -import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.11.0/sqs.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -const sqs = new SQSClient(awsConfig) -const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue' - -export default async function () { - // If our test queue does not exist, abort the execution. - const queuesResponse = await sqs.listQueues() - if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) { - exec.test.abort() - } - - // Send message to test queue - await sqs.sendMessage(testQueue, 'test', { - messageAttributes: { - 'test-string': { - type: 'String', - value: 'test' - }, - 'test-number': { - type: 'Number', - value: '23' - }, - 'test-binary': { - type: 'Binary', - value: 'dGVzdA==' - } - } - }); -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md index 50fa5f290f..3675c0b244 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md +++ b/docs/sources/next/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -4,9 +4,10 @@ head_title: 'SQSClient.listQueues()' slug: 'sqsclient-listqueues' description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +weight: 10 --- -# SQSClient.listQueues() +# listQueues `SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. diff --git a/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md index 473877e93f..7ebbc72c3c 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md +++ b/docs/sources/next/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -4,9 +4,10 @@ head_title: 'SQSClient.sendMessage()' slug: 'sqsclient-sendmessage' description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +weight: 10 --- -# SQSClient.sendMessage() +# sendMessage `SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md deleted file mode 100644 index b078ed890e..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 createSecret(name, secretString, description, [versionID], [tags]).md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' -head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' -slug: 'secretsmanagerclient-createsecret' -description: 'SecretsManagerClient.createSecret creates a new secret' ---- - -# SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags]) - -`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. | -| secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value. | -| description | string | The description of the 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](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) object that contains the details of the created secret. | - -### Example - -{{< code >}} - -```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; -const testSecretValue = 'jslib-test-value'; - -export default async function () { - // Let's create our test secret. - 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 = await secretsManager.getSecret(testSecretName); - console.log(JSON.stringify(createdSecret)); -} -``` - -_A k6 script that will create a secret in AWS secrets manager_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md deleted file mode 100644 index e43adb5bf0..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 deleteSecret.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' -head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' -slug: 'secretsmanagerclient-deletesecret' -description: 'SecretsManagerClient.deleteSecret deletes a secret' ---- - -# SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}}) - -`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 - -{{< code >}} - -```javascript -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; -const testSecretValue = 'jslib-test-value'; - -export default async function () { - // Let's make sure our test secret is created - 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 - await secretsManager.deleteSecret(testSecretName, { noRecovery: true }); -} -``` - -_A k6 script that will delete a secret in AWS secrets manager_ - -{{< /code >}} - diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md deleted file mode 100644 index 9b54abbc43..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 getSecret(secretID).md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: 'SecretsManagerClient.getSecret(secretID)' -head_title: 'SecretsManagerClient.getSecret(secretID)' -slug: 'secretsmanagerclient-getsecret' -description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' ---- - -# SecretsManagerClient.getSecret(secretID) - -`SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. - -| Parameter | Type | Description | -| :--------- | :----- | :------------------------------------------- | -| secretID | string | The ARN or name of the secret to retrieve. | - -### Returns - -| Type | Description | -| :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | -| Promise<[Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with a [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) describing and holding the downloaded secret. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; - -export default async function () { - // List the secrets the AWS authentication configuration - // gives us access to. - 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 = await secretsManager.getSecret(testSecretName); - console.log(JSON.stringify(secret)); -} -``` - -_A k6 script that will download a user's secret from AWS secrets manager_ - -{{< /code >}} - diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md deleted file mode 100644 index 78ced1a9c0..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 listSecrets().md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: 'SecretsManagerClient.listSecrets()' -head_title: 'SecretsManagerClient.listSecrets()' -slug: 'secretsmanagerclient-listsecrets' -description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' ---- - -# SecretsManagerClient.listSecrets() - -`S3Client.listSecrets` lists the secrets the authenticated user has access to in the region set by the `SecretsManagerClient` instance's configuration. - -### Returns - -| Type | Description | -| :--------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | -| Promise/javascript-api/jslib/aws/secretsmanagerclient/secret)>> | A Promise that fulfills with an array of [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret) objects. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; - -export default async function () { - // List the secrets the AWS authentication configuration - // gives us access to, and verify the test secret exists. - const secrets = await secretsManager.listSecrets(); - if (secrets.filter((s) => s.name === testSecretName).length == 0) { - exec.test.abort('test secret not found'); - } - - console.log(JSON.stringify(secrets)); -} -``` - -_A k6 script that will list a user's secrets from AWS secrets manager_ - -{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md deleted file mode 100644 index 102f760d1e..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/00 putSecretValue(secretID, secretString, [versionID]).md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' -head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' -slug: 'secretsmanagerclient-putsecretvalue' -description: "SecretsManagerClient.putSecretValue updates an existing secret's value" ---- - -# SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags]) - -`SecretsManagerClient.putSecretValue` updates a secret's value in AWS' secrets manager. - -| Parameter | Type | Description | -| :------------------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | -| secretID | string | The ARN or name of the secret to update. | -| secretString | string | The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret 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](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret)> | A Promise that fulfills with the updated [Secret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secret). | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; -const testSecretValue = 'jslib-test-value'; - -export default async function () { - // Let's make sure our test secret is created - const testSecret = await secretsManager.createSecret( - testSecretName, - testSecretValue, - 'this is a test secret, delete me.' - ); - - // Now that we know the secret exist, let's update its value - const newTestSecretValue = 'new-test-value'; - const u = await secretsManager.putSecretValue(testSecretName, newTestSecretValue); - - // Let's get its value back and verify it was indeed updated - const updatedSecret = await secretsManager.getSecret(testSecretName); - if (updatedSecret.secret !== newTestSecretValue) { - exec.test.abort('unable to update test secret'); - } -} -``` - -_A k6 script that will update a secret's value in AWS secrets manager_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md deleted file mode 100644 index 9f84df3426..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/99 Secret.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: 'Secret' -head_title: 'Secret' -slug: 'secret' -description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' ---- - -# Secret - -Secret is returned by the SecretsManagerClient.* methods that query secrets. Namely, [listSecrets](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-listsecrets/), -[getSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-getsecret), -[createSecret](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-createsecret), and -[putSecretValue](https://grafana.com/docs/k6//javascript-api/jslib/aws/secretsmanagerclient/secretsmanagerclient-putsecretvalue) returns either an instance or array of Secret objects. The Secret object describes an Amazon Secrets Manager secret. - -| Name | Type | Description | -| :----------------------- | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | -| `Secret.name` | string | The friendly name of the secret. You can use forward slashes in the name to represent a path hierarchy. | -| `Secret.arn` | string | The Amazon Resource Name (ARN) of the secret. | -| `Secret.createdAt` | number | The date and time (timestamp) when a secret was created. | -| `Secret.lastAccessDate` | number | The last date that this secret was accessed. This value is truncated to midnight of the date and therefore shows only the date, not the time. | -| `Secret.lastChangedDate` | number | The last date and time that this secret was modified in any way. | -| `Secret.tags` | Array<{"key": "value"}> | The list of user-defined tags associated with the secret. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/secrets-manager.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, -}); - -const secretsManager = new SecretsManagerClient(awsConfig); -const testSecretName = 'jslib-test-secret'; - -export default async function () { - // List the secrets the AWS authentication configuration - // gives us access to. - const secrets = await secretsManager.listSecrets(); - - // If our test secret does not exist, abort the execution. - if (secrets.filter((s) => s.name === testSecretName).length == 0) { - exec.test.abort('test secret not found'); - } - - // Let's get it and print its content - const downloadedSecret = await secretsManager.getSecret(testSecretName); - console.log(downloadedSecret.secret); -} -``` - -_A k6 script that will query the user's secrets and print a test secret's value_ - -{{< /code >}} - diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md index fb701d0f73..a96e22abbf 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -2,6 +2,7 @@ title: 'Secret' head_title: 'Secret' description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' +weight: 20 --- # Secret diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md index 6f0afe7f7b..e40d06f4ab 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -2,9 +2,10 @@ title: 'createSecret' head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' description: 'SecretsManagerClient.createSecret creates a new secret' +weight: 10 --- -# SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags]) +# createSecret `SecretsManagerClient.createSecret` creates a secret in AWS' secrets manager. diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md index 0a11bd591a..9344644c1c 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -2,9 +2,10 @@ title: 'deleteSecret' head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' description: 'SecretsManagerClient.deleteSecret deletes a secret' +weight: 10 --- -# SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}}) +# deleteSecret `SecretsManagerClient.deleteSecret` deletes a secret from AWS' secrets manager. diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md index 3cd399502c..0174687df0 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -2,9 +2,10 @@ title: 'getSecret' head_title: 'SecretsManagerClient.getSecret(secretID)' description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' +weight: 10 --- -# SecretsManagerClient.getSecret(secretID) +# getSecret `SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md index 27586084ff..da8a744b29 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -2,9 +2,10 @@ title: 'listSecrets' head_title: 'SecretsManagerClient.listSecrets()' description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' +weight: 10 --- -# SecretsManagerClient.listSecrets() +# listSecrets `S3Client.listSecrets` lists the secrets the authenticated user has access to in the region set by the `SecretsManagerClient` instance's configuration. diff --git a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md index 1d87a33197..7bb1a62b83 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md +++ b/docs/sources/next/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -2,9 +2,10 @@ title: 'putSecretValue' head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' description: "SecretsManagerClient.putSecretValue updates an existing secret's value" +weight: 10 --- -# SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags]) +# putSecretValue `SecretsManagerClient.putSecretValue` updates a secret's value in AWS' secrets manager. diff --git a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 presign().md b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 presign().md deleted file mode 100644 index 707b73432f..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 presign().md +++ /dev/null @@ -1,202 +0,0 @@ ---- -title: 'presign' -head_title: 'presign' -slug: 'presign' -description: 'Signaturev4.presign pre-signs a URL with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign pre-signs a URL with the AWS Signature V4 algorithm' ---- - -# presign - -`SignatureV4.presign()` pre-signs a URL with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 authorization added. It returns an Object holding a `url` containing the authorization information encoded in its query string, ready to use in the context of a k6 HTTP call. - -### Parameters - -The first parameter of the `presign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | - -You can provide further options and override SignatureV4 options in the context of this specific request. -To do this, pass a second parameter to the `presign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :------------ | :------------------------------------------------------------------------- | -| expiresIn | number | The number of seconds before the pre-signed URL expires | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -The `presign` operation returns an Object with the following properties. - -| Property | Type | Description | -| :------- | :----- | :------------------------------------------------------------------------- | -| headers | Object | The pre-signed request headers to use in the context of a k6 HTTP request | -| url | string | The pre-signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' -import { check } from 'k6' - -import { - AWSConfig, - SignatureV4, - AMZ_CONTENT_SHA256_HEADER, - UNSIGNED_PAYLOAD, -} 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, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - // In order to be able to produce pre-signed URLs, - // we need to instantiate a SignatureV4 object. - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - // We can now use the signer to produce a pre-signed URL. - const signedRequest = signer.presign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'my-bucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/my-file.txt', - - /** - * The headers we will be sending in the request. - * - * Note that in the specific case of this example, requesting - * an object from S3, we want to set the `x-amz-content-sha256` - * header to `UNSIGNED_PAYLOAD`. That way, we bypass the payload - * hash calculation, and communicate that value instead, as specified. - */ - headers: { [AMZ_CONTENT_SHA256_HEADER]: 'UNSIGNED-PAYLOAD' }, - }, - - /** - * (optional) pre-sign operation options. - */ - { - /** - * The number of seconds before the pre-signed URL expires - */ - expiresIn: 86400, - - /** - * A set of strings whose representing headers that should not be hoisted - * to pre-signed request's query string. If not supplied, the pre-signer - * moves all the AWS-specific headers (starting with `x-amz-`) to the request - * query string. If supplied, these headers remain in the pre-signed request's - * header. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unhoistableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unhoistableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that cannot be signed. - * All headers in the provided request will have their names converted to - * lower case and then checked for existence in the unsignableHeaders set. - * - * In the case of pre-signing S3 URLs, the body needs to be empty. - * however, the AMZ_CONTENT_SHA256_HEADER needs to be set to - * UNSIGNED_PAYLOAD. To do this, we need to set the header, - * but declare it as unhoistable, and unsignable. - */ - unsignableHeaders: new Set([AMZ_CONTENT_SHA256_HEADER]), - - /** - * A set of strings whose members represents headers that should be signed. - * Any values passed here will override those provided via unsignableHeaders, - * allowing them to be signed. - * - * All headers in the provided request will have their names converted to - * lower case before signing. - */ - signableHeaders: new Set(), - - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The signingRegion and signingService options let the user - * specify a different region or service to pre-sign the request for. - */ - signingRegion: 'us-east-1', - } - ) - - console.log(`presigned URL: ${signedRequest.url}`) - - /** - * Our URL is now ready to be used. - */ - const res = http.get(signedRequest.url, { - headers: signedRequest.headers, - }) - - check(res, { 'status is 200': (r) => r.status === 200 }) -} -``` - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 sign().md b/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 sign().md deleted file mode 100644 index b3588fccd6..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SignatureV4/00 sign().md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: 'sign' -head_title: 'sign' -slug: 'sign' -description: 'Signaturev4.sign signs an HTTP request with the AWS Signature V4 algorithm' -excerpt: 'SignatureV4.sign signs an HTTP request with the AWS Signature V4 algorithm' ---- - -# sign - -`SignatureV4.sign()` signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a `url` and a `headers` properties, ready to use in the context of k6's HTTP call. - -### Parameters - -The first parameter of the `sign` method consists of an Object with the following properties. - -| Property | Type | Description | -| :------------ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| method | string | The HTTP method of the request | -| protocol | `http` or `https` string | The network protocol of the request | -| hostname | string | The hostname the request is sent to | -| path | string | The path of the request | -| headers | Object | The headers of the HTTP request | -| body (optional) | string or ArrayBuffer | The optional body of the HTTP request | -| query (optional) | `Object.>` | The optional query parameters of the HTTP request | - - -You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the `sign` method, which is an Object with the following parameters. - -| Property | Type | Description | -| :---------------- | :---------- | :------------------------------------------------------------------------- | -| signingDate | Date | overrides the Date used in the signing operation | -| signingService | string | overrides the signer's AWS service in the context of the `sign` operation. | -| signingRegion | string | overrides the signer's AWS region in the context of the `sign` operation | -| unsignableHeaders | `Set` | excludes headers from the signing process | -| signableHeaders | `Set` | mark headers as signed | - -### Returns - -| Property | Type | Description | -| :------- | :----- | :---------------------------------------------------------------------- | -| headers | Object | The signed request's headers to use in the context of a k6 HTTP request | -| url | string | The signed url to use in the context of a k6 HTTP request | - -### Example - -{{< code >}} - -```javascript -import http from 'k6/http' - -import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.11.0/signature.js' - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}) - -export default function () { - /** - * In order to be able to sign an HTTP request's, - * we need to instantiate a SignatureV4 object. - */ - const signer = new SignatureV4({ - service: 's3', - region: awsConfig.region, - credentials: { - accessKeyId: awsConfig.accessKeyId, - secretAccessKey: awsConfig.secretAccessKey, - sessionToken: awsConfig.sessionToken, - }, - uriEscapePath: false, - applyChecksum: false, - }) - - /** - * The sign operation will return a new HTTP request with the - * AWS signature v4 protocol headers added. It returns an Object - * implementing the SignedHTTPRequest interface, holding a `url` and a `headers` - * properties, ready to use in the context of k6's http call. - */ - const signedRequest = signer.sign( - /** - * HTTP request description - */ - { - /** - * The HTTP method we will use in the request. - */ - method: 'GET', - - /** - * The network protocol we will use to make the request. - */ - protocol: 'https', - - /** - * The hostname of the service we will be making the request to. - */ - hostname: 'mybucket.s3.us-east-1.amazonaws.com', - - /** - * The path of the request. - */ - path: '/myfile.txt', - - /** - * The headers we will be sending in the request. - */ - headers: {}, - }, - - /** - * (optional) Signature operation options allows to override the - * SignatureV4's options in the context of this specific request. - */ - { - /** - * The date and time to be used as signature metadata. This value should be - * a Date object, a unix (epoch) timestamp, or a string that can be - * understood by the JavaScript `Date` constructor.If not supplied, the - * value returned by `new Date()` will be used. - */ - signingDate: new Date(), - - /** - * The service signing name. It will override the service name of the signer - * in current invocation - */ - signingService: 's3', - - /** - * The region name to sign the request. It will override the signing region of the - * signer in current invocation - */ - signingRegion: 'us-east-1', - } - ) - - http.get(signedRequest.url, { headers: signedRequest.headers }) -} -``` - -{{< /code >}} diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md deleted file mode 100644 index 5e1e6cbbcd..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/00 getParameter.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: 'SystemsManagerClient.getParameter()' -head_title: 'SystemsManagerClient.getParameter()' -slug: 'systemsmanagerclient-getparameter' -description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" ---- - -# SystemsManagerClient.getParameter() - -`SystemsManagerClient.getParameter` gets a Systems Manager parameter in the caller's AWS account and region. - -### Returns - -| Type | Description | -| :---------------------------------------------------------- | :------------------------------------------------------------------------ | -| [`Promise`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) | A Promise that fulfills with an array of [`SystemsManagerParameter`](https://grafana.com/docs/k6//javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/) objects. | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/ssm.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const systemsManager = new SystemsManagerClient(awsConfig); -const testParameterName = 'jslib-test-parameter'; -const testParameterValue = 'jslib-test-value'; -const testParameterSecretName = 'jslib-test-parameter-secret'; -// this value was created with --type SecureString -const testParameterSecretValue = 'jslib-test-secret-value'; - -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 = 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 } = await systemsManager.getParameter( - testParameterSecretName, - true - ); - if (encryptedParameterValue !== testParameterSecretValue) { - exec.test.abort('encrypted test parameter not found'); - } -} -``` - -_A k6 script querying a user's Systems Manager Service parameter_ - -{{< /code >}} - - diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md deleted file mode 100644 index 98e35dee3d..0000000000 --- a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/90 SystemsManagerParameter.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: 'SystemsManagerParameter' -head_title: 'SystemsManagerParameter' -slug: 'systemsmanagerparameter' -description: 'SystemsManagerParameter is returned by the SystemsManagerClient.* methods that query parameters' ---- - -# SystemsManagerParameter - -`SystemsManagerParameter.*` methods querying the Systems Manager Service parameters return some `SystemsManagerParameter` instances. Namely, `getParameter` returns an array of `SystemsManagerParameter` objects. The `SystemsManagerParameter` object describes an Amazon Systems Manager Service parameter. - -| Name | Type | Description | -| :----------------------------------------- | :----- | :------------------------------------------------------------------------------------ | -| `SystemsManagerParameter.arn` | string | The Amazon Resource Name (ARN) of the parameter | -| `SystemsManagerParameter.dataType` | string | The data type of the parameter, such as text or aws:ec2:image. The default is text. | -| `SystemsManagerParameter.lastModifiedDate` | number | Date the parameter was last changed or updated and the parameter version was created. | -| `SystemsManagerParameter.name` | string | The friendly name of the parameter. | -| `SystemsManagerParameter.selector` | string | Either the version number or the label used to retrieve the parameter value | -| `SystemsManagerParameter.sourceResult` | string | The raw result or response from the source. | -| `SystemsManagerParameter.type` | string | The type of parameter | -| `SystemsManagerParameter.value` | string | The parameter value | -| `SystemsManagerParameter.version` | string | The parameter version | - -### Example - -{{< code >}} - -```javascript -import exec from 'k6/execution'; - -import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.11.0/ssm.js'; - -const awsConfig = new AWSConfig({ - region: __ENV.AWS_REGION, - accessKeyId: __ENV.AWS_ACCESS_KEY_ID, - secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, - sessionToken: __ENV.AWS_SESSION_TOKEN, -}); - -const systemsManager = new SystemsManagerClient(awsConfig); -const testParameterName = 'jslib-test-parameter'; -const testParameterValue = 'jslib-test-value'; -const testParameterSecretName = 'jslib-test-parameter-secret'; -// this value was created with --type SecureString -const testParameterSecretValue = 'jslib-test-secret-value'; - -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 = 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 } = await systemsManager.getParameter( - testParameterSecretName, - true - ); - if (encryptedParameterValue !== testParameterSecretValue) { - exec.test.abort('encrypted test parameter not found'); - } -} -``` - -_A k6 script querying a user Systems Manager Service parameter_ - -{{< /code >}} \ No newline at end of file diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md index 075c991914..65fb130975 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md +++ b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -3,6 +3,7 @@ title: 'SystemsManagerParameter' head_title: 'SystemsManagerParameter' slug: 'systemsmanagerparameter' description: 'SystemsManagerParameter is returned by the SystemsManagerClient.* methods that query parameters' +weight: 20 --- # SystemsManagerParameter diff --git a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md index 14bca786f6..b8562bd1e8 100644 --- a/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md +++ b/docs/sources/next/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -2,9 +2,10 @@ title: 'getParameter' head_title: 'SystemsManagerClient.getParameter()' description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" +weight: 10 --- -# SystemsManagerClient.getParameter() +# getParameter `SystemsManagerClient.getParameter` gets a Systems Manager parameter in the caller's AWS account and region. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index cb0399ccca..fe7c0d9766 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -3,9 +3,10 @@ title: 'putEvents' head_title: 'EventBridgeClient.putEvents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' +weight: 10 --- -# EventBridgeClient.putEvents +# putEvents `EventBridgeClient.putEvents` sends custom events to Amazon EventBridge so that they can be matched to rules. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md index f4b836b143..cb182bdb01 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -3,6 +3,7 @@ title: 'KMSDataKey' slug: 'kmsdatakey' head_title: 'KMSDataKey' description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys' +weight: 20 --- # KMSDataKey diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md index 83f10505d0..1ebc680ec6 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -4,6 +4,7 @@ slug: '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' +weight: 20 --- # KMSKey diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md index a217e48cfa..022f5461a2 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -3,9 +3,10 @@ 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' +weight: 10 --- -# KMSClient.generateDataKey +# generateDataKey `KMSClient.generateDataKey` generates a symmetric data key for use outside of the AWS Key Management Service. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md index 26337a008c..850aa761d3 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -3,9 +3,10 @@ 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" +weight: 10 --- -# KMSClient.listKeys() +# listKeys() `KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md index e02e36a7a4..bc21456abe 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Bucket.md @@ -3,6 +3,7 @@ title: 'Bucket' head_title: 'Bucket' slug: 'bucket' description: 'Bucket is returned by the S3Client.* methods who query S3 buckets.' +weight: 20 --- # Bucket diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md index 264d9b7ba5..6866f1273b 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/Object.md @@ -3,6 +3,7 @@ title: 'Object' head_title: 'Object' slug: 'object' description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." +weight: 20 --- # Object diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md index 5831312cfe..7d3c300a59 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md @@ -3,6 +3,7 @@ title: 'S3MultipartUpload' head_title: 'S3MultipartUpload' slug: 's3multipartupload' description: 'S3MultipartUpload is returned by the S3Client.createMultipartUpload method when creating a multipart upload.' +weight: 20 --- # S3MultipartUpload diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md index bcc0a825c2..1799d367a0 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/S3Part.md @@ -3,6 +3,7 @@ title: 'S3Part' head_title: 'S3Part' slug: 's3part' description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +weight: 20 --- # S3Part diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md index d63ce836ad..a2a4377779 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -2,9 +2,10 @@ title: 'abortMultipartUpload' head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +weight: 10 --- -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) +# abortMultipartUpload `S3Client.abortMultipartUpload` aborts a multipart upload to an S3 bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md index 6546cc335c..73af544fe9 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -2,9 +2,10 @@ title: 'completeMultipartUpload' head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +weight: 10 --- -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) +# completeMultipartUpload `S3Client.completeMultipartUpload` uploads a multipart object to an S3 bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md index b3dbbaebf5..35fad4a8ad 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/copyObject.md @@ -2,9 +2,10 @@ title: 'copyObject' head_title: 'S3Client.copyObject' description: 'S3Client.copyObject copies an object from a bucket to another' +weight: 10 --- -# S3Client.copyObject +# copyObject `S3Client.copyObject` copies an object from one bucket to another. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md index b0ce51a4d2..dfe9201da0 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -2,9 +2,10 @@ title: 'createMultipartUpload' head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +weight: 10 --- -# S3Client.createMultipartUpload(bucketName, objectKey) +# createMultipartUpload `S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md index 154f85075e..34d4b8a69b 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -2,9 +2,10 @@ title: 'deleteObject' head_title: 'S3Client.deleteObject(bucketName, objectKey)' description: 'S3Client.deleteObject deletes an object from a bucket' +weight: 10 --- -# S3Client.deleteObject(bucketName, objectKey) +# deleteObject `S3Client.deleteObject` deletes an object from a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md index 0d66a1c4c5..6bace543d6 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/getObject.md @@ -2,9 +2,10 @@ title: 'getObject' head_title: 'S3Client.getObject(bucketName, objectKey)' description: 'S3Client.getObject downloads an object from a bucket' +weight: 10 --- -# S3Client.getObject(bucketName, objectKey) +# getObject `S3Client.getObject` downloads an object from a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md index 25272099ea..50415e1eb1 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -2,9 +2,10 @@ title: 'listBuckets' head_title: 'S3Client.listBuckets()' description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' +weight: 10 --- -# S3Client.listBuckets() +# listBuckets `S3Client.listBuckets()` lists the buckets the authenticated user has access to in the region set by the `S3Client` instance's configuration. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md index 3500c002e2..acdf5fb2cd 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/listObjects.md @@ -2,9 +2,10 @@ title: 'listObjects' head_title: 'S3Client.listObjects(bucketName, [prefix])' description: 'S3Client.listObjects lists the objects contained in a bucket' +weight: 10 --- -# S3Client.listObjects(bucketName, [prefix]) +# listObjects `S3Client.listObjects()` lists the objects contained in a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md index e3961bcebb..e95e8b9bcb 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/putObject.md @@ -2,9 +2,10 @@ title: 'putObject' head_title: 'S3Client.putObject(bucketName, objectKey, data)' description: 'S3Client.putObject uploads an object to a bucket' +weight: 10 --- -# S3Client.putObject(bucketName, objectKey, data) +# putObject `S3Client.putObject` uploads an object to a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md index 92dd1ccb41..a2eb64d96f 100755 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -2,9 +2,10 @@ title: 'uploadPart' head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +weight: 10 --- -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) +# uploadPart `S3Client.uploadPart` uploads a part to multipart upload in a bucket. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md index be7e54c381..b5555f4efb 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -3,9 +3,10 @@ title: 'listQueues' head_title: 'SQSClient.listQueues()' description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +weight: 10 --- -# SQSClient.listQueues() +# listQueues `SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md index 53e36ccbb7..e86c50cd6e 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -3,9 +3,10 @@ title: 'sendMessage' head_title: 'SQSClient.sendMessage()' description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +weight: 10 --- -# SQSClient.sendMessage() +# sendMessage `SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md index 848258797c..3be29700d6 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -3,6 +3,7 @@ title: 'Secret' head_title: 'Secret' slug: 'secret' description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' +weight: 20 --- # Secret diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md index 6f0afe7f7b..e40d06f4ab 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -2,9 +2,10 @@ title: 'createSecret' head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' description: 'SecretsManagerClient.createSecret creates a new secret' +weight: 10 --- -# SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags]) +# createSecret `SecretsManagerClient.createSecret` creates a secret in AWS' secrets manager. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md index 0a11bd591a..9344644c1c 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -2,9 +2,10 @@ title: 'deleteSecret' head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' description: 'SecretsManagerClient.deleteSecret deletes a secret' +weight: 10 --- -# SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}}) +# deleteSecret `SecretsManagerClient.deleteSecret` deletes a secret from AWS' secrets manager. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md index 3cd399502c..0174687df0 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -2,9 +2,10 @@ title: 'getSecret' head_title: 'SecretsManagerClient.getSecret(secretID)' description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' +weight: 10 --- -# SecretsManagerClient.getSecret(secretID) +# getSecret `SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md index 27586084ff..da8a744b29 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -2,9 +2,10 @@ title: 'listSecrets' head_title: 'SecretsManagerClient.listSecrets()' description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' +weight: 10 --- -# SecretsManagerClient.listSecrets() +# listSecrets `S3Client.listSecrets` lists the secrets the authenticated user has access to in the region set by the `SecretsManagerClient` instance's configuration. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md index 1d87a33197..7bb1a62b83 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -2,9 +2,10 @@ title: 'putSecretValue' head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' description: "SecretsManagerClient.putSecretValue updates an existing secret's value" +weight: 10 --- -# SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags]) +# putSecretValue `SecretsManagerClient.putSecretValue` updates a secret's value in AWS' secrets manager. diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md index 075c991914..65fb130975 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -3,6 +3,7 @@ title: 'SystemsManagerParameter' head_title: 'SystemsManagerParameter' slug: 'systemsmanagerparameter' description: 'SystemsManagerParameter is returned by the SystemsManagerClient.* methods that query parameters' +weight: 20 --- # SystemsManagerParameter diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md index 8f4299ec24..dbd36ef5a1 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -3,9 +3,10 @@ title: 'getParameter' head_title: 'SystemsManagerClient.getParameter()' slug: 'systemsmanagerclient-getparameter' description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" +weight: 10 --- -# SystemsManagerClient.getParameter() +# getParameter `SystemsManagerClient.getParameter` gets a Systems Manager parameter in the caller's AWS account and region. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md index cb0399ccca..fe7c0d9766 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/EventBridgeClient/putEvents.md @@ -3,9 +3,10 @@ title: 'putEvents' head_title: 'EventBridgeClient.putEvents' description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' excerpt: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge' +weight: 10 --- -# EventBridgeClient.putEvents +# putEvents `EventBridgeClient.putEvents` sends custom events to Amazon EventBridge so that they can be matched to rules. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md index f4b836b143..cb182bdb01 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSDataKey.md @@ -3,6 +3,7 @@ title: 'KMSDataKey' slug: 'kmsdatakey' head_title: 'KMSDataKey' description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys' +weight: 20 --- # KMSDataKey diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md index 3651e3721d..448732100a 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/KMSKey.md @@ -3,6 +3,7 @@ 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' +weight: 20 --- # KMSKey diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md index a217e48cfa..022f5461a2 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/generateDataKey.md @@ -3,9 +3,10 @@ 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' +weight: 10 --- -# KMSClient.generateDataKey +# generateDataKey `KMSClient.generateDataKey` generates a symmetric data key for use outside of the AWS Key Management Service. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md index 26337a008c..88fabd153f 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -3,9 +3,10 @@ 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" +weight: 10 --- -# KMSClient.listKeys() +# listKeys `KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md index 491ca77260..2870360952 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Bucket.md @@ -2,6 +2,7 @@ title: 'Bucket' head_title: 'Bucket' description: 'Bucket is returned by the S3Client.* methods who query S3 buckets.' +weight: 20 --- # Bucket diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md index e9891f93bb..4031a34f5a 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/Object.md @@ -2,6 +2,7 @@ title: 'Object' head_title: 'Object' description: "Object is returned by the S3Client.* methods who query S3 buckets' objects." +weight: 20 --- # Object diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md index 97fc171d0e..c84e89ecf5 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3Part.md @@ -3,6 +3,7 @@ title: 'S3Part' head_title: 'S3Part' slug: 's3part' description: 'S3Part is returned by the S3Client.uploadPart method when uploading a part to a multipart upload.' +weight: 20 --- # S3Part diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md index d63ce836ad..a2a4377779 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/abortMultipartUpload.md @@ -2,9 +2,10 @@ title: 'abortMultipartUpload' head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)' description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket' +weight: 10 --- -# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId) +# abortMultipartUpload `S3Client.abortMultipartUpload` aborts a multipart upload to an S3 bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md index 6546cc335c..73af544fe9 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/completeMultipartUpload.md @@ -2,9 +2,10 @@ title: 'completeMultipartUpload' head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)' description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket' +weight: 10 --- -# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts) +# completeMultipartUpload `S3Client.completeMultipartUpload` uploads a multipart object to an S3 bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md index b3dbbaebf5..35fad4a8ad 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/copyObject.md @@ -2,9 +2,10 @@ title: 'copyObject' head_title: 'S3Client.copyObject' description: 'S3Client.copyObject copies an object from a bucket to another' +weight: 10 --- -# S3Client.copyObject +# copyObject `S3Client.copyObject` copies an object from one bucket to another. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md index b0ce51a4d2..dfe9201da0 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/createMultipartUpload.md @@ -2,9 +2,10 @@ title: 'createMultipartUpload' head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)' description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket' +weight: 10 --- -# S3Client.createMultipartUpload(bucketName, objectKey) +# createMultipartUpload `S3Client.createMultipartUpload` creates a new multipart upload for a given an object key in a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md index 154f85075e..34d4b8a69b 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/deleteObject.md @@ -2,9 +2,10 @@ title: 'deleteObject' head_title: 'S3Client.deleteObject(bucketName, objectKey)' description: 'S3Client.deleteObject deletes an object from a bucket' +weight: 10 --- -# S3Client.deleteObject(bucketName, objectKey) +# deleteObject `S3Client.deleteObject` deletes an object from a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md index 0d66a1c4c5..6bace543d6 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/getObject.md @@ -2,9 +2,10 @@ title: 'getObject' head_title: 'S3Client.getObject(bucketName, objectKey)' description: 'S3Client.getObject downloads an object from a bucket' +weight: 10 --- -# S3Client.getObject(bucketName, objectKey) +# getObject `S3Client.getObject` downloads an object from a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md index 25272099ea..50415e1eb1 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listBuckets.md @@ -2,9 +2,10 @@ title: 'listBuckets' head_title: 'S3Client.listBuckets()' description: 'S3Client.listBuckets lists the buckets the authenticated user has access to' +weight: 10 --- -# S3Client.listBuckets() +# listBuckets `S3Client.listBuckets()` lists the buckets the authenticated user has access to in the region set by the `S3Client` instance's configuration. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md index 3500c002e2..acdf5fb2cd 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/listObjects.md @@ -2,9 +2,10 @@ title: 'listObjects' head_title: 'S3Client.listObjects(bucketName, [prefix])' description: 'S3Client.listObjects lists the objects contained in a bucket' +weight: 10 --- -# S3Client.listObjects(bucketName, [prefix]) +# listObjects `S3Client.listObjects()` lists the objects contained in a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md index e3961bcebb..e95e8b9bcb 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/putObject.md @@ -2,9 +2,10 @@ title: 'putObject' head_title: 'S3Client.putObject(bucketName, objectKey, data)' description: 'S3Client.putObject uploads an object to a bucket' +weight: 10 --- -# S3Client.putObject(bucketName, objectKey, data) +# putObject `S3Client.putObject` uploads an object to a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md index 92dd1ccb41..a2eb64d96f 100755 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/uploadPart.md @@ -2,9 +2,10 @@ title: 'uploadPart' head_title: 'S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data)' description: 'S3Client.uploadPart a part in a multipart upload to a bucket' +weight: 10 --- -# S3Client.uploadPart(bucketName, objectKey, uploadId,partNumber, data) +# uploadPart `S3Client.uploadPart` uploads a part to multipart upload in a bucket. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md index 50fa5f290f..3675c0b244 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/listQueues.md @@ -4,9 +4,10 @@ head_title: 'SQSClient.listQueues()' slug: 'sqsclient-listqueues' description: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' excerpt: 'SQSClient.listQueues retrieves a list of available Amazon SQS queues' +weight: 10 --- -# SQSClient.listQueues() +# listQueues `SQSClient.listQueues(options)` retrieves a list of available Amazon Simple Queue Service (SQS) queues. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md index 473877e93f..7ebbc72c3c 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SQSClient/sendMessage.md @@ -4,9 +4,10 @@ head_title: 'SQSClient.sendMessage()' slug: 'sqsclient-sendmessage' description: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' excerpt: 'SQSClient.sendMessage sends a message to the specified Amazon SQS queue' +weight: 10 --- -# SQSClient.sendMessage() +# sendMessage `SQSClient.sendMessage(queueUrl, messageBody, options)` sends a message to the specified Amazon Simple Queue Service (SQS) queue. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md index fb701d0f73..a96e22abbf 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/Secret.md @@ -2,6 +2,7 @@ title: 'Secret' head_title: 'Secret' description: 'Secret is returned by the SecretsManagerClient.* methods who query secrets from AWS secrets manager.' +weight: 20 --- # Secret diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md index 6f0afe7f7b..e40d06f4ab 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/createSecret.md @@ -2,9 +2,10 @@ title: 'createSecret' head_title: 'SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags])' description: 'SecretsManagerClient.createSecret creates a new secret' +weight: 10 --- -# SecretsManagerClient.createSecret(name, secretString, description, [versionID], [tags]) +# createSecret `SecretsManagerClient.createSecret` creates a secret in AWS' secrets manager. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md index 0a11bd591a..9344644c1c 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/deleteSecret.md @@ -2,9 +2,10 @@ title: 'deleteSecret' head_title: 'SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}})' description: 'SecretsManagerClient.deleteSecret deletes a secret' +weight: 10 --- -# SecretsManagerClient.deleteSecret(secretID, { recoveryWindow: 30, noRecovery: false}}) +# deleteSecret `SecretsManagerClient.deleteSecret` deletes a secret from AWS' secrets manager. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md index 3cd399502c..0174687df0 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/getSecret.md @@ -2,9 +2,10 @@ title: 'getSecret' head_title: 'SecretsManagerClient.getSecret(secretID)' description: 'SecretsManagerClient.getSecret(secretID) downloads a secret from AWS secrets manager' +weight: 10 --- -# SecretsManagerClient.getSecret(secretID) +# getSecret `SecretsManagerClient.getSecret` downloads a secret from AWS secrets manager. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md index 27586084ff..da8a744b29 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/listSecrets.md @@ -2,9 +2,10 @@ title: 'listSecrets' head_title: 'SecretsManagerClient.listSecrets()' description: 'SecretsManagerClient.listSecrets lists the secrets the authenticated user has access to' +weight: 10 --- -# SecretsManagerClient.listSecrets() +# listSecrets `S3Client.listSecrets` lists the secrets the authenticated user has access to in the region set by the `SecretsManagerClient` instance's configuration. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md index 1d87a33197..7bb1a62b83 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SecretsManagerClient/putSecretValue.md @@ -2,9 +2,10 @@ title: 'putSecretValue' head_title: 'SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags])' description: "SecretsManagerClient.putSecretValue updates an existing secret's value" +weight: 10 --- -# SecretsManagerClient.putSecretValue(secretID, secretString, [versionID], [tags]) +# putSecretValue `SecretsManagerClient.putSecretValue` updates a secret's value in AWS' secrets manager. diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md index 075c991914..65fb130975 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/SystemsManagerParameter.md @@ -3,6 +3,7 @@ title: 'SystemsManagerParameter' head_title: 'SystemsManagerParameter' slug: 'systemsmanagerparameter' description: 'SystemsManagerParameter is returned by the SystemsManagerClient.* methods that query parameters' +weight: 20 --- # SystemsManagerParameter diff --git a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md index 14bca786f6..b8562bd1e8 100644 --- a/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md +++ b/docs/sources/v0.48.x/javascript-api/jslib/aws/SystemsManagerClient/getParameter.md @@ -2,9 +2,10 @@ title: 'getParameter' head_title: 'SystemsManagerClient.getParameter()' description: "SystemsManagerClient.getParameter gets a Systems Manager parameter in the caller's AWS account and region" +weight: 10 --- -# SystemsManagerClient.getParameter() +# getParameter `SystemsManagerClient.getParameter` gets a Systems Manager parameter in the caller's AWS account and region. From a6a6da0dfa3a8a51916bb187b532d7551af0a3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Crevon?= Date: Wed, 27 Dec 2023 16:43:12 +0100 Subject: [PATCH 5/5] Update docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md Co-authored-by: Heitor Tashiro Sergent --- .../v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md index 850aa761d3..88fabd153f 100644 --- a/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md +++ b/docs/sources/v0.47.x/javascript-api/jslib/aws/KMSClient/listKeys.md @@ -6,7 +6,7 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account weight: 10 --- -# listKeys() +# listKeys `KMSClient.listKeys()` lists all the Key Management Service keys in the caller's AWS account and region.