Skip to content

Commit

Permalink
Merge pull request #15 from worldcoin/0xkitsune/queue-utils
Browse files Browse the repository at this point in the history
feat(utils): add sqs query to utils
  • Loading branch information
0xKitsune authored Feb 1, 2024
2 parents 0cda30e + 8273107 commit 0dbd1cf
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions bin/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use rand::{thread_rng, Rng};

#[derive(Debug, Clone, Parser)]
enum Opt {
RandomQuery(RandomQuery),
HttpQuery(RandomQuery),
SQSQuery(RandomQuery),
}

#[derive(Debug, Clone, Args)]
Expand All @@ -20,7 +21,7 @@ async fn main() -> eyre::Result<()> {
let args = Opt::parse();

match args {
Opt::RandomQuery(args) => {
Opt::HttpQuery(args) => {
let mut rng = thread_rng();

let template: Template = rng.gen();
Expand All @@ -32,6 +33,26 @@ async fn main() -> eyre::Result<()> {
.await?
.error_for_status()?;
}

Opt::SQSQuery(args) => {
let aws_config = aws_config::load_defaults(
aws_config::BehaviorVersion::latest(),
)
.await;

let aws_client = aws_sdk_sqs::Client::new(&aws_config);

let mut rng = thread_rng();

let template: Template = rng.gen();

aws_client
.send_message()
.queue_url(args.url)
.message_body(serde_json::to_string(&template)?)
.send()
.await?;
}
}

Ok(())
Expand Down

0 comments on commit 0dbd1cf

Please sign in to comment.