-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use crate::scheduler_client::Scheduler; | ||
use crate::sfn_client::Sfn; | ||
|
||
pub struct Context { | ||
pub sfn_client: Sfn, | ||
pub scheduler_client: Scheduler, | ||
} | ||
|
||
impl Context { | ||
pub fn new(sfn_client: Sfn, scheduler_client: Scheduler) -> Self { | ||
Self { | ||
sfn_client, | ||
scheduler_client, | ||
} | ||
} | ||
|
||
#[cfg(not(test))] | ||
pub async fn async_default() -> Self { | ||
use aws_config::BehaviorVersion; | ||
|
||
use crate::{scheduler_client, sfn_client}; | ||
|
||
let aws_config = aws_config::load_defaults(BehaviorVersion::latest()).await; | ||
let sfn_client = sfn_client::Sfn::new(aws_sdk_sfn::Client::new(&aws_config)); | ||
let scheduler_client = scheduler_client::Scheduler::new(aws_sdk_scheduler::Client::new(&aws_config)); | ||
|
||
Self { | ||
sfn_client, | ||
scheduler_client, | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
pub async fn async_default() -> Self { | ||
use crate::sfn_client::MockSfnImpl; | ||
use crate::scheduler_client::MockSchedulerImpl; | ||
|
||
Self { | ||
sfn_client: MockSfnImpl::default(), | ||
scheduler_client: MockSchedulerImpl::default(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod cli; | ||
pub mod commands; | ||
pub mod context; | ||
pub mod jsonnet_evaluator; | ||
pub mod scheduler_client; | ||
pub mod sfn_client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters