Sha256: 7d5ca42184f1f805e10cf8f818b9560abb2c8dc2e8e84c29be6e267612787bfb

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

package s3.website.model

case class S3Endpoint(
  s3WebsiteHostname: String,
  s3Hostname: String
)

object S3Endpoint {
  val defaultEndpoint = S3Endpoint("s3-website-us-east-1.amazonaws.com", "s3.amazonaws.com")

  def forString(locationConstraint: String): Either[UserError, S3Endpoint] = locationConstraint match {
    case "EU" | "eu-west-1" => Right(S3Endpoint("s3-website-eu-west-1.amazonaws.com",      "s3-eu-west-1.amazonaws.com"))
    case "us-east-1" =>        Right(defaultEndpoint)
    case "us-west-1" =>        Right(S3Endpoint("s3-website-us-west-1.amazonaws.com",      "s3-us-west-1.amazonaws.com"))
    case "us-west-2" =>        Right(S3Endpoint("s3-website-us-west-2.amazonaws.com",      "s3-us-west-2.amazonaws.com"))
    case "ap-southeast-1" =>   Right(S3Endpoint("s3-website-ap-southeast-1.amazonaws.com", "s3-ap-southeast-1.amazonaws.com"))
    case "ap-southeast-2" =>   Right(S3Endpoint("s3-website-ap-southeast-2.amazonaws.com", "s3-ap-southeast-2.amazonaws.com"))
    case "ap-northeast-1" =>   Right(S3Endpoint("s3-website-ap-northeast-1.amazonaws.com", "s3-ap-northeast-1.amazonaws.com"))
    case "sa-east-1" =>        Right(S3Endpoint("s3-website-sa-east-1.amazonaws.com",      "s3-sa-east-1.amazonaws.com"))
    case _ =>                  Left(UserError(s"Unrecognised endpoint: $locationConstraint"))
  }
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
s3_website_monadic-0.0.9 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.8 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.7 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.6 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.5 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.4 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.3 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.2 src/main/scala/s3/website/model/S3Endpoint.scala
s3_website_monadic-0.0.1 src/main/scala/s3/website/model/S3Endpoint.scala