public class LocalStackContainer extends org.testcontainers.containers.GenericContainer<LocalStackContainer>
| Modifier and Type | Class and Description |
|---|---|
static interface |
LocalStackContainer.EnabledService |
static class |
LocalStackContainer.Service |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VERSION
Deprecated.
|
| Constructor and Description |
|---|
LocalStackContainer()
Deprecated.
use
LocalStackContainer(DockerImageName) instead |
LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName) |
LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName,
boolean useLegacyMode)
Deprecated.
use
LocalStackContainer(DockerImageName) instead |
LocalStackContainer(java.lang.String version)
Deprecated.
use
LocalStackContainer(DockerImageName) instead |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure() |
java.lang.String |
getAccessKey()
Provides a default access key that is preconfigured to communicate with a given simulated service.
|
java.net.URI |
getEndpointOverride(LocalStackContainer.EnabledService service)
Provides an endpoint override that is preconfigured to communicate with a given simulated service.
|
java.net.URI |
getEndpointOverride(LocalStackContainer.Service service) |
java.lang.String |
getRegion()
Provides a default region that is preconfigured to communicate with a given simulated service.
|
java.lang.String |
getSecretKey()
Provides a default secret key that is preconfigured to communicate with a given simulated service.
|
LocalStackContainer |
withServices(LocalStackContainer.EnabledService... services)
Declare a set of simulated AWS services that should be launched by this container.
|
LocalStackContainer |
withServices(LocalStackContainer.Service... services) |
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, containerIsCreated, containerIsStarted, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindcopyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning@Deprecated public static final java.lang.String VERSION
@Deprecated public LocalStackContainer()
LocalStackContainer(DockerImageName) instead@Deprecated public LocalStackContainer(java.lang.String version)
LocalStackContainer(DockerImageName) insteadpublic LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName)
dockerImageName - image name to use for Localstack@Deprecated
public LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName,
boolean useLegacyMode)
LocalStackContainer(DockerImageName) insteaddockerImageName - image name to use for LocalstackuseLegacyMode - if true, each AWS service is exposed on a different portprotected void configure()
configure in class org.testcontainers.containers.GenericContainer<LocalStackContainer>public LocalStackContainer withServices(LocalStackContainer.Service... services)
public LocalStackContainer withServices(LocalStackContainer.EnabledService... services)
services - one or more service namespublic java.net.URI getEndpointOverride(LocalStackContainer.Service service)
public java.net.URI getEndpointOverride(LocalStackContainer.EnabledService service)
S3Client s3 = S3Client
.builder()
.endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey()
)))
.region(Region.of(localstack.getRegion()))
.build()
Please note that this method is only intended to be used for configuring AWS SDK clients that are running on the test host. If other containers need to call this one, they should be configured specifically to do so using a Docker network and appropriate addressing.
service - the service that is to be accessedURI endpoint overridepublic java.lang.String getAccessKey()
S3Client s3 = S3Client
.builder()
.endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey()
)))
.region(Region.of(localstack.getRegion()))
.build()
public java.lang.String getSecretKey()
S3Client s3 = S3Client
.builder()
.endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey()
)))
.region(Region.of(localstack.getRegion()))
.build()
public java.lang.String getRegion()
S3Client s3 = S3Client
.builder()
.endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey()
)))
.region(Region.of(localstack.getRegion()))
.build()