Skip to content
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

Add @optionalAuth to all S3 operations #2955

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ message = "Update MSRV to Rust 1.70.0"
references = ["smithy-rs#2948"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" }
author = "Velfi"

[[aws-sdk-rust]]
message = "Allow `no_credentials` to be used with all S3 operations."
references = ["smithy-rs#2955", "aws-sdk-rust#878"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "jdisanti"
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,9 @@ class FilterEndpointTests(

// TODO(P96049742): This model transform may need to change depending on if and how the S3 model is updated.
private class AddOptionalAuth {
private val s3OptionalAuthOperations = listOf(
ShapeId.from("com.amazonaws.s3#ListObjects"),
ShapeId.from("com.amazonaws.s3#ListObjectsV2"),
ShapeId.from("com.amazonaws.s3#HeadObject"),
ShapeId.from("com.amazonaws.s3#GetObject"),
)

fun transform(model: Model) = ModelTransformer.create().mapShapes(model) { shape ->
if (shape is OperationShape && s3OptionalAuthOperations.contains(shape.id) && !shape.hasTrait<OptionalAuthTrait>()) {
// Add @optionalAuth to all S3 operations
if (shape is OperationShape && !shape.hasTrait<OptionalAuthTrait>()) {
shape.toBuilder()
.addTrait(OptionalAuthTrait())
.build()
Expand Down