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

com.dimafeng.testcontainers.LocalStackContainer.scala Maven / Gradle / Ivy

There is a newer version: 0.41.5
Show newest version
package com.dimafeng.testcontainers

import com.amazonaws.auth.AWSCredentialsProvider
import com.amazonaws.client.builder.AwsClientBuilder
import org.testcontainers.containers.localstack.{LocalStackContainer => JavaLocalStackContainer}

case class LocalStackContainer(
  tag: String = LocalStackContainer.defaultTag,
  services: Seq[LocalStackContainer.Service] = Seq.empty
) extends SingleContainer[JavaLocalStackContainer] {

  override val container: JavaLocalStackContainer = {
    val c = new JavaLocalStackContainer(tag)
    c.withServices(services: _*)
    c
  }

  def endpointConfiguration(service: LocalStackContainer.Service): AwsClientBuilder.EndpointConfiguration =
    container.getEndpointConfiguration(service)

  def defaultCredentialsProvider: AWSCredentialsProvider = container.getDefaultCredentialsProvider
}

object LocalStackContainer {

  val defaultTag = "0.9.4"

  type Service = JavaLocalStackContainer.Service

  case class Def(
    tag: String = LocalStackContainer.defaultTag,
    services: Seq[LocalStackContainer.Service] = Seq.empty
  ) extends ContainerDef {

    override type Container = LocalStackContainer

    override def createContainer(): LocalStackContainer = {
      new LocalStackContainer(
        tag,
        services
      )
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy