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

com.pulumi.gcp.datastore.kotlin.DataStoreIndexArgs.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: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.datastore.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.datastore.DataStoreIndexArgs.builder
import com.pulumi.gcp.datastore.kotlin.inputs.DataStoreIndexPropertyArgs
import com.pulumi.gcp.datastore.kotlin.inputs.DataStoreIndexPropertyArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Describes a composite index for Cloud Datastore.
 * To get more information about Index, see:
 * * [API documentation](https://cloud.google.com/datastore/docs/reference/admin/rest/v1/projects.indexes)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/datastore/docs/concepts/indexes)
 * > **Warning:** This resource creates a Datastore Index on a project that has already
 * enabled a Datastore-compatible database. If you haven't already enabled
 * one, you can create a `gcp.appengine.Application` resource with
 * `database_type` set to `"CLOUD_DATASTORE_COMPATIBILITY"` to do so. Your
 * Datastore location will be the same as the App Engine location specified.
 * ## Example Usage
 * ### Datastore Index
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const database = new gcp.firestore.Database("database", {
 *     project: "my-project-name",
 *     name: "(default)",
 *     locationId: "nam5",
 *     type: "DATASTORE_MODE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const _default = new gcp.datastore.DataStoreIndex("default", {
 *     kind: "foo",
 *     properties: [
 *         {
 *             name: "property_a",
 *             direction: "ASCENDING",
 *         },
 *         {
 *             name: "property_b",
 *             direction: "ASCENDING",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="(default)",
 *     location_id="nam5",
 *     type="DATASTORE_MODE",
 *     delete_protection_state="DELETE_PROTECTION_DISABLED",
 *     deletion_policy="DELETE")
 * default = gcp.datastore.DataStoreIndex("default",
 *     kind="foo",
 *     properties=[
 *         gcp.datastore.DataStoreIndexPropertyArgs(
 *             name="property_a",
 *             direction="ASCENDING",
 *         ),
 *         gcp.datastore.DataStoreIndexPropertyArgs(
 *             name="property_b",
 *             direction="ASCENDING",
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var database = new Gcp.Firestore.Database("database", new()
 *     {
 *         Project = "my-project-name",
 *         Name = "(default)",
 *         LocationId = "nam5",
 *         Type = "DATASTORE_MODE",
 *         DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var @default = new Gcp.Datastore.DataStoreIndex("default", new()
 *     {
 *         Kind = "foo",
 *         Properties = new[]
 *         {
 *             new Gcp.Datastore.Inputs.DataStoreIndexPropertyArgs
 *             {
 *                 Name = "property_a",
 *                 Direction = "ASCENDING",
 *             },
 *             new Gcp.Datastore.Inputs.DataStoreIndexPropertyArgs
 *             {
 *                 Name = "property_b",
 *                 Direction = "ASCENDING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/datastore"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("(default)"),
 * 			LocationId:            pulumi.String("nam5"),
 * 			Type:                  pulumi.String("DATASTORE_MODE"),
 * 			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
 * 			DeletionPolicy:        pulumi.String("DELETE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = datastore.NewDataStoreIndex(ctx, "default", &datastore.DataStoreIndexArgs{
 * 			Kind: pulumi.String("foo"),
 * 			Properties: datastore.DataStoreIndexPropertyArray{
 * 				&datastore.DataStoreIndexPropertyArgs{
 * 					Name:      pulumi.String("property_a"),
 * 					Direction: pulumi.String("ASCENDING"),
 * 				},
 * 				&datastore.DataStoreIndexPropertyArgs{
 * 					Name:      pulumi.String("property_b"),
 * 					Direction: pulumi.String("ASCENDING"),
 * 				},
 * 			},
 * 		})
 * 		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.firestore.Database;
 * import com.pulumi.gcp.firestore.DatabaseArgs;
 * import com.pulumi.gcp.datastore.DataStoreIndex;
 * import com.pulumi.gcp.datastore.DataStoreIndexArgs;
 * import com.pulumi.gcp.datastore.inputs.DataStoreIndexPropertyArgs;
 * 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 database = new Database("database", DatabaseArgs.builder()
 *             .project("my-project-name")
 *             .name("(default)")
 *             .locationId("nam5")
 *             .type("DATASTORE_MODE")
 *             .deleteProtectionState("DELETE_PROTECTION_DISABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var default_ = new DataStoreIndex("default", DataStoreIndexArgs.builder()
 *             .kind("foo")
 *             .properties(
 *                 DataStoreIndexPropertyArgs.builder()
 *                     .name("property_a")
 *                     .direction("ASCENDING")
 *                     .build(),
 *                 DataStoreIndexPropertyArgs.builder()
 *                     .name("property_b")
 *                     .direction("ASCENDING")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: (default)
 *       locationId: nam5
 *       type: DATASTORE_MODE
 *       deleteProtectionState: DELETE_PROTECTION_DISABLED
 *       deletionPolicy: DELETE
 *   default:
 *     type: gcp:datastore:DataStoreIndex
 *     properties:
 *       kind: foo
 *       properties:
 *         - name: property_a
 *           direction: ASCENDING
 *         - name: property_b
 *           direction: ASCENDING
 * ```
 * 
 * ## Import
 * Index can be imported using any of these accepted formats:
 * * `projects/{{project}}/indexes/{{index_id}}`
 * * `{{project}}/{{index_id}}`
 * * `{{index_id}}`
 * When using the `pulumi import` command, Index can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default projects/{{project}}/indexes/{{index_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{project}}/{{index_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{index_id}}
 * ```
 * @property ancestor Policy for including ancestors in the index.
 * Default value is `NONE`.
 * Possible values are: `NONE`, `ALL_ANCESTORS`.
 * @property kind The entity kind which the index applies to.
 * - - -
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property properties An ordered list of properties to index on.
 * Structure is documented below.
 */
public data class DataStoreIndexArgs(
    public val ancestor: Output? = null,
    public val kind: Output? = null,
    public val project: Output? = null,
    public val properties: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.datastore.DataStoreIndexArgs =
        com.pulumi.gcp.datastore.DataStoreIndexArgs.builder()
            .ancestor(ancestor?.applyValue({ args0 -> args0 }))
            .kind(kind?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .properties(
                properties?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            ).build()
}

/**
 * Builder for [DataStoreIndexArgs].
 */
@PulumiTagMarker
public class DataStoreIndexArgsBuilder internal constructor() {
    private var ancestor: Output? = null

    private var kind: Output? = null

    private var project: Output? = null

    private var properties: Output>? = null

    /**
     * @param value Policy for including ancestors in the index.
     * Default value is `NONE`.
     * Possible values are: `NONE`, `ALL_ANCESTORS`.
     */
    @JvmName("ufptigwyvibhtinv")
    public suspend fun ancestor(`value`: Output) {
        this.ancestor = value
    }

    /**
     * @param value The entity kind which the index applies to.
     * - - -
     */
    @JvmName("qpbpvlvdcnjjqjpe")
    public suspend fun kind(`value`: Output) {
        this.kind = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("aaotqlwndcprsgnc")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("gduhpqbocsuvuutn")
    public suspend fun properties(`value`: Output>) {
        this.properties = value
    }

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

    /**
     * @param values An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("fscvamrsxuibtikc")
    public suspend fun properties(values: List>) {
        this.properties = Output.all(values)
    }

    /**
     * @param value Policy for including ancestors in the index.
     * Default value is `NONE`.
     * Possible values are: `NONE`, `ALL_ANCESTORS`.
     */
    @JvmName("jblqksucuuikmoin")
    public suspend fun ancestor(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ancestor = mapped
    }

    /**
     * @param value The entity kind which the index applies to.
     * - - -
     */
    @JvmName("uhjhtlpfmmgvgysx")
    public suspend fun kind(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.kind = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("buuhssryedeieuwj")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("cplximucbqcwqvrw")
    public suspend fun properties(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.properties = mapped
    }

    /**
     * @param argument An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("rcghxqfifnrnibqp")
    public suspend fun properties(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            DataStoreIndexPropertyArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.properties = mapped
    }

    /**
     * @param argument An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("qsmbsyjijeradhjd")
    public suspend fun properties(vararg argument: suspend DataStoreIndexPropertyArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            DataStoreIndexPropertyArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.properties = mapped
    }

    /**
     * @param argument An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("dsfdbudapuevduhk")
    public suspend fun properties(argument: suspend DataStoreIndexPropertyArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(DataStoreIndexPropertyArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.properties = mapped
    }

    /**
     * @param values An ordered list of properties to index on.
     * Structure is documented below.
     */
    @JvmName("ipuiyiuocubfuagf")
    public suspend fun properties(vararg values: DataStoreIndexPropertyArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.properties = mapped
    }

    internal fun build(): DataStoreIndexArgs = DataStoreIndexArgs(
        ancestor = ancestor,
        kind = kind,
        project = project,
        properties = properties,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy