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

com.pulumi.googlenative.storage.v1.kotlin.Bucket.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.storage.v1.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketAccessControlResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketAutoclassResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketBillingResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketCorsItemResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketCustomPlacementConfigResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketEncryptionResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketIamConfigurationResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketLifecycleResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketLoggingResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketOwnerResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketRetentionPolicyResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketVersioningResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketWebsiteResponse
import com.pulumi.googlenative.storage.v1.kotlin.outputs.ObjectAccessControlResponse
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketAccessControlResponse.Companion.toKotlin as bucketAccessControlResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketAutoclassResponse.Companion.toKotlin as bucketAutoclassResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketBillingResponse.Companion.toKotlin as bucketBillingResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketCorsItemResponse.Companion.toKotlin as bucketCorsItemResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketCustomPlacementConfigResponse.Companion.toKotlin as bucketCustomPlacementConfigResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketEncryptionResponse.Companion.toKotlin as bucketEncryptionResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketIamConfigurationResponse.Companion.toKotlin as bucketIamConfigurationResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketLifecycleResponse.Companion.toKotlin as bucketLifecycleResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketLoggingResponse.Companion.toKotlin as bucketLoggingResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketOwnerResponse.Companion.toKotlin as bucketOwnerResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketRetentionPolicyResponse.Companion.toKotlin as bucketRetentionPolicyResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketVersioningResponse.Companion.toKotlin as bucketVersioningResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.BucketWebsiteResponse.Companion.toKotlin as bucketWebsiteResponseToKotlin
import com.pulumi.googlenative.storage.v1.kotlin.outputs.ObjectAccessControlResponse.Companion.toKotlin as objectAccessControlResponseToKotlin

/**
 * Builder for [Bucket].
 */
