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

commonMain.aws.sdk.kotlin.services.s3.model.LoggingEnabled.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.s3.model



/**
 * Describes where logs are stored and the prefix that Amazon S3 assigns to all log object keys for a bucket. For more information, see [PUT Bucket logging](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) in the *Amazon S3 API Reference*.
 */
public class LoggingEnabled private constructor(builder: Builder) {
    /**
     * Specifies the bucket where you want Amazon S3 to store server access logs. You can have your logs delivered to any bucket that you own, including the same bucket that is being logged. You can also configure multiple buckets to deliver their logs to the same target bucket. In this case, you should choose a different `TargetPrefix` for each source bucket so that the delivered log files can be distinguished by key.
     */
    public val targetBucket: kotlin.String = requireNotNull(builder.targetBucket) { "A non-null value must be provided for targetBucket" }
    /**
     * Container for granting information.
     *
     * Buckets that use the bucket owner enforced setting for Object Ownership don't support target grants. For more information, see [Permissions for server access log delivery](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general) in the *Amazon S3 User Guide*.
     */
    public val targetGrants: List? = builder.targetGrants
    /**
     * Amazon S3 key format for log objects.
     */
    public val targetObjectKeyFormat: aws.sdk.kotlin.services.s3.model.TargetObjectKeyFormat? = builder.targetObjectKeyFormat
    /**
     * A prefix for all log object keys. If you store log files from multiple Amazon S3 buckets in a single bucket, you can use a prefix to distinguish which log files came from which bucket.
     */
    public val targetPrefix: kotlin.String = requireNotNull(builder.targetPrefix) { "A non-null value must be provided for targetPrefix" }

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.s3.model.LoggingEnabled = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("LoggingEnabled(")
        append("targetBucket=$targetBucket,")
        append("targetGrants=$targetGrants,")
        append("targetObjectKeyFormat=$targetObjectKeyFormat,")
        append("targetPrefix=$targetPrefix")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = targetBucket.hashCode()
        result = 31 * result + (targetGrants?.hashCode() ?: 0)
        result = 31 * result + (targetObjectKeyFormat?.hashCode() ?: 0)
        result = 31 * result + (targetPrefix.hashCode())
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as LoggingEnabled

        if (targetBucket != other.targetBucket) return false
        if (targetGrants != other.targetGrants) return false
        if (targetObjectKeyFormat != other.targetObjectKeyFormat) return false
        if (targetPrefix != other.targetPrefix) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.s3.model.LoggingEnabled = Builder(this).apply(block).build()

    public class Builder {
        /**
         * Specifies the bucket where you want Amazon S3 to store server access logs. You can have your logs delivered to any bucket that you own, including the same bucket that is being logged. You can also configure multiple buckets to deliver their logs to the same target bucket. In this case, you should choose a different `TargetPrefix` for each source bucket so that the delivered log files can be distinguished by key.
         */
        public var targetBucket: kotlin.String? = null
        /**
         * Container for granting information.
         *
         * Buckets that use the bucket owner enforced setting for Object Ownership don't support target grants. For more information, see [Permissions for server access log delivery](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general) in the *Amazon S3 User Guide*.
         */
        public var targetGrants: List? = null
        /**
         * Amazon S3 key format for log objects.
         */
        public var targetObjectKeyFormat: aws.sdk.kotlin.services.s3.model.TargetObjectKeyFormat? = null
        /**
         * A prefix for all log object keys. If you store log files from multiple Amazon S3 buckets in a single bucket, you can use a prefix to distinguish which log files came from which bucket.
         */
        public var targetPrefix: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.s3.model.LoggingEnabled) : this() {
            this.targetBucket = x.targetBucket
            this.targetGrants = x.targetGrants
            this.targetObjectKeyFormat = x.targetObjectKeyFormat
            this.targetPrefix = x.targetPrefix
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.s3.model.LoggingEnabled = LoggingEnabled(this)

        /**
         * construct an [aws.sdk.kotlin.services.s3.model.TargetObjectKeyFormat] inside the given [block]
         */
        public fun targetObjectKeyFormat(block: aws.sdk.kotlin.services.s3.model.TargetObjectKeyFormat.Builder.() -> kotlin.Unit) {
            this.targetObjectKeyFormat = aws.sdk.kotlin.services.s3.model.TargetObjectKeyFormat.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (targetBucket == null) targetBucket = ""
            if (targetPrefix == null) targetPrefix = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy