Skip to content

Commit 3ae6b37

Browse files
authored
Merge pull request #1140 from grafana/aws/v0.7.2
Update documentation to reflect changes in aws v0.7.2
2 parents f8575fe + fe1cf9f commit 3ae6b37

31 files changed

+210
-35
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@ excerpt: "aws is a library implementing APIs for accessing a selection of AWS se
44
description: "aws is a library implementing APIs for accessing a selection of AWS servicese"
55
---
66

7-
The `aws` module is a JavaScript library that wraps around some Amazon AWS services API.
7+
The `aws` module is a JavaScript library that wraps around some Amazon AWS services API.
88

99
The library exposes a couple of configuration and client classes allowing to interact with a subset of AWS services in the context of k6 load test scripts:
1010
- [S3Client](/javascript-api/jslib/aws/s3client): a class to list S3 buckets and the objects they contain, as well as uploading, downloading and deleting objects from them.
1111
- [SecretsManagerClient](/javascript-api/jslib/aws/secretsmanagerclient): a class to list, get, create, update, and delete secrets from the AWS secrets manager service.
1212
- [KMSClient](/javascript-api/jslib/aws/kmsclient): a class to list and generate keys from the AWS Key Management Service.
1313
- [SystemsManagerClient](/javascript-api/jslib/aws/systemsmanagerclient): a class to fetch parameters from the AWS Systems Manager Service.
14+
- [SQSClient](/javascript-api/jslib/aws/sqsclient): a class to list and send messages to SQS queues.
1415
- [SignatureV4](/javascript-api/jslib/aws/signaturev4): a class to sign and pre-sign requests to AWS services using the [Signature V4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) algorithm.
1516
- [AWSConfig](/javascript-api/jslib/aws/awsconfig/): a class is used by each client classes to provide them access to AWS credentials as well as configuration.
1617

