-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f09ca81
commit 84b38ea
Showing
3 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
docs/sources/next/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: 'S3MultipartUpload' | ||
description: 'S3MultipartUpload is returned by the S3Client.createMultipartUpload method when creating a multipart upload.' | ||
weight: 20 | ||
--- | ||
|
||
# S3MultipartUpload | ||
|
||
S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectKey)`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/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 >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
docs/sources/v0.48.x/javascript-api/jslib/aws/S3Client/S3MultipartUpload.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: 'S3MultipartUpload' | ||
description: 'S3MultipartUpload is returned by the S3Client.createMultipartUpload method when creating a multipart upload.' | ||
weight: 20 | ||
--- | ||
|
||
# S3MultipartUpload | ||
|
||
S3MultipartUpload is returned by the [`createMultipartUpload(bucketName, objectKey)`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/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 >}} |