Skip to content

Commit

Permalink
Merge branch 'version/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed Sep 29, 2023
2 parents 58a329d + c09008a commit da9112b
Show file tree
Hide file tree
Showing 25 changed files with 440 additions and 394 deletions.
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ At the moment, this library provides the following:
* `SQS`: allows to list queues and send messages from AWS SQS.
* `KMS`: allows to list KMS keys and generate a unique symmetric data key for use outside of AWS KMS
* `SSM`: allows to retrieve a parameter from AWS Systems Manager
* `Kinesis`: allows to list streams, create streams, put records, list shards, get shard iterators, and get records from AWS Kinesis.
* `EventBridge`: allows to put events to AWS EventBridge.
* `V4 signature`: allows to sign requests to amazon AWS services
* `KinesisClient`: allows all APIs for Kinesis available by AWS.

Expand All @@ -34,7 +36,7 @@ import { check } from 'k6';
import exec from 'k6/execution';
import http from 'k6/http';

import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.9.0/s3.js';
import { AWSConfig, S3Client } from 'https://jslib.k6.io/aws/0.10.0/s3.js';

const awsConfig = new AWSConfig(
__ENV.AWS_REGION,
Expand Down Expand Up @@ -93,7 +95,7 @@ Consult the `SecretsManagerClient` [dedicated k6 documentation page](https://k6.
```javascript
import exec from 'k6/execution'

import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/secrets-manager.js'
import { AWSConfig, SecretsManagerClient } from 'https://jslib.k6.io/aws/0.10.0/secrets-manager.js'

const awsConfig = new AWSConfig(
__ENV.AWS_REGION,
Expand Down Expand Up @@ -145,7 +147,7 @@ import { check } from 'k6';
import exec from 'k6/execution';
import http from 'k6/http';

import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.9.0/sqs.js';
import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.10.0/sqs.js';

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down Expand Up @@ -216,7 +218,7 @@ Consult the `SystemsManagerClient` [dedicated k6 documentation page](https://k6.
```javascript
import exec from 'k6/execution'

import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.9.0/ssm.js';
import { AWSConfig, SystemsManagerClient } from 'https://jslib.k6.io/aws/0.10.0/ssm.js';

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down Expand Up @@ -263,7 +265,7 @@ import exec from 'k6/execution'
import encoding from 'k6/encoding';
import { fail } from 'k6';

import { AWSConfig, KinesisClient } from 'https://jslib.k6.io/aws/0.9.0/kinesis.js'
import { AWSConfig, KinesisClient } from 'https://jslib.k6.io/aws/0.10.0/kinesis.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down Expand Up @@ -327,6 +329,41 @@ export default async function () {
}
```

### EventBridge

Consult the `EventBridgeClient` [dedicated k6 documentation page](https://k6.io/docs/javascript-api/jslib/aws/eventbridgeclient) for more details on its methods and how to use it.

```javascript
import { AWSConfig, EventBridgeClient } from 'https://jslib.k6.io/aws/0.10.0/event-bridge.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 eventBridge = new EventBridgeClient(awsConfig);

export default async function () {
const eventDetails = {
Source: 'my.custom.source',
Detail: { key1: 'value1', key2: 'value2' },
DetailType: 'MyDetailType',
Resources: ['arn:aws:resource1'],
};

const input = {
Entries: [eventDetails]
};

try {
await eventBridge.putEvents(input);
} catch (error) {
console.error(`Failed to put events: ${error.message}`);
}
}
```


## Development
Expand Down
2 changes: 1 addition & 1 deletion build/aws.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/aws.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/event-bridge.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/event-bridge.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/kinesis.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/kinesis.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/kms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/kms.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/s3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/s3.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/secrets-manager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/secrets-manager.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/signature.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/signature.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/sqs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/sqs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/ssm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/ssm.js.map

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions examples/event-bridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { AWSConfig, EventBridgeClient } from '../build/event-bridge.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 eventBridge = new EventBridgeClient(awsConfig);

export default async function () {
const eventDetails = {
Source: 'my.custom.source',
Detail: { key1: 'value1', key2: 'value2' },
DetailType: 'MyDetailType',
Resources: ['arn:aws:resource1'],
};

const input = {
Entries: [eventDetails]
};

try {
await eventBridge.putEvents(input);
} catch (error) {
console.error(`Failed to put events: ${error.message}`);
}
}
Loading

0 comments on commit da9112b

Please sign in to comment.