-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
33 lines (24 loc) · 725 Bytes
/
cli.py
File metadata and controls
33 lines (24 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
profile = "varokas"
queue_name = "serverless-python-starter-events"
import click
import boto3
from typing import Optional
from backend import TestEvent
from lib.event import EventSource
@click.group()
def cli():
pass
@click.command("testevent")
@click.argument('text', required=True, type=click.UNPROCESSED)
def testevent(text: str):
event = TestEvent(name = "TestEvent", source = EventSource.queue, text = text)
session = boto3.session.Session(profile_name=profile)
sqs = session.resource('sqs')
queue = sqs.get_queue_by_name(QueueName=queue_name)
print(f"Sending Message: {event}")
queue.send_message(
MessageBody=event.json()
)
cli.add_command(testevent)
if __name__ == '__main__':
cli()