Skip to content

Commit c6db16c

Browse files
authored
Merge branch 'main' into assertions
2 parents c2e4fa5 + dee01bf commit c6db16c

File tree

631 files changed

+4719
-1939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+4719
-1939
lines changed

docs/sources/k6/next/extensions/explore.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ The Grafana team makes a best-effort assistance to keep these extensions in comp
183183
<h4>xk6-kv</h4>
184184
<p>Share key-value data between VUs</p>
185185
</a>
186+
<a href="https://github.com/kressnick25/xk6-ldap" target="_blank" class="nav-cards__item nav-cards__item--guide">
187+
<h4>xk6-ldap</h4>
188+
<p>Load-testing for the LDAP protocol</p>
189+
</a>
186190
<a href="https://github.com/grafana/xk6-loki" target="_blank" class="nav-cards__item nav-cards__item--guide">
187191
<h4>xk6-loki</h4>
188192
<p>Test Grafana Loki log ingestion endpoints</p>

docs/sources/k6/next/javascript-api/jslib/aws/EventBridgeClient/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
title: 'EventBridgeClient'
3-
head_title: 'EventBridgeClient'
43
description: 'EventBridgeClient allows interacting with AWS EventBridge service'
5-
description: 'EventBridgeClient class allows sending custom events to Amazon EventBridge so that they can be matched to rules.'
64
weight: 00
75
---
86

@@ -33,6 +31,8 @@ EventBridgeClient methods will throw errors in case of failure.
3331

3432
{{< code >}}
3533

34+
<!-- md-k6:skip -->
35+
3636
```javascript
3737
import {
3838
AWSConfig,

docs/sources/k6/next/javascript-api/jslib/aws/EventBridgeClient/putEvents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'putEvents'
3-
head_title: 'EventBridgeClient.putEvents'
4-
description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge'
53
description: 'EventBridgeClient.putEvents sends custom events to Amazon EventBridge'
64
weight: 10
75
---
@@ -43,6 +41,8 @@ weight: 10
4341

4442
{{< code >}}
4543

44+
<!-- md-k6:skip -->
45+
4646
```javascript
4747
import {
4848
AWSConfig,

docs/sources/k6/next/javascript-api/jslib/aws/KMSClient/KMSDataKey.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: 'KMSDataKey'
33
slug: 'kmsdatakey'
4-
head_title: 'KMSDataKey'
54
description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys'
65
weight: 20
76
---
@@ -22,6 +21,8 @@ For instance, the [`generateDataKey`](https://grafana.com/docs/k6/<K6_VERSION>/j
2221

2322
{{< code >}}
2423

24+
<!-- md-k6:skip -->
25+
2526
```javascript
2627
import exec from 'k6/execution';
2728

docs/sources/k6/next/javascript-api/jslib/aws/KMSClient/KMSKey.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'KMSKey'
3-
head_title: 'KMSKey'
4-
description: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
53
description: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
64
weight: 20
75
---
@@ -19,6 +17,8 @@ weight: 20
1917

2018
{{< code >}}
2119

20+
<!-- md-k6:skip -->
21+
2222
```javascript
2323
import exec from 'k6/execution';
2424

docs/sources/k6/next/javascript-api/jslib/aws/KMSClient/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'KMSClient'
3-
head_title: 'KMSClient'
4-
description: 'KMSClient allows interacting with the AWS Key Management Service'
53
description: 'KMSClient allows interacting with the AWS Key Management Service'
64
weight: 00
75
---
@@ -36,6 +34,8 @@ Both the dedicated `kms.js` jslib bundle and the all-encompassing `aws.js` bundl
3634

3735
{{< code >}}
3836

37+
<!-- md-k6:skip -->
38+
3939
```javascript
4040
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js';
4141

docs/sources/k6/next/javascript-api/jslib/aws/KMSClient/generateDataKey.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ weight: 10
2727

2828
{{< code >}}
2929

30+
<!-- md-k6:skip -->
31+
3032
```javascript
3133
import exec from 'k6/execution';
3234

docs/sources/k6/next/javascript-api/jslib/aws/KMSClient/listKeys.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'listKeys'
3-
head_title: 'KMSClient.listKeys()'
4-
description: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region"
53
description: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account and region"
64
weight: 10
75
---
@@ -20,6 +18,8 @@ weight: 10
2018

2119
{{< code >}}
2220

21+
<!-- md-k6:skip -->
22+
2323
```javascript
2424
import exec from 'k6/execution';
2525

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: 'KinesisClient'
3+
description: 'KinesisClient allows interacting with AWS Kinesis streams'
4+
weight: 00
5+
---
6+
7+
# KinesisClient
8+
9+
{{< docs/shared source="k6" lookup="blocking-aws-blockquote.md" version="<K6_VERSION>" >}}
10+
11+
`KinesisClient` interacts with the AWS Kinesis service.
12+
13+
With it, you can perform operations such as creating streams, putting records, listing streams, and reading records from streams. For a full list of supported operations, see [Methods](#methods).
14+
15+
Both the dedicated `kinesis.js` jslib bundle and the all-encompassing `aws.js` bundle include the `KinesisClient`.
16+
17+
### Methods
18+
19+
| Function | Description |
20+
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------- |
21+
| [createStream(streamName, [options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/createstream) | Create a new Kinesis stream |
22+
| [deleteStream(streamName)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/deletestream) | Delete a Kinesis stream |
23+
| [listStreams([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/liststreams) | List available Kinesis streams |
24+
| [putRecords(streamName, records)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/putrecords) | Put multiple records into a Kinesis stream |
25+
| [getRecords(shardIterator, [options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/getrecords) | Get records from a Kinesis stream shard |
26+
| [listShards(streamName, [options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/listshards) | List shards in a Kinesis stream |
27+
| [getShardIterator(streamName, shardId, shardIteratorType, [options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kinesisclient/getsharditerator) | Get a shard iterator for reading records from a stream |
28+
29+
### Throws
30+
31+
KinesisClient methods will throw errors in case of failure.
32+
33+
| Error | Condition |
34+
| :-------------------- | :--------------------------------------------------------- |
35+
| InvalidSignatureError | When invalid credentials are provided. |
36+
| KinesisServiceError | When AWS replies to the requested operation with an error. |
37+
38+
### Examples
39+
40+
41+
<!-- md-k6:skip -->
42+
43+
```javascript
44+
import { check } from 'k6';
45+
import exec from 'k6/execution';
46+
47+
import {
48+
AWSConfig,
49+
KinesisClient,
50+
} from 'https://jslib.k6.io/aws/{{< param "JSLIB_AWS_VERSION" >}}/kinesis.js';
51+
52+
const awsConfig = new AWSConfig({
53+
region: __ENV.AWS_REGION,
54+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
55+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
56+
});
57+
58+
const kinesis = new KinesisClient(awsConfig);
59+
const testStreamName = 'test-stream';
60+
61+
export default async function () {
62+
// List available streams
63+
const streams = await kinesis.listStreams();
64+
console.log('Available streams:', streams.streamNames);
65+
66+
// Check if our test stream exists
67+
if (!streams.streamNames.includes(testStreamName)) {
68+
// Create the stream if it doesn't exist
69+
await kinesis.createStream(testStreamName, { shardCount: 1 });
70+
console.log(`Created stream: ${testStreamName}`);
71+
}
72+
73+
// Put some records into the stream
74+
const records = [
75+
{
76+
data: JSON.stringify({ message: 'Hello from k6!', timestamp: Date.now() }),
77+
partitionKey: 'test-partition-1',
78+
},
79+
{
80+
data: JSON.stringify({ message: 'Another message', timestamp: Date.now() }),
81+
partitionKey: 'test-partition-2',
82+
},
83+
];
84+
85+
const putResult = await kinesis.putRecords(testStreamName, records);
86+
console.log('Put records result:', putResult);
87+
88+
// List shards in the stream
89+
const shards = await kinesis.listShards(testStreamName);
90+
console.log('Stream shards:', shards.shards);
91+
92+
// Get a shard iterator for reading records
93+
if (shards.shards.length > 0) {
94+
const shardId = shards.shards[0].shardId;
95+
const shardIterator = await kinesis.getShardIterator(testStreamName, shardId, 'TRIM_HORIZON');
96+
97+
// Get records from the shard
98+
const getResult = await kinesis.getRecords(shardIterator.shardIterator);
99+
console.log('Retrieved records:', getResult.records);
100+
}
101+
}
102+
```
103+
104+
105+
#### Stream management
106+
107+
108+
<!-- md-k6:skip -->
109+
110+
```javascript
111+
import {
112+
AWSConfig,
113+
KinesisClient,
114+
} from 'https://jslib.k6.io/aws/{{< param "JSLIB_AWS_VERSION" >}}/kinesis.js';
115+
116+
const awsConfig = new AWSConfig({
117+
region: __ENV.AWS_REGION,
118+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
119+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
120+
});
121+
122+
const kinesis = new KinesisClient(awsConfig);
123+
124+
export default async function () {
125+
const streamName = 'my-test-stream';
126+
127+
// Create a stream with on-demand billing
128+
await kinesis.createStream(streamName, {
129+
streamModeDetails: {
130+
streamMode: 'ON_DEMAND',
131+
},
132+
});
133+
134+
// List all streams
135+
const streams = await kinesis.listStreams();
136+
console.log('All streams:', streams.streamNames);
137+
138+
// Clean up - delete the stream
139+
await kinesis.deleteStream(streamName);
140+
console.log(`Deleted stream: ${streamName}`);
141+
}
142+
```
143+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: 'createStream'
3+
description: 'KinesisClient.createStream creates a new Kinesis stream'
4+
weight: 10
5+
---
6+
7+
# createStream
8+
9+
`KinesisClient.createStream(streamName, [options])` creates a new Kinesis stream.
10+
11+
### Parameters
12+
13+
| Parameter | Type | Description |
14+
| :--------- | :----- | :---------------------------------------------- |
15+
| streamName | string | The name of the Kinesis stream to create. |
16+
| options | object | Optional configuration for the stream creation. |
17+
18+
#### Options
19+
20+
| Parameter | Type | Description |
21+
| :--------------------------- | :----- | :-------------------------------------------------------------------- |
22+
| shardCount | number | The number of shards for the stream (for provisioned mode). |
23+
| streamModeDetails | object | Configuration for the stream mode. |
24+
| streamModeDetails.streamMode | string | The billing mode for the stream. Either `PROVISIONED` or `ON_DEMAND`. |
25+
26+
### Returns
27+
28+
| Type | Description |
29+
| :-------------- | :-------------------------------------------------------------------- |
30+
| `Promise<void>` | A Promise that fulfills when the stream creation request is complete. |
31+
32+
### Example
33+
34+
35+
<!-- md-k6:skip -->
36+
37+
```javascript
38+
import {
39+
AWSConfig,
40+
KinesisClient,
41+
} from 'https://jslib.k6.io/aws/{{< param "JSLIB_AWS_VERSION" >}}/kinesis.js';
42+
43+
const awsConfig = new AWSConfig({
44+
region: __ENV.AWS_REGION,
45+
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
46+
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
47+
});
48+
49+
const kinesis = new KinesisClient(awsConfig);
50+
51+
export default async function () {
52+
// Create a stream with provisioned billing and 2 shards
53+
await kinesis.createStream('my-provisioned-stream', {
54+
shardCount: 2,
55+
});
56+
57+
// Create a stream with on-demand billing
58+
await kinesis.createStream('my-on-demand-stream', {
59+
streamModeDetails: {
60+
streamMode: 'ON_DEMAND',
61+
},
62+
});
63+
}
64+
```
65+

0 commit comments

Comments
 (0)