17-
> ⭐️ Source code available on [GitHub](https://github.com/grafana/k6-jslib-aws).
18+
> ⭐️ Source code available on [GitHub](https://github.com/grafana/k6-jslib-aws).
1819
> Please request features and report bugs through [GitHub issues](https://github.com/grafana/k6-jslib-aws/issues).
1920
2021

2122
<Blockquote mod='info'>
2223

2324
#### This library is in active development
2425

25-
This library is stable enough to be useful, but pay attention to the new versions released on [jslib.k6.io](https://jslib.k6.io) and [k6-jslib-aws/releases](https://github.com/grafana/k6-jslib-aws/releases).
26+
This library is stable enough to be useful, but pay attention to the new versions released on [jslib.k6.io](https://jslib.k6.io) and [k6-jslib-aws/releases](https://github.com/grafana/k6-jslib-aws/releases).
2627

2728
This documentation is for the last version only. If you discover that some code below does not work, it most likely means that you are using an older version.
2829

@@ -35,5 +36,6 @@ This documentation is for the last version only. If you discover that some code
3536
| [S3Client](/javascript-api/jslib/aws/s3client) | Client class to interact with AWS S3 buckets and objects. |
3637
| [SecretsManager](/javascript-api/jslib/aws/secretsmanagerclient) | Client class to interact with AWS secrets stored in Secrets Manager. |
3738
| [KMSClient](/javascript-api/jslib/aws/kmsclient) | Client class to interact with AWS Key Management Service. |
39+
| [SQSClient](/javascript-api/jslib/aws/sqsclient) | Client class to interact with AWS Simple Queue Service. |
3840
| [SystemsManagerClient](/javascript-api/jslib/aws/systemsmanagerclient) | Client class to interact with AWS Systems Manager Service. |
3941
| [AWSConfig](/javascript-api/jslib/aws/awsconfig) | Class to configure AWS client classes. |

src/data/markdown/docs/20 jslib/01 jslib/01 aws/01 S3Client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { check } from 'k6';
3737
import exec from 'k6/execution';
3838
import http from 'k6/http';
3939

40-
import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.7.1/s3.js';
40+
import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.7.2/s3.js';
4141

4242
const awsConfig = new AWSConfig({
4343
region: __ENV.AWS_REGION,

src/data/markdown/docs/20 jslib/01 jslib/01 aws/02 SecretsManagerClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ S3 Client methods will throw errors in case of failure.
3535
```javascript
3636
import exec from 'k6/execution';
3737

38-
import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.7.1/secrets-manager.js';
38+
import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.7.2/secrets-manager.js';
3939

4040
const awsConfig = new AWSConfig({
4141
region: __ENV.AWS_REGION,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ excerpt: 'KMSClient allows interacting with the AWS Key Management Service'
88
`KMSClient` interacts with the AWS Key Management Service.
99
With it, the user can list all the Key Management Service keys in the caller's AWS account and region. They can also generate symmetric data keys to use outside of AWS Key Management Service. `KMSClient` operations are blocking. k6 recommends reserving their use to the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) stages as much as possible.
1010

11-
Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundle include the `KMSClient`.
11+
Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundle include the `KMSClient`.
1212

1313
### Methods
1414

@@ -33,7 +33,7 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl
3333
```javascript
3434
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js';
3535

36-
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.1/kms.js';
36+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.2/kms.js';
3737

3838
const awsConfig = new AWSConfig({
3939
region: __ENV.AWS_REGION,

src/data/markdown/docs/20 jslib/01 jslib/01 aws/04 SystemsManagerClient.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ excerpt: 'SystemsManagerClient allows interacting with the AWS Systems Manager S
88
`SystemsManagerClient` interacts with the AWS Systems Manager Service.
99
With it, the user can get parameters from the Systems Manager Service in the caller's AWS account and region. `SystemsManagerClient` operations are blocking. k6 recommends reserving their use to the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) stages as much as possible.
1010

11-
Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundle include the `SystemsManagerClient`.
11+
Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundle include the `SystemsManagerClient`.
1212

1313
### Methods
1414

@@ -32,7 +32,7 @@ Both the dedicated `ssm.js` jslib bundle and the all-encompassing `aws.js` bundl
3232
```javascript
3333
import exec from 'k6/execution';
3434

35-
import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.7.1/ssm.js';
35+
import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.7.2/ssm.js';
3636

3737
const awsConfig = new AWSConfig({
3838
region: __ENV.AWS_REGION,

src/data/markdown/docs/20 jslib/01 jslib/01 aws/05 AwsConfig.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ It takes an options object as its single parameter, with the following propertie
1818
| secretAccessKey | string | The AWS secret access credential to use for authentication. |
1919
| sessionToken (optional) | string | The AWS secret access token to use for authentication. |
2020

21+
### Methods
22+
23+
| Name | Description |
24+
| :------------------ | :----------------------------------------------------------------------------------------------------------------------------------------- |
25+
| `fromEnvironment()` | Creates an `AWSConfig` using the `AWS_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` environment variables. |
26+
2127
### Throws
2228

2329
S3 Client methods will throw errors in case of failure.
@@ -35,7 +41,7 @@ import exec from 'k6/execution';
3541

3642
// Note that you AWSConfig is also included in the dedicated service
3743
// client bundles such as `s3.js` and `secrets-manager.js`
38-
import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.7.1/aws.js';
44+
import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.7.2/aws.js';
3945

4046
const awsConfig = new AWSConfig({
4147
region: __ENV.AWS_REGION,

src/data/markdown/docs/20 jslib/01 jslib/01 aws/06 SignatureV4.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The `presign` operation produces a pre-signed request with authorization informa
1010

1111
SignatureV4 is included in both the dedicated jslib `signature.js` bundle and the `aws.js` one, containing all the service's clients.
1212

13-
Instantiating a new `SignatureV4` requires a single options object argument with the following properties:
13+
Instantiating a new `SignatureV4` requires a single options object argument with the following properties:
1414

1515
| Property | Type | Description |
1616
| :------------ | :---------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -44,7 +44,7 @@ SignatureV4 methods throw errors on failure.
4444
```javascript
4545
import http from 'k6/http.js'
4646

47-
import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.7.1/aws.js'
47+
import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.7.2/aws.js'
4848

4949
const awsConfig = new AWSConfig({
5050
region: __ENV.AWS_REGION,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: 'SQSClient'
3+
head_title: 'SQSClient'
4+
description: 'SQSClient enables interaction with the AWS Simple Queue Service (SQS)'
5+
excerpt: 'SQSClient allows interacting with the AWS Simple Queue Service (SQS)'
6+
---
7+
8+
`SQSClient` interacts with the AWS Simple Queue Service (SQS). With it, the user can send messages to specified queues and list available queues in the current region. `SQSClient` operations are blocking. k6 recommends reserving their use for the [`setup`](/using-k6/test-lifecycle/) and [`teardown`](/using-k6/test-lifecycle/) stages as much as possible.
9+
10+
Both the dedicated `sqs.js` jslib bundle and the all-encompassing `aws.js` bundle include the `SQSClient`.
11+
12+
### Methods
13+
14+
| Function | Description |
15+
| :--------------------------------------------------------------- | :--------------------------------------------------- |
16+
| [`sendMessage`](/javascript-api/jslib/aws/sqsclient/sqsclient-sendmessage) | Delivers a message to the specified queue. |
17+
| [`listQueues`](/javascript-api/jslib/aws/sqsclient/sqsclient-listqueues) | Returns a list of your queues in the current region. |
18+
19+
### Throws
20+
21+
`SQSClient` methods throw errors in case of failure.
22+
23+
| Error | Condition |
24+
| :---------------------- | :-------------------------------------------------------- |
25+
| `InvalidSignatureError` | when using invalid credentials |
26+
| `SQSServiceError` | when AWS replied to the requested operation with an error |
27+
28+
### Example
29+
30+
<CodeGroup labels={[]}>
31+
32+
```javascript
33+
import exec from 'k6/execution'
34+
35+
import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.7.2/sqs.js'
36+
37+
const awsConfig = new AWSConfig({
38+
region: __ENV.AWS_REGION,
39+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
40+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
41+
sessionToken: __ENV.AWS_SESSION_TOKEN,
42+
})
43+
44+
const sqs = new SQSClient(awsConfig)
45+
const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue'
46+
47+
export default function () {
48+
// If our test queue does not exist, abort the execution.
49+
const queuesResponse = sqs.listQueues()
50+
if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) {
51+
exec.test.abort()
52+
}
53+
54+
// Send message to test queue
55+
sqs.sendMessage(testQueue, JSON.stringify({value: '123'}));
56+
}
57+
```
58+
59+
</CodeGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account
1919
```javascript
2020
import exec from 'k6/execution';
2121

22-
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.1/kms.js';
22+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.2/kms.js';
2323

2424
const awsConfig = new AWSConfig({
2525
region: __ENV.AWS_REGION,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi
2626
```javascript
2727
import exec from 'k6/execution';
2828

29-
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.1/kms.js';
29+
import { AWSConfig, KMSClient } from 'https://jslib.k6.io/aws/0.7.2/kms.js';
3030

3131
const awsConfig = new AWSConfig({
3232
region: __ENV.AWS_REGION,

0 commit comments

Comments
 (0)