@PulumiTagMarker
public class BucketResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: BucketArgs = BucketArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend BucketArgsBuilder.() -> Unit) {
        val builder = BucketArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Bucket {
        val builtJavaResource = com.pulumi.googlenative.storage.v1.Bucket(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Bucket(builtJavaResource)
    }
}

/**
 * Creates a new bucket.
 */
public class Bucket internal constructor(
    override val javaResource: com.pulumi.googlenative.storage.v1.Bucket,
) : KotlinCustomResource(javaResource, BucketMapper) {
    /**
     * Access controls on the bucket.
     */
    public val acl: Output>
        get() = javaResource.acl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    bucketAccessControlResponseToKotlin(args0)
                })
            })
        })

    /**
     * The bucket's Autoclass configuration.
     */
    public val autoclass: Output
        get() = javaResource.autoclass().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketAutoclassResponseToKotlin(args0)
            })
        })

    /**
     * The bucket's billing configuration.
     */
    public val billing: Output
        get() = javaResource.billing().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketBillingResponseToKotlin(args0)
            })
        })

    /**
     * The bucket's Cross-Origin Resource Sharing (CORS) configuration.
     */
    public val cors: Output>
        get() = javaResource.cors().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    bucketCorsItemResponseToKotlin(args0)
                })
            })
        })

    /**
     * The bucket's custom placement configuration for Custom Dual Regions.
     */
    public val customPlacementConfig: Output
        get() = javaResource.customPlacementConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketCustomPlacementConfigResponseToKotlin(args0)
            })
        })

    /**
     * The default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold's release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed.
     */
    public val defaultEventBasedHold: Output
        get() = javaResource.defaultEventBasedHold().applyValue({ args0 -> args0 })

    /**
     * Default access controls to apply to new objects when no ACL is provided.
     */
    public val defaultObjectAcl: Output>
        get() = javaResource.defaultObjectAcl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> objectAccessControlResponseToKotlin(args0) })
            })
        })

    /**
     * Encryption configuration for a bucket.
     */
    public val encryption: Output
        get() = javaResource.encryption().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketEncryptionResponseToKotlin(args0)
            })
        })

    /**
     * HTTP 1.1 Entity tag for the bucket.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * The bucket's IAM configuration.
     */
    public val iamConfiguration: Output
        get() = javaResource.iamConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketIamConfigurationResponseToKotlin(args0)
            })
        })

    /**
     * The kind of item this is. For buckets, this is always storage#bucket.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * User-provided labels, in key/value pairs.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The bucket's lifecycle configuration. See lifecycle management for more information.
     */
    public val lifecycle: Output
        get() = javaResource.lifecycle().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketLifecycleResponseToKotlin(args0)
            })
        })

    /**
     * The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The type of the bucket location.
     */
    public val locationType: Output
        get() = javaResource.locationType().applyValue({ args0 -> args0 })

    /**
     * The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs.
     */
    public val logging: Output
        get() = javaResource.logging().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketLoggingResponseToKotlin(args0)
            })
        })

    /**
     * The metadata generation of this bucket.
     */
    public val metageneration: Output
        get() = javaResource.metageneration().applyValue({ args0 -> args0 })

    /**
     * The name of the bucket.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The owner of the bucket. This is always the project team's owner group.
     */
    public val owner: Output
        get() = javaResource.owner().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketOwnerResponseToKotlin(args0)
            })
        })

    /**
     * Apply a predefined set of access controls to this bucket.
     */
    public val predefinedAcl: Output?
        get() = javaResource.predefinedAcl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Apply a predefined set of default object access controls to this bucket.
     */
    public val predefinedDefaultObjectAcl: Output?
        get() = javaResource.predefinedDefaultObjectAcl().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A valid API project identifier.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The project number of the project the bucket belongs to.
     */
    public val projectNumber: Output
        get() = javaResource.projectNumber().applyValue({ args0 -> args0 })

    /**
     * Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.
     */
    public val projection: Output?
        get() = javaResource.projection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.
     */
    public val retentionPolicy: Output
        get() = javaResource.retentionPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketRetentionPolicyResponseToKotlin(args0)
            })
        })

    /**
     * The Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to turn on Turbo Replication on a bucket.
     */
    public val rpo: Output
        get() = javaResource.rpo().applyValue({ args0 -> args0 })

    /**
     * Reserved for future use.
     */
    public val satisfiesPZS: Output
        get() = javaResource.satisfiesPZS().applyValue({ args0 -> args0 })

    /**
     * The URI of this bucket.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes.
     */
    public val storageClass: Output
        get() = javaResource.storageClass().applyValue({ args0 -> args0 })

    /**
     * The creation time of the bucket in RFC 3339 format.
     */
    public val timeCreated: Output
        get() = javaResource.timeCreated().applyValue({ args0 -> args0 })

    /**
     * The modification time of the bucket in RFC 3339 format.
     */
    public val updated: Output
        get() = javaResource.updated().applyValue({ args0 -> args0 })

    /**
     * The project to be billed for this request.
     */
    public val userProject: Output?
        get() = javaResource.userProject().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The bucket's versioning configuration.
     */
    public val versioning: Output
        get() = javaResource.versioning().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketVersioningResponseToKotlin(args0)
            })
        })

    /**
     * The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information.
     */
    public val website: Output
        get() = javaResource.website().applyValue({ args0 ->
            args0.let({ args0 ->
                bucketWebsiteResponseToKotlin(args0)
            })
        })
}

public object BucketMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.storage.v1.Bucket::class == javaResource::class

    override fun map(javaResource: Resource): Bucket = Bucket(
        javaResource as
            com.pulumi.googlenative.storage.v1.Bucket,
    )
}

/**
 * @see [Bucket].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Bucket].
 */
public suspend fun bucket(name: String, block: suspend BucketResourceBuilder.() -> Unit): Bucket {
    val builder = BucketResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Bucket].
 * @param name The _unique_ name of the resulting resource.
 */
public fun bucket(name: String): Bucket {
    val builder = BucketResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy