-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pubsys: update to AWS SDK Rust #2415
Conversation
efcacc8
to
dbf6609
Compare
Fixed the result unwrapping issue while also improving how and where the profile gets loaded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me - with the caveat that I am not very familiar with this code. But updated code looks logical, and maybe most importantly, all tests are passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, if you're not already doing so it'd probably be good to run down the entire set of pubsys commands in your own account, making sure that the grant/revoke and SSM params all work as expected. Those are super important.
tools/pubsys/src/aws/client.rs
Outdated
} | ||
// Load a chained credential config if role is specified in aws.region.REGION.role. | ||
let maybe_regional_role = aws.region.get(®ion).and_then(|r| r.role.clone()); | ||
let config = if maybe_regional_role.is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about this let config
... are we replacing the config
we just built?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but I can rename it to make it more clear.
dbf6609
to
7946314
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7946314
to
deea371
Compare
|
Tested check-repo-expirations:
Tested
Tested
|
.set_device_name(Some(ROOT_DEVICE_NAME.to_string())) | ||
.set_ebs(Some( | ||
EbsBlockDevice::builder() | ||
.set_delete_on_termination(Some(true)) | ||
.set_snapshot_id(Some(root_snapshot.clone())) | ||
.set_volume_type(Some(VolumeType::from(VOLUME_TYPE))) | ||
.set_volume_size(ami_args.root_volume_size) | ||
.build(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sdk allows not including Some
if you set the values without set_
. (This happens in a lot of places so might not be in the scope of this pr)
.set_device_name(Some(ROOT_DEVICE_NAME.to_string())) | |
.set_ebs(Some( | |
EbsBlockDevice::builder() | |
.set_delete_on_termination(Some(true)) | |
.set_snapshot_id(Some(root_snapshot.clone())) | |
.set_volume_type(Some(VolumeType::from(VOLUME_TYPE))) | |
.set_volume_size(ami_args.root_volume_size) | |
.build(), | |
.device_name(ROOT_DEVICE_NAME.to_string()) | |
.ebs(EbsBlockDevice::builder() | |
.delete_on_termination(true) | |
.snapshot_id(root_snapshot.clone()) | |
.volume_type(VolumeType::from(VOLUME_TYPE)) | |
.set_volume_size(ami_args.root_volume_size) | |
.build(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely works, but my understanding was the setters are more idiomatic for the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you see the perspective on idiomatic use? Not disagreeing, and it's not a blocker here in any case, but for me the code that @ecpullen wrote seems preferable since it's fewer characters and we don't have to wrap everything in an Option
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just an impression we got from the SDK team that the non-setter way might eventually be deprecated.
deea371
to
1ec0fc4
Compare
|
tools/pubsys/src/aws/mod.rs
Outdated
fn region_from_string(name: &str) -> Result<Region> { | ||
Ok(Region::new(name.to_owned())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is infallible now we should probably just return a Region
. However, I like it this way for the purposes of the SDK migration, to minimize the diff. Maybe add a FIXME
to rework later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty quick change. Rather than a FIXME
, should I just make it the final change once we think this PR hits all the edge cases?
1ec0fc4
to
347308c
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦺
347308c
to
6204440
Compare
|
6204440
to
1707005
Compare
Suppressed noisy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔬
1707005
to
1175053
Compare
Issue number:
#1968
Description of changes:
Replaces rusoto with aws-sdk-for-rust in pubsys.
Testing done:
TUF testing done:
Thanks, @etungsten!
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.