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

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

package com.pulumi.gcp.firestore.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.firestore.IndexArgs.builder
import com.pulumi.gcp.firestore.kotlin.inputs.IndexFieldArgs
import com.pulumi.gcp.firestore.kotlin.inputs.IndexFieldArgsBuilder
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

/**
 * Cloud Firestore indexes enable simple and complex queries against documents in a database.
 *  This resource manages composite indexes and not single
 * field indexes.
 * To get more information about Index, see:
 * * [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.indexes)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/firestore/docs/query-data/indexing)
 * > **Warning:** This resource creates a Firestore Index on a project that already has
 * a Firestore database. If you haven't already created it, you may
 * create a `gcp.firestore.Database` resource and `location_id` set
 * to your chosen location. If you wish to use App Engine, you may
 * instead create a `gcp.appengine.Application` resource with
 * `database_type` set to `"CLOUD_FIRESTORE"`. Your Firestore location
 * will be the same as the App Engine location specified.
 * ## Example Usage
 * ### Firestore Index Basic
 * 
 * ```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: "database-id",
 *     locationId: "nam5",
 *     type: "FIRESTORE_NATIVE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const my_index = new gcp.firestore.Index("my-index", {
 *     project: "my-project-name",
 *     database: database.name,
 *     collection: "atestcollection",
 *     fields: [
 *         {
 *             fieldPath: "name",
 *             order: "ASCENDING",
 *         },
 *         {
 *             fieldPath: "description",
 *             order: "DESCENDING",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="database-id",
 *     location_id="nam5",
 *     type="FIRESTORE_NATIVE",
 *     delete_protection_state="DELETE_PROTECTION_DISABLED",
 *     deletion_policy="DELETE")
 * my_index = gcp.firestore.Index("my-index",
 *     project="my-project-name",
 *     database=database.name,
 *     collection="atestcollection",
 *     fields=[
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="name",
 *             order="ASCENDING",
 *         ),
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="description",
 *             order="DESCENDING",
 *         ),
 *     ])
 * ```
 * ```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 = "database-id",
 *         LocationId = "nam5",
 *         Type = "FIRESTORE_NATIVE",
 *         DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var my_index = new Gcp.Firestore.Index("my-index", new()
 *     {
 *         Project = "my-project-name",
 *         Database = database.Name,
 *         Collection = "atestcollection",
 *         Fields = new[]
 *         {
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "name",
 *                 Order = "ASCENDING",
 *             },
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "description",
 *                 Order = "DESCENDING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("database-id"),
 * 			LocationId:            pulumi.String("nam5"),
 * 			Type:                  pulumi.String("FIRESTORE_NATIVE"),
 * 			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
 * 			DeletionPolicy:        pulumi.String("DELETE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
 * 			Project:    pulumi.String("my-project-name"),
 * 			Database:   database.Name,
 * 			Collection: pulumi.String("atestcollection"),
 * 			Fields: firestore.IndexFieldArray{
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("name"),
 * 					Order:     pulumi.String("ASCENDING"),
 * 				},
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("description"),
 * 					Order:     pulumi.String("DESCENDING"),
 * 				},
 * 			},
 * 		})
 * 		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.firestore.Index;
 * import com.pulumi.gcp.firestore.IndexArgs;
 * import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
 * 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("database-id")
 *             .locationId("nam5")
 *             .type("FIRESTORE_NATIVE")
 *             .deleteProtectionState("DELETE_PROTECTION_DISABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var my_index = new Index("my-index", IndexArgs.builder()
 *             .project("my-project-name")
 *             .database(database.name())
 *             .collection("atestcollection")
 *             .fields(
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("name")
 *                     .order("ASCENDING")
 *                     .build(),
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("description")
 *                     .order("DESCENDING")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: database-id
 *       locationId: nam5
 *       type: FIRESTORE_NATIVE
 *       deleteProtectionState: DELETE_PROTECTION_DISABLED
 *       deletionPolicy: DELETE
 *   my-index:
 *     type: gcp:firestore:Index
 *     properties:
 *       project: my-project-name
 *       database: ${database.name}
 *       collection: atestcollection
 *       fields:
 *         - fieldPath: name
 *           order: ASCENDING
 *         - fieldPath: description
 *           order: DESCENDING
 * ```
 * 
 * ### Firestore Index Datastore Mode
 * 
 * ```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: "database-id-dm",
 *     locationId: "nam5",
 *     type: "DATASTORE_MODE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const my_index = new gcp.firestore.Index("my-index", {
 *     project: "my-project-name",
 *     database: database.name,
 *     collection: "atestcollection",
 *     queryScope: "COLLECTION_RECURSIVE",
 *     apiScope: "DATASTORE_MODE_API",
 *     fields: [
 *         {
 *             fieldPath: "name",
 *             order: "ASCENDING",
 *         },
 *         {
 *             fieldPath: "description",
 *             order: "DESCENDING",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="database-id-dm",
 *     location_id="nam5",
 *     type="DATASTORE_MODE",
 *     delete_protection_state="DELETE_PROTECTION_DISABLED",
 *     deletion_policy="DELETE")
 * my_index = gcp.firestore.Index("my-index",
 *     project="my-project-name",
 *     database=database.name,
 *     collection="atestcollection",
 *     query_scope="COLLECTION_RECURSIVE",
 *     api_scope="DATASTORE_MODE_API",
 *     fields=[
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="name",
 *             order="ASCENDING",
 *         ),
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="description",
 *             order="DESCENDING",
 *         ),
 *     ])
 * ```
 * ```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 = "database-id-dm",
 *         LocationId = "nam5",
 *         Type = "DATASTORE_MODE",
 *         DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var my_index = new Gcp.Firestore.Index("my-index", new()
 *     {
 *         Project = "my-project-name",
 *         Database = database.Name,
 *         Collection = "atestcollection",
 *         QueryScope = "COLLECTION_RECURSIVE",
 *         ApiScope = "DATASTORE_MODE_API",
 *         Fields = new[]
 *         {
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "name",
 *                 Order = "ASCENDING",
 *             },
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "description",
 *                 Order = "DESCENDING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("database-id-dm"),
 * 			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 = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
 * 			Project:    pulumi.String("my-project-name"),
 * 			Database:   database.Name,
 * 			Collection: pulumi.String("atestcollection"),
 * 			QueryScope: pulumi.String("COLLECTION_RECURSIVE"),
 * 			ApiScope:   pulumi.String("DATASTORE_MODE_API"),
 * 			Fields: firestore.IndexFieldArray{
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("name"),
 * 					Order:     pulumi.String("ASCENDING"),
 * 				},
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("description"),
 * 					Order:     pulumi.String("DESCENDING"),
 * 				},
 * 			},
 * 		})
 * 		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.firestore.Index;
 * import com.pulumi.gcp.firestore.IndexArgs;
 * import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
 * 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("database-id-dm")
 *             .locationId("nam5")
 *             .type("DATASTORE_MODE")
 *             .deleteProtectionState("DELETE_PROTECTION_DISABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var my_index = new Index("my-index", IndexArgs.builder()
 *             .project("my-project-name")
 *             .database(database.name())
 *             .collection("atestcollection")
 *             .queryScope("COLLECTION_RECURSIVE")
 *             .apiScope("DATASTORE_MODE_API")
 *             .fields(
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("name")
 *                     .order("ASCENDING")
 *                     .build(),
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("description")
 *                     .order("DESCENDING")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: database-id-dm
 *       locationId: nam5
 *       type: DATASTORE_MODE
 *       deleteProtectionState: DELETE_PROTECTION_DISABLED
 *       deletionPolicy: DELETE
 *   my-index:
 *     type: gcp:firestore:Index
 *     properties:
 *       project: my-project-name
 *       database: ${database.name}
 *       collection: atestcollection
 *       queryScope: COLLECTION_RECURSIVE
 *       apiScope: DATASTORE_MODE_API
 *       fields:
 *         - fieldPath: name
 *           order: ASCENDING
 *         - fieldPath: description
 *           order: DESCENDING
 * ```
 * 
 * ### Firestore Index Vector
 * 
 * ```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: "database-id-vector",
 *     locationId: "nam5",
 *     type: "FIRESTORE_NATIVE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const my_index = new gcp.firestore.Index("my-index", {
 *     project: "my-project-name",
 *     database: database.name,
 *     collection: "atestcollection",
 *     fields: [
 *         {
 *             fieldPath: "field_name",
 *             order: "ASCENDING",
 *         },
 *         {
 *             fieldPath: "__name__",
 *             order: "ASCENDING",
 *         },
 *         {
 *             fieldPath: "description",
 *             vectorConfig: {
 *                 dimension: 128,
 *                 flat: {},
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="database-id-vector",
 *     location_id="nam5",
 *     type="FIRESTORE_NATIVE",
 *     delete_protection_state="DELETE_PROTECTION_DISABLED",
 *     deletion_policy="DELETE")
 * my_index = gcp.firestore.Index("my-index",
 *     project="my-project-name",
 *     database=database.name,
 *     collection="atestcollection",
 *     fields=[
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="field_name",
 *             order="ASCENDING",
 *         ),
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="__name__",
 *             order="ASCENDING",
 *         ),
 *         gcp.firestore.IndexFieldArgs(
 *             field_path="description",
 *             vector_config=gcp.firestore.IndexFieldVectorConfigArgs(
 *                 dimension=128,
 *                 flat=gcp.firestore.IndexFieldVectorConfigFlatArgs(),
 *             ),
 *         ),
 *     ])
 * ```
 * ```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 = "database-id-vector",
 *         LocationId = "nam5",
 *         Type = "FIRESTORE_NATIVE",
 *         DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var my_index = new Gcp.Firestore.Index("my-index", new()
 *     {
 *         Project = "my-project-name",
 *         Database = database.Name,
 *         Collection = "atestcollection",
 *         Fields = new[]
 *         {
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "field_name",
 *                 Order = "ASCENDING",
 *             },
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "__name__",
 *                 Order = "ASCENDING",
 *             },
 *             new Gcp.Firestore.Inputs.IndexFieldArgs
 *             {
 *                 FieldPath = "description",
 *                 VectorConfig = new Gcp.Firestore.Inputs.IndexFieldVectorConfigArgs
 *                 {
 *                     Dimension = 128,
 *                     Flat = null,
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("database-id-vector"),
 * 			LocationId:            pulumi.String("nam5"),
 * 			Type:                  pulumi.String("FIRESTORE_NATIVE"),
 * 			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
 * 			DeletionPolicy:        pulumi.String("DELETE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
 * 			Project:    pulumi.String("my-project-name"),
 * 			Database:   database.Name,
 * 			Collection: pulumi.String("atestcollection"),
 * 			Fields: firestore.IndexFieldArray{
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("field_name"),
 * 					Order:     pulumi.String("ASCENDING"),
 * 				},
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("__name__"),
 * 					Order:     pulumi.String("ASCENDING"),
 * 				},
 * 				&firestore.IndexFieldArgs{
 * 					FieldPath: pulumi.String("description"),
 * 					VectorConfig: &firestore.IndexFieldVectorConfigArgs{
 * 						Dimension: pulumi.Int(128),
 * 						Flat:      nil,
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.firestore.Index;
 * import com.pulumi.gcp.firestore.IndexArgs;
 * import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
 * import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigArgs;
 * import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigFlatArgs;
 * 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("database-id-vector")
 *             .locationId("nam5")
 *             .type("FIRESTORE_NATIVE")
 *             .deleteProtectionState("DELETE_PROTECTION_DISABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var my_index = new Index("my-index", IndexArgs.builder()
 *             .project("my-project-name")
 *             .database(database.name())
 *             .collection("atestcollection")
 *             .fields(
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("field_name")
 *                     .order("ASCENDING")
 *                     .build(),
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("__name__")
 *                     .order("ASCENDING")
 *                     .build(),
 *                 IndexFieldArgs.builder()
 *                     .fieldPath("description")
 *                     .vectorConfig(IndexFieldVectorConfigArgs.builder()
 *                         .dimension(128)
 *                         .flat()
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: database-id-vector
 *       locationId: nam5
 *       type: FIRESTORE_NATIVE
 *       deleteProtectionState: DELETE_PROTECTION_DISABLED
 *       deletionPolicy: DELETE
 *   my-index:
 *     type: gcp:firestore:Index
 *     properties:
 *       project: my-project-name
 *       database: ${database.name}
 *       collection: atestcollection
 *       fields:
 *         - fieldPath: field_name
 *           order: ASCENDING
 *         - fieldPath: __name__
 *           order: ASCENDING
 *         - fieldPath: description
 *           vectorConfig:
 *             dimension: 128
 *             flat: {}
 * ```
 * 
 * ## Import
 * Index can be imported using any of these accepted formats:
 * * `{{name}}`
 * When using the `pulumi import` command, Index can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firestore/index:Index default {{name}}
 * ```
 * @property apiScope The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
 * @property collection The collection being indexed.
 * @property database The Firestore database id. Defaults to '"(default)"'.
 * @property fields The fields supported by this index. The last non-stored field entry is
 * always for the field path `__name__`. If, on creation, `__name__` was not
 * specified as the last field, it will be added automatically with the same
 * direction as that of the last field defined. If the final field in a
 * composite index is not directional, the `__name__` will be ordered
 * `"ASCENDING"` (unless explicitly specified otherwise).
 * Structure is documented below.
 * @property project
 * @property queryScope The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP",
 * "COLLECTION_RECURSIVE"]
 */
