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

com.pulumi.googlenative.bigquery.v2.kotlin.Table.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.bigquery.v2.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.CloneDefinitionResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ClusteringResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.EncryptionConfigurationResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ExternalDataConfigurationResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.MaterializedViewDefinitionResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ModelDefinitionResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.RangePartitioningResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.SnapshotDefinitionResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.StreamingbufferResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableConstraintsResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableReferenceResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableSchemaResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TimePartitioningResponse
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ViewDefinitionResponse
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.Map
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.CloneDefinitionResponse.Companion.toKotlin as cloneDefinitionResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ClusteringResponse.Companion.toKotlin as clusteringResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.EncryptionConfigurationResponse.Companion.toKotlin as encryptionConfigurationResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ExternalDataConfigurationResponse.Companion.toKotlin as externalDataConfigurationResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.MaterializedViewDefinitionResponse.Companion.toKotlin as materializedViewDefinitionResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ModelDefinitionResponse.Companion.toKotlin as modelDefinitionResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.RangePartitioningResponse.Companion.toKotlin as rangePartitioningResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.SnapshotDefinitionResponse.Companion.toKotlin as snapshotDefinitionResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.StreamingbufferResponse.Companion.toKotlin as streamingbufferResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableConstraintsResponse.Companion.toKotlin as tableConstraintsResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableReferenceResponse.Companion.toKotlin as tableReferenceResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TableSchemaResponse.Companion.toKotlin as tableSchemaResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.TimePartitioningResponse.Companion.toKotlin as timePartitioningResponseToKotlin
import com.pulumi.googlenative.bigquery.v2.kotlin.outputs.ViewDefinitionResponse.Companion.toKotlin as viewDefinitionResponseToKotlin

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

    public var args: TableArgs = TableArgs()

    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 TableArgsBuilder.() -> Unit) {
        val builder = TableArgsBuilder()
        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(): Table {
        val builtJavaResource = com.pulumi.googlenative.bigquery.v2.Table(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Table(builtJavaResource)
    }
}

/**
 * Creates a new, empty table in the dataset.
 * Auto-naming is currently not supported for this resource.
 */
public class Table internal constructor(
    override val javaResource: com.pulumi.googlenative.bigquery.v2.Table,
) : KotlinCustomResource(javaResource, TableMapper) {
    /**
     * Clone definition.
     */
    public val cloneDefinition: Output
        get() = javaResource.cloneDefinition().applyValue({ args0 ->
            args0.let({ args0 ->
                cloneDefinitionResponseToKotlin(args0)
            })
        })

    /**
     * [Beta] Clustering specification for the table. Must be specified with partitioning, data in the table will be first partitioned and subsequently clustered.
     */
    public val clustering: Output
        get() = javaResource.clustering().applyValue({ args0 ->
            args0.let({ args0 ->
                clusteringResponseToKotlin(args0)
            })
        })

    /**
     * The time when this table was created, in milliseconds since the epoch.
     */
    public val creationTime: Output
        get() = javaResource.creationTime().applyValue({ args0 -> args0 })

    public val datasetId: Output
        get() = javaResource.datasetId().applyValue({ args0 -> args0 })

    /**
     * The default collation of the table.
     */
    public val defaultCollation: Output
        get() = javaResource.defaultCollation().applyValue({ args0 -> args0 })

    /**
     * The default rounding mode of the table.
     */
    public val defaultRoundingMode: Output
        get() = javaResource.defaultRoundingMode().applyValue({ args0 -> args0 })

    /**
     * [Optional] A user-friendly description of this table.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Custom encryption configuration (e.g., Cloud KMS keys).
     */
    public val encryptionConfiguration: Output
        get() = javaResource.encryptionConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                encryptionConfigurationResponseToKotlin(args0)
            })
        })

    /**
     * A hash of the table metadata. Used to ensure there were no concurrent modifications to the resource when attempting an update. Not guaranteed to change when the table contents or the fields numRows, numBytes, numLongTermBytes or lastModifiedTime change.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * [Optional] The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed. The defaultTableExpirationMs property of the encapsulating dataset can be used to set a default expirationTime on newly created tables.
     */
    public val expirationTime: Output
        get() = javaResource.expirationTime().applyValue({ args0 -> args0 })

    /**
     * [Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
     */
    public val externalDataConfiguration: Output
        get() = javaResource.externalDataConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                externalDataConfigurationResponseToKotlin(args0)
            })
        })

    /**
     * [Optional] A descriptive name for this table.
     */
    public val friendlyName: Output
        get() = javaResource.friendlyName().applyValue({ args0 -> args0 })

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

    /**
     * The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The time when this table was last modified, in milliseconds since the epoch.
     */
    public val lastModifiedTime: Output
        get() = javaResource.lastModifiedTime().applyValue({ args0 -> args0 })

    /**
     * The geographic location where the table resides. This value is inherited from the dataset.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * [Optional] Materialized view definition.
     */
    public val materializedView: Output
        get() = javaResource.materializedView().applyValue({ args0 ->
            args0.let({ args0 ->
                materializedViewDefinitionResponseToKotlin(args0)
            })
        })

    /**
     * [Optional] Max staleness of data that could be returned when table or materialized view is queried (formatted as Google SQL Interval type).
     */
    public val maxStaleness: Output
        get() = javaResource.maxStaleness().applyValue({ args0 -> args0 })

    /**
     * [Output-only, Beta] Present iff this table represents a ML model. Describes the training information for the model, and it is required to run 'PREDICT' queries.
     */
    public val model: Output
        get() = javaResource.model().applyValue({ args0 ->
            args0.let({ args0 ->
                modelDefinitionResponseToKotlin(args0)
            })
        })

    /**
     * Number of logical bytes that are less than 90 days old.
     */
    public val numActiveLogicalBytes: Output
        get() = javaResource.numActiveLogicalBytes().applyValue({ args0 -> args0 })

    /**
     * Number of physical bytes less than 90 days old. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
     */
    public val numActivePhysicalBytes: Output
        get() = javaResource.numActivePhysicalBytes().applyValue({ args0 -> args0 })

    /**
     * The size of this table in bytes, excluding any data in the streaming buffer.
     */
    public val numBytes: Output
        get() = javaResource.numBytes().applyValue({ args0 -> args0 })

    /**
     * The number of bytes in the table that are considered "long-term storage".
     */
    public val numLongTermBytes: Output
        get() = javaResource.numLongTermBytes().applyValue({ args0 -> args0 })

    /**
     * Number of logical bytes that are more than 90 days old.
     */
    public val numLongTermLogicalBytes: Output
        get() = javaResource.numLongTermLogicalBytes().applyValue({ args0 -> args0 })

    /**
     * Number of physical bytes more than 90 days old. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
     */
    public val numLongTermPhysicalBytes: Output
        get() = javaResource.numLongTermPhysicalBytes().applyValue({ args0 -> args0 })

    /**
     * The number of partitions present in the table or materialized view. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
     */
    public val numPartitions: Output
        get() = javaResource.numPartitions().applyValue({ args0 -> args0 })

    /**
     * [TrustedTester] The physical size of this table in bytes, excluding any data in the streaming buffer. This includes compression and storage used for time travel.
     */
    public val numPhysicalBytes: Output
        get() = javaResource.numPhysicalBytes().applyValue({ args0 -> args0 })

    /**
     * The number of rows of data in this table, excluding any data in the streaming buffer.
     */
    public val numRows: Output
        get() = javaResource.numRows().applyValue({ args0 -> args0 })

    /**
     * Number of physical bytes used by time travel storage (deleted or changed data). This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
     */
    public val numTimeTravelPhysicalBytes: Output
        get() = javaResource.numTimeTravelPhysicalBytes().applyValue({ args0 -> args0 })

    /**
     * Total number of logical bytes in the table or materialized view.
     */
    public val numTotalLogicalBytes: Output
        get() = javaResource.numTotalLogicalBytes().applyValue({ args0 -> args0 })

    /**
     * The physical size of this table in bytes. This also includes storage used for time travel. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
     */
    public val numTotalPhysicalBytes: Output
        get() = javaResource.numTotalPhysicalBytes().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
     */
    public val rangePartitioning: Output
        get() = javaResource.rangePartitioning().applyValue({ args0 ->
            args0.let({ args0 ->
                rangePartitioningResponseToKotlin(args0)
            })
        })

    /**
     * [Optional] If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified.
     */
    public val requirePartitionFilter: Output
        get() = javaResource.requirePartitionFilter().applyValue({ args0 -> args0 })

    /**
     * [Optional] Describes the schema of this table.
     */
    public val schema: Output
        get() = javaResource.schema().applyValue({ args0 ->
            args0.let({ args0 ->
                tableSchemaResponseToKotlin(args0)
            })
        })

    /**
     * A URL that can be used to access this resource again.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Snapshot definition.
     */
    public val snapshotDefinition: Output
        get() = javaResource.snapshotDefinition().applyValue({ args0 ->
            args0.let({ args0 ->
                snapshotDefinitionResponseToKotlin(args0)
            })
        })

    /**
     * Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer.
     */
    public val streamingBuffer: Output
        get() = javaResource.streamingBuffer().applyValue({ args0 ->
            args0.let({ args0 ->
                streamingbufferResponseToKotlin(args0)
            })
        })

    /**
     * [Optional] The table constraints on the table.
     */
    public val tableConstraints: Output
        get() = javaResource.tableConstraints().applyValue({ args0 ->
            args0.let({ args0 ->
                tableConstraintsResponseToKotlin(args0)
            })
        })

    /**
     * [Required] Reference describing the ID of this table.
     */
    public val tableReference: Output
        get() = javaResource.tableReference().applyValue({ args0 ->
            args0.let({ args0 ->
                tableReferenceResponseToKotlin(args0)
            })
        })

    /**
     * Time-based partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
     */
    public val timePartitioning: Output
        get() = javaResource.timePartitioning().applyValue({ args0 ->
            args0.let({ args0 ->
                timePartitioningResponseToKotlin(args0)
            })
        })

    /**
     * Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. SNAPSHOT: An immutable, read-only table that is a copy of another table. [TrustedTester] MATERIALIZED_VIEW: SQL query whose result is persisted. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * [Optional] The view definition.
     */
    public val view: Output
        get() = javaResource.view().applyValue({ args0 ->
            args0.let({ args0 ->
                viewDefinitionResponseToKotlin(args0)
            })
        })
}

public object TableMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.bigquery.v2.Table::class == javaResource::class

    override fun map(javaResource: Resource): Table = Table(
        javaResource as
            com.pulumi.googlenative.bigquery.v2.Table,
    )
}

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

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