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

com.pulumi.alicloud.ots.kotlin.SecondaryIndexArgs.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.

There is a newer version: 3.62.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.alicloud.ots.kotlin

import com.pulumi.alicloud.ots.SecondaryIndexArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides an OTS secondary index resource.
 * For information about OTS secondary index and how to use it, see [Secondary index overview](https://www.alibabacloud.com/help/en/tablestore/latest/secondary-index-overview).
 * > **NOTE:** Available since v1.187.0.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as alicloud from "@pulumi/alicloud";
 * import * as random from "@pulumi/random";
 * const config = new pulumi.Config();
 * const name = config.get("name") || "tf-example";
 * const _default = new random.index.Integer("default", {
 *     min: 10000,
 *     max: 99999,
 * });
 * const defaultInstance = new alicloud.ots.Instance("default", {
 *     name: `${name}-${_default.result}`,
 *     description: name,
 *     accessedBy: "Any",
 *     tags: {
 *         Created: "TF",
 *         For: "example",
 *     },
 * });
 * const defaultTable = new alicloud.ots.Table("default", {
 *     instanceName: defaultInstance.name,
 *     tableName: "tf_example",
 *     timeToLive: -1,
 *     maxVersion: 1,
 *     enableSse: true,
 *     sseKeyType: "SSE_KMS_SERVICE",
 *     primaryKeys: [
 *         {
 *             name: "pk1",
 *             type: "Integer",
 *         },
 *         {
 *             name: "pk2",
 *             type: "String",
 *         },
 *         {
 *             name: "pk3",
 *             type: "Binary",
 *         },
 *     ],
 *     definedColumns: [
 *         {
 *             name: "col1",
 *             type: "Integer",
 *         },
 *         {
 *             name: "col2",
 *             type: "String",
 *         },
 *         {
 *             name: "col3",
 *             type: "Binary",
 *         },
 *     ],
 * });
 * const defaultSecondaryIndex = new alicloud.ots.SecondaryIndex("default", {
 *     instanceName: defaultInstance.name,
 *     tableName: defaultTable.tableName,
 *     indexName: "example_index",
 *     indexType: "Global",
 *     includeBaseData: true,
 *     primaryKeys: [
 *         "pk1",
 *         "pk2",
 *         "pk3",
 *     ],
 *     definedColumns: [
 *         "col1",
 *         "col2",
 *         "col3",
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_alicloud as alicloud
 * import pulumi_random as random
 * config = pulumi.Config()
 * name = config.get("name")
 * if name is None:
 *     name = "tf-example"
 * default = random.index.Integer("default",
 *     min=10000,
 *     max=99999)
 * default_instance = alicloud.ots.Instance("default",
 *     name=f"{name}-{default['result']}",
 *     description=name,
 *     accessed_by="Any",
 *     tags={
 *         "Created": "TF",
 *         "For": "example",
 *     })
 * default_table = alicloud.ots.Table("default",
 *     instance_name=default_instance.name,
 *     table_name="tf_example",
 *     time_to_live=-1,
 *     max_version=1,
 *     enable_sse=True,
 *     sse_key_type="SSE_KMS_SERVICE",
 *     primary_keys=[
 *         {
 *             "name": "pk1",
 *             "type": "Integer",
 *         },
 *         {
 *             "name": "pk2",
 *             "type": "String",
 *         },
 *         {
 *             "name": "pk3",
 *             "type": "Binary",
 *         },
 *     ],
 *     defined_columns=[
 *         {
 *             "name": "col1",
 *             "type": "Integer",
 *         },
 *         {
 *             "name": "col2",
 *             "type": "String",
 *         },
 *         {
 *             "name": "col3",
 *             "type": "Binary",
 *         },
 *     ])
 * default_secondary_index = alicloud.ots.SecondaryIndex("default",
 *     instance_name=default_instance.name,
 *     table_name=default_table.table_name,
 *     index_name="example_index",
 *     index_type="Global",
 *     include_base_data=True,
 *     primary_keys=[
 *         "pk1",
 *         "pk2",
 *         "pk3",
 *     ],
 *     defined_columns=[
 *         "col1",
 *         "col2",
 *         "col3",
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AliCloud = Pulumi.AliCloud;
 * using Random = Pulumi.Random;
 * return await Deployment.RunAsync(() =>
 * {
 *     var config = new Config();
 *     var name = config.Get("name") ?? "tf-example";
 *     var @default = new Random.Index.Integer("default", new()
 *     {
 *         Min = 10000,
 *         Max = 99999,
 *     });
 *     var defaultInstance = new AliCloud.Ots.Instance("default", new()
 *     {
 *         Name = $"{name}-{@default.Result}",
 *         Description = name,
 *         AccessedBy = "Any",
 *         Tags =
 *         {
 *             { "Created", "TF" },
 *             { "For", "example" },
 *         },
 *     });
 *     var defaultTable = new AliCloud.Ots.Table("default", new()
 *     {
 *         InstanceName = defaultInstance.Name,
 *         TableName = "tf_example",
 *         TimeToLive = -1,
 *         MaxVersion = 1,
 *         EnableSse = true,
 *         SseKeyType = "SSE_KMS_SERVICE",
 *         PrimaryKeys = new[]
 *         {
 *             new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
 *             {
 *                 Name = "pk1",
 *                 Type = "Integer",
 *             },
 *             new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
 *             {
 *                 Name = "pk2",
 *                 Type = "String",
 *             },
 *             new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
 *             {
 *                 Name = "pk3",
 *                 Type = "Binary",
 *             },
 *         },
 *         DefinedColumns = new[]
 *         {
 *             new AliCloud.Ots.Inputs.TableDefinedColumnArgs
 *             {
 *                 Name = "col1",
 *                 Type = "Integer",
 *             },
 *             new AliCloud.Ots.Inputs.TableDefinedColumnArgs
 *             {
 *                 Name = "col2",
 *                 Type = "String",
 *             },
 *             new AliCloud.Ots.Inputs.TableDefinedColumnArgs
 *             {
 *                 Name = "col3",
 *                 Type = "Binary",
 *             },
 *         },
 *     });
 *     var defaultSecondaryIndex = new AliCloud.Ots.SecondaryIndex("default", new()
 *     {
 *         InstanceName = defaultInstance.Name,
 *         TableName = defaultTable.TableName,
 *         IndexName = "example_index",
 *         IndexType = "Global",
 *         IncludeBaseData = true,
 *         PrimaryKeys = new[]
 *         {
 *             "pk1",
 *             "pk2",
 *             "pk3",
 *         },
 *         DefinedColumns = new[]
 *         {
 *             "col1",
 *             "col2",
 *             "col3",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ots"
 * 	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		cfg := config.New(ctx, "")
 * 		name := "tf-example"
 * 		if param := cfg.Get("name"); param != "" {
 * 			name = param
 * 		}
 * 		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
 * 			Min: 10000,
 * 			Max: 99999,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultInstance, err := ots.NewInstance(ctx, "default", &ots.InstanceArgs{
 * 			Name:        pulumi.Sprintf("%v-%v", name, _default.Result),
 * 			Description: pulumi.String(name),
 * 			AccessedBy:  pulumi.String("Any"),
 * 			Tags: pulumi.StringMap{
 * 				"Created": pulumi.String("TF"),
 * 				"For":     pulumi.String("example"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultTable, err := ots.NewTable(ctx, "default", &ots.TableArgs{
 * 			InstanceName: defaultInstance.Name,
 * 			TableName:    pulumi.String("tf_example"),
 * 			TimeToLive:   int(-1),
 * 			MaxVersion:   pulumi.Int(1),
 * 			EnableSse:    pulumi.Bool(true),
 * 			SseKeyType:   pulumi.String("SSE_KMS_SERVICE"),
 * 			PrimaryKeys: ots.TablePrimaryKeyArray{
 * 				&ots.TablePrimaryKeyArgs{
 * 					Name: pulumi.String("pk1"),
 * 					Type: pulumi.String("Integer"),
 * 				},
 * 				&ots.TablePrimaryKeyArgs{
 * 					Name: pulumi.String("pk2"),
 * 					Type: pulumi.String("String"),
 * 				},
 * 				&ots.TablePrimaryKeyArgs{
 * 					Name: pulumi.String("pk3"),
 * 					Type: pulumi.String("Binary"),
 * 				},
 * 			},
 * 			DefinedColumns: ots.TableDefinedColumnArray{
 * 				&ots.TableDefinedColumnArgs{
 * 					Name: pulumi.String("col1"),
 * 					Type: pulumi.String("Integer"),
 * 				},
 * 				&ots.TableDefinedColumnArgs{
 * 					Name: pulumi.String("col2"),
 * 					Type: pulumi.String("String"),
 * 				},
 * 				&ots.TableDefinedColumnArgs{
 * 					Name: pulumi.String("col3"),
 * 					Type: pulumi.String("Binary"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ots.NewSecondaryIndex(ctx, "default", &ots.SecondaryIndexArgs{
 * 			InstanceName:    defaultInstance.Name,
 * 			TableName:       defaultTable.TableName,
 * 			IndexName:       pulumi.String("example_index"),
 * 			IndexType:       pulumi.String("Global"),
 * 			IncludeBaseData: pulumi.Bool(true),
 * 			PrimaryKeys: pulumi.StringArray{
 * 				pulumi.String("pk1"),
 * 				pulumi.String("pk2"),
 * 				pulumi.String("pk3"),
 * 			},
 * 			DefinedColumns: pulumi.StringArray{
 * 				pulumi.String("col1"),
 * 				pulumi.String("col2"),
 * 				pulumi.String("col3"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```yaml
 * configuration:
 *   name:
 *     type: string
 *     default: tf-example
 * resources:
 *   default:
 *     type: random:integer
 *     properties:
 *       min: 10000
 *       max: 99999
 *   defaultInstance:
 *     type: alicloud:ots:Instance
 *     name: default
 *     properties:
 *       name: ${name}-${default.result}
 *       description: ${name}
 *       accessedBy: Any
 *       tags:
 *         Created: TF
 *         For: example
 *   defaultTable:
 *     type: alicloud:ots:Table
 *     name: default
 *     properties:
 *       instanceName: ${defaultInstance.name}
 *       tableName: tf_example
 *       timeToLive: -1
 *       maxVersion: 1
 *       enableSse: true
 *       sseKeyType: SSE_KMS_SERVICE
 *       primaryKeys:
 *         - name: pk1
 *           type: Integer
 *         - name: pk2
 *           type: String
 *         - name: pk3
 *           type: Binary
 *       definedColumns:
 *         - name: col1
 *           type: Integer
 *         - name: col2
 *           type: String
 *         - name: col3
 *           type: Binary
 *   defaultSecondaryIndex:
 *     type: alicloud:ots:SecondaryIndex
 *     name: default
 *     properties:
 *       instanceName: ${defaultInstance.name}
 *       tableName: ${defaultTable.tableName}
 *       indexName: example_index
 *       indexType: Global
 *       includeBaseData: true
 *       primaryKeys:
 *         - pk1
 *         - pk2
 *         - pk3
 *       definedColumns:
 *         - col1
 *         - col2
 *         - col3
 * ```
 * 
 * ## Import
 * OTS secondary index can be imported using id, e.g.
 * ```sh
 * $ pulumi import alicloud:ots/secondaryIndex:SecondaryIndex index1 :::
 * ```
 * @property definedColumns A list of defined column for index, referenced from Table's primary keys or predefined columns.
 * @property includeBaseData whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
 * @property indexName The index name of the OTS Table. If changed, a new index would be created.
 * @property indexType The index type of the OTS Table. If changed, a new index would be created, only `Global` or `Local` is allowed.
 * @property instanceName The name of the OTS instance in which table will located.
 * @property primaryKeys A list of primary keys for index, referenced from Table's primary keys or predefined columns.
 * @property tableName The name of the OTS table. If changed, a new table would be created.
 */
public data class SecondaryIndexArgs(
    public val definedColumns: Output>? = null,
    public val includeBaseData: Output? = null,
    public val indexName: Output? = null,
    public val indexType: Output? = null,
    public val instanceName: Output? = null,
    public val primaryKeys: Output>? = null,
    public val tableName: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.alicloud.ots.SecondaryIndexArgs =
        com.pulumi.alicloud.ots.SecondaryIndexArgs.builder()
            .definedColumns(definedColumns?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .includeBaseData(includeBaseData?.applyValue({ args0 -> args0 }))
            .indexName(indexName?.applyValue({ args0 -> args0 }))
            .indexType(indexType?.applyValue({ args0 -> args0 }))
            .instanceName(instanceName?.applyValue({ args0 -> args0 }))
            .primaryKeys(primaryKeys?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .tableName(tableName?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SecondaryIndexArgs].
 */
@PulumiTagMarker
public class SecondaryIndexArgsBuilder internal constructor() {
    private var definedColumns: Output>? = null

    private var includeBaseData: Output? = null

    private var indexName: Output? = null

    private var indexType: Output? = null

    private var instanceName: Output? = null

    private var primaryKeys: Output>? = null

    private var tableName: Output? = null

    /**
     * @param value A list of defined column for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("ohphuuscafcbajvo")
    public suspend fun definedColumns(`value`: Output>) {
        this.definedColumns = value
    }

    @JvmName("mnwkbibnxepotogt")
    public suspend fun definedColumns(vararg values: Output) {
        this.definedColumns = Output.all(values.asList())
    }

    /**
     * @param values A list of defined column for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("vqfrdnrsygqeqmag")
    public suspend fun definedColumns(values: List>) {
        this.definedColumns = Output.all(values)
    }

    /**
     * @param value whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
     */
    @JvmName("wsuaoqumadelubpv")
    public suspend fun includeBaseData(`value`: Output) {
        this.includeBaseData = value
    }

    /**
     * @param value The index name of the OTS Table. If changed, a new index would be created.
     */
    @JvmName("cyioqrwsbxylncat")
    public suspend fun indexName(`value`: Output) {
        this.indexName = value
    }

    /**
     * @param value The index type of the OTS Table. If changed, a new index would be created, only `Global` or `Local` is allowed.
     */
    @JvmName("ceaqmsxnvjbycxbx")
    public suspend fun indexType(`value`: Output) {
        this.indexType = value
    }

    /**
     * @param value The name of the OTS instance in which table will located.
     */
    @JvmName("gnqkrjxvymlruqqk")
    public suspend fun instanceName(`value`: Output) {
        this.instanceName = value
    }

    /**
     * @param value A list of primary keys for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("qluldecjrblgfdog")
    public suspend fun primaryKeys(`value`: Output>) {
        this.primaryKeys = value
    }

    @JvmName("nuigxjyjjfvcggmf")
    public suspend fun primaryKeys(vararg values: Output) {
        this.primaryKeys = Output.all(values.asList())
    }

    /**
     * @param values A list of primary keys for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("hflrqwegjthqvkki")
    public suspend fun primaryKeys(values: List>) {
        this.primaryKeys = Output.all(values)
    }

    /**
     * @param value The name of the OTS table. If changed, a new table would be created.
     */
    @JvmName("xycggdjhbxifvrka")
    public suspend fun tableName(`value`: Output) {
        this.tableName = value
    }

    /**
     * @param value A list of defined column for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("rmbkjvuyuxyaumby")
    public suspend fun definedColumns(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.definedColumns = mapped
    }

    /**
     * @param values A list of defined column for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("ofaeetedukwoeokc")
    public suspend fun definedColumns(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.definedColumns = mapped
    }

    /**
     * @param value whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
     */
    @JvmName("miwikknadexhrjyr")
    public suspend fun includeBaseData(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.includeBaseData = mapped
    }

    /**
     * @param value The index name of the OTS Table. If changed, a new index would be created.
     */
    @JvmName("xrqbwbjrapisaqlu")
    public suspend fun indexName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.indexName = mapped
    }

    /**
     * @param value The index type of the OTS Table. If changed, a new index would be created, only `Global` or `Local` is allowed.
     */
    @JvmName("usspkpqsqwxqkwrp")
    public suspend fun indexType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.indexType = mapped
    }

    /**
     * @param value The name of the OTS instance in which table will located.
     */
    @JvmName("gubhvgexmditubck")
    public suspend fun instanceName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instanceName = mapped
    }

    /**
     * @param value A list of primary keys for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("nucaekxxqcxdjlek")
    public suspend fun primaryKeys(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.primaryKeys = mapped
    }

    /**
     * @param values A list of primary keys for index, referenced from Table's primary keys or predefined columns.
     */
    @JvmName("vlvfguemmvfuvcnh")
    public suspend fun primaryKeys(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.primaryKeys = mapped
    }

    /**
     * @param value The name of the OTS table. If changed, a new table would be created.
     */
    @JvmName("etabtrghqpakhgfv")
    public suspend fun tableName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tableName = mapped
    }

    internal fun build(): SecondaryIndexArgs = SecondaryIndexArgs(
        definedColumns = definedColumns,
        includeBaseData = includeBaseData,
        indexName = indexName,
        indexType = indexType,
        instanceName = instanceName,
        primaryKeys = primaryKeys,
        tableName = tableName,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy