I am trying to get information on CodePipeline via the Rust aws-sdk-codepipeline
.
When using my default environment, everything work like a charm:
use aws_sdk_codepipeline as codepipeline;
main() {
let config = aws_config::load_from_env().await;
let client = codepipeline::Client::new(&config);
...
}
I am able to run client.list_pipelines()
, etc.. and get the data I need. However, I also need to get information on other accounts as well. This is where I turned to aws-sdk-sts
to use assume_role
.
I have the following code that successfully accomplished that:
use aws_sdk_sts as sts;
main() {
let assumed_role_output = sts::Client::new(&aws_config::load_from_env().await)
.assume_role()
.role_arn("arn:aws:iam::012345678910:role/dev-ops-role")
.role_session_name("devops")
.send()
.await
.unwrap();
let credentials = assumed_role_output.credentials().unwrap();
This gives me the &Credentials
, but where I am stumped is how to get said credentials into the aws_config
so it can be used to create a CodePipeline Client
for the assumed role.