Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 2e81d7b

Browse files
committed
feat: add sqs queue message form to library
1 parent a3a3dfd commit 2e81d7b

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { extend, extract } from '../../../src/index.js'
2+
3+
export default [extend('presets/base/typescript-cdk'), extract()]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<p align="center">
2+
<a href="https://buttonize.io">
3+
<img width="350" alt="Buttonize.io" src="https://user-images.githubusercontent.com/6282843/212024942-9fd50774-ea26-48ba-b2cf-ca2584498c9a.png">
4+
</a>
5+
</p>
6+
7+
---
8+
9+
## SQS Queue Message Form
10+
11+
[![SQS Queue Message Form](https://github.com/buttonize/create-buttonize/assets/6282843/3e9c6806-68c1-43ae-8412-0b8fb8c99b7e)](https://buttonize.io/library/sqs-queue-message-form)
12+
13+
Learn more about SQS Queue Message Form Construct [here](https://buttonize.io/library/sqs-queue-message-form).
14+
15+
## CDK
16+
17+
The `cdk.json` file tells the CDK Toolkit how to execute your app.
18+
19+
### Useful commands
20+
21+
* `npm run build` compile typescript to js
22+
* `npm run watch` watch for changes and compile
23+
* `npx cdk deploy` deploy this stack to your default AWS account/region
24+
* `npx cdk diff` compare deployed stack with current state
25+
* `npx cdk synth` emits the synthesized CloudFormation template
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import * as cdk from 'aws-cdk-lib'
2+
import { Queue } from 'aws-cdk-lib/aws-sqs'
3+
import { Buttonize, Input } from 'buttonize/cdk'
4+
import { SqsQueueMessageForm } from 'buttonize/library'
5+
import { Construct } from 'constructs'
6+
7+
export class ExampleStack extends cdk.Stack {
8+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
9+
super(scope, id, props)
10+
11+
Buttonize.init(this, {
12+
apiKey: '@@apiKey'
13+
})
14+
15+
const queue = new Queue(this, 'SqsQueue')
16+
17+
new SqsQueueMessageForm(this, 'QueueMessageForm', {
18+
name: 'Product cache invalidation panel',
19+
description:
20+
'Trigger invalidation of a product in all the caches in the in the company systems',
21+
queue,
22+
submitButtonLabel: 'Invalidate',
23+
fields: [
24+
Input.text({
25+
id: 'id',
26+
label: 'Product ID'
27+
}),
28+
Input.select({
29+
id: 'reason',
30+
options: [
31+
{ label: 'New manual update', value: 'manual_update' },
32+
{ label: 'System bug', value: 'bug' }
33+
]
34+
})
35+
],
36+
messageAttributes: {
37+
operation: 'invalidate'
38+
},
39+
messagePayload: {
40+
product: {
41+
pid: '{{id}}'
42+
},
43+
metadata: {
44+
reasonStatement: '{{reason.value}}'
45+
}
46+
}
47+
})
48+
}
49+
}

0 commit comments

Comments
 (0)