quarkiverse / quarkus-amazon-services

Quarkus Amazon Services extensions
Apache License 2.0
41 stars 49 forks source link

Multi-tenant aws clients #1108

Closed kpagratis closed 6 months ago

kpagratis commented 8 months ago

I'm building an app where i need aws clients like S3 and SecretsManger to be configured based on incoming request information. To do this, I have a requestscoped bean which eventually gets populated with an IAM role arn. This arn is then used in the creation of a credentials provider which uses STS to get temporary tokens.

I was hoping to use this extension but I'm running into a few issues. Primarily, the clients and client builders are @ApplicationScoped. This would be possible if the builders were @dependent scoped since calling build on the aws builder mutates the internal state of the builders and throw exceptions when calling build again.

Is there something I'm missing in this extension which would help me accomplish what I'm trying to do?

I'd like to continue using this extension because of all the great work done around configuration and devservices with localstack.

Thanks!

scrocquesel commented 8 months ago

Could overriding configuration at request level be a solution ?

ex:

public static CreateBucketRequest createBucketRequest(final String bucket) {
        return CreateBucketRequest.builder()
                .bucket(bucket)
                .overrideConfiguration(b -> b.credentialsProvider(...))
                .build();
    }
kpagratis commented 8 months ago

I suppose that would work just fine. I was unaware of that functionality! I'll give that a try. Thanks!

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 6 months ago

This issue was closed because it has been stalled for 14 days with no activity.