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

org.http4k.connect.amazon.s3.model.BucketName.kt Maven / Gradle / Ivy

There is a newer version: 5.41.0.0
Show newest version
package org.http4k.connect.amazon.s3.model

import dev.forkhandles.values.NonBlankStringValueFactory
import org.http4k.connect.amazon.core.model.AwsService
import org.http4k.connect.amazon.core.model.Region
import org.http4k.connect.amazon.core.model.ResourceId

class BucketName private constructor(value: String) : ResourceId(value) {

    fun requiresPathStyleApi() = value.contains('.')

    fun toUri(region: Region, forcePathStyle: Boolean = false) = when {
        forcePathStyle || requiresPathStyleApi() -> AwsService.of("s3").toUri(region).path("/$value")
        else -> AwsService.of("$this.s3").toUri(region)
    }

    companion object : NonBlankStringValueFactory(::BucketName)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy