All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.sivalabs.localstack.autoconfigure.configurator.AbstractAmazonClient Maven / Gradle / Ivy

package io.github.sivalabs.localstack.autoconfigure.configurator;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import lombok.RequiredArgsConstructor;
import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.containers.localstack.LocalStackContainer.Service;

@RequiredArgsConstructor
public abstract class AbstractAmazonClient {
    protected final LocalStackContainer localStackContainer;

    protected EndpointConfiguration getEndpointConfiguration(Service service) {
        return localStackContainer.getEndpointConfiguration(service);
    }

    protected AWSCredentialsProvider getCredentialsProvider() {
        return new AWSStaticCredentialsProvider(
                new BasicAWSCredentials(localStackContainer.getAccessKey(), localStackContainer.getSecretKey())
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy