com.pulumi.gcp.bigtable.kotlin.Table.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.bigtable.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.bigtable.kotlin.outputs.TableColumnFamily
import com.pulumi.gcp.bigtable.kotlin.outputs.TableColumnFamily.Companion.toKotlin
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
/**
* 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.gcp.bigtable.Table(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Table(builtJavaResource)
}
}
/**
* Creates a Google Cloud Bigtable table inside an instance. For more information see
* [the official documentation](https://cloud.google.com/bigtable/) and
* [API](https://cloud.google.com/bigtable/docs/go/reference).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const instance = new gcp.bigtable.Instance("instance", {
* name: "tf-instance",
* clusters: [{
* clusterId: "tf-instance-cluster",
* zone: "us-central1-b",
* numNodes: 3,
* storageType: "HDD",
* }],
* });
* const table = new gcp.bigtable.Table("table", {
* name: "tf-table",
* instanceName: instance.name,
* splitKeys: [
* "a",
* "b",
* "c",
* ],
* columnFamilies: [
* {
* family: "family-first",
* },
* {
* family: "family-second",
* },
* ],
* changeStreamRetention: "24h0m0s",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* instance = gcp.bigtable.Instance("instance",
* name="tf-instance",
* clusters=[gcp.bigtable.InstanceClusterArgs(
* cluster_id="tf-instance-cluster",
* zone="us-central1-b",
* num_nodes=3,
* storage_type="HDD",
* )])
* table = gcp.bigtable.Table("table",
* name="tf-table",
* instance_name=instance.name,
* split_keys=[
* "a",
* "b",
* "c",
* ],
* column_families=[
* gcp.bigtable.TableColumnFamilyArgs(
* family="family-first",
* ),
* gcp.bigtable.TableColumnFamilyArgs(
* family="family-second",
* ),
* ],
* change_stream_retention="24h0m0s")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var instance = new Gcp.BigTable.Instance("instance", new()
* {
* Name = "tf-instance",
* Clusters = new[]
* {
* new Gcp.BigTable.Inputs.InstanceClusterArgs
* {
* ClusterId = "tf-instance-cluster",
* Zone = "us-central1-b",
* NumNodes = 3,
* StorageType = "HDD",
* },
* },
* });
* var table = new Gcp.BigTable.Table("table", new()
* {
* Name = "tf-table",
* InstanceName = instance.Name,
* SplitKeys = new[]
* {
* "a",
* "b",
* "c",
* },
* ColumnFamilies = new[]
* {
* new Gcp.BigTable.Inputs.TableColumnFamilyArgs
* {
* Family = "family-first",
* },
* new Gcp.BigTable.Inputs.TableColumnFamilyArgs
* {
* Family = "family-second",
* },
* },
* ChangeStreamRetention = "24h0m0s",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigtable"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* instance, err := bigtable.NewInstance(ctx, "instance", &bigtable.InstanceArgs{
* Name: pulumi.String("tf-instance"),
* Clusters: bigtable.InstanceClusterArray{
* &bigtable.InstanceClusterArgs{
* ClusterId: pulumi.String("tf-instance-cluster"),
* Zone: pulumi.String("us-central1-b"),
* NumNodes: pulumi.Int(3),
* StorageType: pulumi.String("HDD"),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = bigtable.NewTable(ctx, "table", &bigtable.TableArgs{
* Name: pulumi.String("tf-table"),
* InstanceName: instance.Name,
* SplitKeys: pulumi.StringArray{
* pulumi.String("a"),
* pulumi.String("b"),
* pulumi.String("c"),
* },
* ColumnFamilies: bigtable.TableColumnFamilyArray{
* &bigtable.TableColumnFamilyArgs{
* Family: pulumi.String("family-first"),
* },
* &bigtable.TableColumnFamilyArgs{
* Family: pulumi.String("family-second"),
* },
* },
* ChangeStreamRetention: pulumi.String("24h0m0s"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigtable.Instance;
* import com.pulumi.gcp.bigtable.InstanceArgs;
* import com.pulumi.gcp.bigtable.inputs.InstanceClusterArgs;
* import com.pulumi.gcp.bigtable.Table;
* import com.pulumi.gcp.bigtable.TableArgs;
* import com.pulumi.gcp.bigtable.inputs.TableColumnFamilyArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var instance = new Instance("instance", InstanceArgs.builder()
* .name("tf-instance")
* .clusters(InstanceClusterArgs.builder()
* .clusterId("tf-instance-cluster")
* .zone("us-central1-b")
* .numNodes(3)
* .storageType("HDD")
* .build())
* .build());
* var table = new Table("table", TableArgs.builder()
* .name("tf-table")
* .instanceName(instance.name())
* .splitKeys(
* "a",
* "b",
* "c")
* .columnFamilies(
* TableColumnFamilyArgs.builder()
* .family("family-first")
* .build(),
* TableColumnFamilyArgs.builder()
* .family("family-second")
* .build())
* .changeStreamRetention("24h0m0s")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* instance:
* type: gcp:bigtable:Instance
* properties:
* name: tf-instance
* clusters:
* - clusterId: tf-instance-cluster
* zone: us-central1-b
* numNodes: 3
* storageType: HDD
* table:
* type: gcp:bigtable:Table
* properties:
* name: tf-table
* instanceName: ${instance.name}
* splitKeys:
* - a
* - b
* - c
* columnFamilies:
* - family: family-first
* - family: family-second
* changeStreamRetention: 24h0m0s
* ```
*
* ## Import
* -> **Fields affected by import** The following fields can't be read and will show diffs if set in config when imported: `split_keys`
* Bigtable Tables can be imported using any of these accepted formats:
* * `projects/{{project}}/instances/{{instance_name}}/tables/{{name}}`
* * `{{project}}/{{instance_name}}/{{name}}`
* * `{{instance_name}}/{{name}}`
* When using the `pulumi import` command, Bigtable Tables can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:bigtable/table:Table default projects/{{project}}/instances/{{instance_name}}/tables/{{name}}
* ```
* ```sh
* $ pulumi import gcp:bigtable/table:Table default {{project}}/{{instance_name}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:bigtable/table:Table default {{instance_name}}/{{name}}
* ```
*/
public class Table internal constructor(
override val javaResource: com.pulumi.gcp.bigtable.Table,
) : KotlinCustomResource(javaResource, TableMapper) {
/**
* Duration to retain change stream data for the table. Set to 0 to disable. Must be between 1 and 7 days.
* -----
*/
public val changeStreamRetention: Output
get() = javaResource.changeStreamRetention().applyValue({ args0 -> args0 })
/**
* A group of columns within a table which share a common configuration. This can be specified multiple times. Structure is documented below.
*/
public val columnFamilies: Output>?
get() = javaResource.columnFamilies().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
}).orElse(null)
})
/**
* A field to make the table protected against data loss i.e. when set to PROTECTED, deleting the table, the column families in the table, and the instance containing the table would be prohibited. If not provided, deletion protection will be set to UNPROTECTED.
*/
public val deletionProtection: Output
get() = javaResource.deletionProtection().applyValue({ args0 -> args0 })
/**
* The name of the Bigtable instance.
*/
public val instanceName: Output
get() = javaResource.instanceName().applyValue({ args0 -> args0 })
/**
* The name of the table. Must be 1-50 characters and must only contain hyphens, underscores, periods, letters and numbers.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* A list of predefined keys to split the table on.
* !> **Warning:** Modifying the `split_keys` of an existing table will cause the provider
* to delete/recreate the entire `gcp.bigtable.Table` resource.
*/
public val splitKeys: Output>?
get() = javaResource.splitKeys().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
}
public object TableMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.bigtable.Table::class == javaResource::class
override fun map(javaResource: Resource): Table = Table(
javaResource as
com.pulumi.gcp.bigtable.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()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy