Consider the following code, which used to work (modulo new_with vs new and such) in 0.32:
extern crate rusoto_core;
extern crate rusoto_ec2;
extern crate rusoto_sts;
use rusoto_core::request::HttpClient;
use rusoto_core::Region;
use rusoto_ec2::Ec2Client;
use rusoto_sts::{StsAssumeRoleSessionCredentialsProvider, StsClient};
fn main() {
let sts = StsClient::new(Region::UsEast1);
let provider = StsAssumeRoleSessionCredentialsProvider::new(
sts,
"arn:aws:sts::1122334455:role/myrole".to_owned(),
"session-name".to_owned(),
None,
None,
None,
None,
);
Ec2Client::new_with(HttpClient::new().unwrap(), provider, Region::default());
}
This no longer compiles since rusoto_sts::custom::credential::StsSessionCredentialsClient is neither Send nor Sync, which Ec2Client::new_with now requires.
Oops! That should be a relatively easy fix though.
Would be great to also add at least a doc test for this so that we prevent regress again.
I think this basically breaks all use of STS, so probably something that should be relatively high priority. I'd be happy to give it a shot if you could give some guidance on what would need to be changed.
That鈥榙 be fantastic! I鈥榣l try to provide some guidance later today.
Okay, so here we go for initial mentoring instructions!
StsAssumeRoleSessionCredentialsProvider), that all wrap an StsClient in the form a boxed trait object (grep for Box<StsSessionCredentialsClient>)Send + Sync, we need to change the trait object to also include the Send and Sync markers, in other words, change the box to be Box<StsSessionCredentialsClient + Send + Sync>Send and Sync bounds as well)Sync and Send. You can see an example of how this is done here: https://github.com/rusoto/rusoto/blob/master/rusoto/core/src/future.rs#L121Let me know if this works for you @jonhoo, or whether you need more detail for any of the steps!
@srijs fixed in #1110.
Most helpful comment
Oops! That should be a relatively easy fix though.
Would be great to also add at least a doc test for this so that we prevent regress again.