public data class IndexArgs(
    public val apiScope: Output? = null,
    public val collection: Output? = null,
    public val database: Output? = null,
    public val fields: Output>? = null,
    public val project: Output? = null,
    public val queryScope: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.firestore.IndexArgs =
        com.pulumi.gcp.firestore.IndexArgs.builder()
            .apiScope(apiScope?.applyValue({ args0 -> args0 }))
            .collection(collection?.applyValue({ args0 -> args0 }))
            .database(database?.applyValue({ args0 -> args0 }))
            .fields(fields?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
            .project(project?.applyValue({ args0 -> args0 }))
            .queryScope(queryScope?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [IndexArgs].
 */
@PulumiTagMarker
public class IndexArgsBuilder internal constructor() {
    private var apiScope: Output? = null

    private var collection: Output? = null

    private var database: Output? = null

    private var fields: Output>? = null

    private var project: Output? = null

    private var queryScope: Output? = null

    /**
     * @param value The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
     */
    @JvmName("ljwwbjugrhdsxfft")
    public suspend fun apiScope(`value`: Output) {
        this.apiScope = value
    }

    /**
     * @param value The collection being indexed.
     */
    @JvmName("erbthyjgqgrpobjs")
    public suspend fun collection(`value`: Output) {
        this.collection = value
    }

    /**
     * @param value The Firestore database id. Defaults to '"(default)"'.
     */
    @JvmName("kaeuujoptarhpqrh")
    public suspend fun database(`value`: Output) {
        this.database = value
    }

    /**
     * @param value The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("uqjcffwywipmebkh")
    public suspend fun fields(`value`: Output>) {
        this.fields = value
    }

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

    /**
     * @param values The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("nulasegjfsgrdohq")
    public suspend fun fields(values: List>) {
        this.fields = Output.all(values)
    }

    /**
     * @param value
     */
    @JvmName("afncwnppgwhjqskn")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP",
     * "COLLECTION_RECURSIVE"]
     */
    @JvmName("gfkynvcgsepusgts")
    public suspend fun queryScope(`value`: Output) {
        this.queryScope = value
    }

    /**
     * @param value The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
     */
    @JvmName("wfcgbbywrmveebpn")
    public suspend fun apiScope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.apiScope = mapped
    }

    /**
     * @param value The collection being indexed.
     */
    @JvmName("trehkhsftvtcgvjn")
    public suspend fun collection(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.collection = mapped
    }

    /**
     * @param value The Firestore database id. Defaults to '"(default)"'.
     */
    @JvmName("vrcymrcuvwwfoilk")
    public suspend fun database(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.database = mapped
    }

    /**
     * @param value The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("lytrmdwugmmdwoly")
    public suspend fun fields(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.fields = mapped
    }

    /**
     * @param argument The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("lskalfdjsgorphwt")
    public suspend fun fields(argument: List Unit>) {
        val toBeMapped = argument.toList().map { IndexFieldArgsBuilder().applySuspend { it() }.build() }
        val mapped = of(toBeMapped)
        this.fields = mapped
    }

    /**
     * @param argument The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("ghekyesdkjswniae")
    public suspend fun fields(vararg argument: suspend IndexFieldArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map { IndexFieldArgsBuilder().applySuspend { it() }.build() }
        val mapped = of(toBeMapped)
        this.fields = mapped
    }

    /**
     * @param argument The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("qsslxvchrabgelcm")
    public suspend fun fields(argument: suspend IndexFieldArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(IndexFieldArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.fields = mapped
    }

    /**
     * @param values The fields supported by this index. The last non-stored field entry is
     * always for the field path `__name__`. If, on creation, `__name__` was not
     * specified as the last field, it will be added automatically with the same
     * direction as that of the last field defined. If the final field in a
     * composite index is not directional, the `__name__` will be ordered
     * `"ASCENDING"` (unless explicitly specified otherwise).
     * Structure is documented below.
     */
    @JvmName("qyroqeqyjjhygymu")
    public suspend fun fields(vararg values: IndexFieldArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.fields = mapped
    }

    /**
     * @param value
     */
    @JvmName("rupdikrhfuuqsfho")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP",
     * "COLLECTION_RECURSIVE"]
     */
    @JvmName("gtxrngfcjebbrvoj")
    public suspend fun queryScope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.queryScope = mapped
    }

    internal fun build(): IndexArgs = IndexArgs(
        apiScope = apiScope,
        collection = collection,
        database = database,
        fields = fields,
        project = project,
        queryScope = queryScope,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy