From 8273107451569f49a07e01aa053819f7c330b7ba Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xKitsune@protonmail.com> Date: Thu, 1 Feb 2024 09:44:04 -0500 Subject: [PATCH] added sqs query to utils --- bin/utils.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/bin/utils.rs b/bin/utils.rs index 0a52f96..56d6271 100644 --- a/bin/utils.rs +++ b/bin/utils.rs @@ -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)] @@ -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(); @@ -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(())