import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Represents a single field in the database. * Fields are grouped by their "Collection Group", which represent all collections * in the database with the same id. * * To get more information about Field, see: * * * [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.fields) * * How-to Guides * * [Official Documentation](https://cloud.google.com/firestore/docs/query-data/indexing) * * > **Warning:** This resource creates a Firestore Single Field override on a project that * already has a Firestore database. If you haven't already created it, you may * create a `gcp.firestore.Database` resource with `locationId` set to your * chosen location. * * ## Example Usage * * ### Firestore Field 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_ENABLED", * deletionPolicy: "DELETE", * }); * const basic = new gcp.firestore.Field("basic", { * project: "my-project-name", * database: database.name, * collection: "chatrooms__50610", * field: "basic", * indexConfig: { * indexes: [ * { * order: "ASCENDING", * queryScope: "COLLECTION_GROUP", * }, * { * arrayConfig: "CONTAINS", * }, * ], * }, * }); * ``` * ### Firestore Field Timestamp * * ```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_ENABLED", * deletionPolicy: "DELETE", * }); * const timestamp = new gcp.firestore.Field("timestamp", { * project: "my-project-name", * database: database.name, * collection: "chatrooms", * field: "timestamp", * ttlConfig: {}, * indexConfig: {}, * }); * ``` * ### Firestore Field Match Override * * ```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_ENABLED", * deletionPolicy: "DELETE", * }); * const matchOverride = new gcp.firestore.Field("match_override", { * project: "my-project-name", * database: database.name, * collection: "chatrooms__77124", * field: "field_with_same_configuration_as_ancestor", * indexConfig: { * indexes: [ * { * order: "ASCENDING", * }, * { * order: "DESCENDING", * }, * { * arrayConfig: "CONTAINS", * }, * ], * }, * }); * ``` * ### Firestore Field Wildcard * * ```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_ENABLED", * deletionPolicy: "DELETE", * }); * const wildcard = new gcp.firestore.Field("wildcard", { * project: "my-project-name", * database: database.name, * collection: "chatrooms__15335", * field: "*", * indexConfig: { * indexes: [ * { * order: "ASCENDING", * queryScope: "COLLECTION_GROUP", * }, * { * arrayConfig: "CONTAINS", * }, * ], * }, * }); * ``` * * ## Import * * Field can be imported using any of these accepted formats: * * * `{{name}}` * * When using the `pulumi import` command, Field can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:firestore/field:Field default {{name}} * ``` */ export declare class Field extends pulumi.CustomResource { /** * Get an existing Field resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: FieldState, opts?: pulumi.CustomResourceOptions): Field; /** * Returns true if the given object is an instance of Field. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Field; /** * The id of the collection group to configure. */ readonly collection: pulumi.Output; /** * The Firestore database id. Defaults to `"(default)"`. */ readonly database: pulumi.Output; /** * The id of the field to configure. */ readonly field: pulumi.Output; /** * The single field index configuration for this field. * Creating an index configuration for this field will override any inherited configuration with the * indexes specified. Configuring the index configuration with an empty block disables all indexes on * the field. * Structure is documented below. */ readonly indexConfig: pulumi.Output; /** * The name of this field. Format: * `projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/fields/{{field}}` */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The TTL configuration for this Field. If set to an empty block (i.e. `ttlConfig {}`), a TTL policy is configured based on the field. If unset, a TTL policy is not configured (or will be disabled upon updating the resource). * Structure is documented below. */ readonly ttlConfig: pulumi.Output; /** * Create a Field resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: FieldArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Field resources. */ export interface FieldState { /** * The id of the collection group to configure. */ collection?: pulumi.Input; /** * The Firestore database id. Defaults to `"(default)"`. */ database?: pulumi.Input; /** * The id of the field to configure. */ field?: pulumi.Input; /** * The single field index configuration for this field. * Creating an index configuration for this field will override any inherited configuration with the * indexes specified. Configuring the index configuration with an empty block disables all indexes on * the field. * Structure is documented below. */ indexConfig?: pulumi.Input; /** * The name of this field. Format: * `projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/fields/{{field}}` */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The TTL configuration for this Field. If set to an empty block (i.e. `ttlConfig {}`), a TTL policy is configured based on the field. If unset, a TTL policy is not configured (or will be disabled upon updating the resource). * Structure is documented below. */ ttlConfig?: pulumi.Input; } /** * The set of arguments for constructing a Field resource. */ export interface FieldArgs { /** * The id of the collection group to configure. */ collection: pulumi.Input; /** * The Firestore database id. Defaults to `"(default)"`. */ database?: pulumi.Input; /** * The id of the field to configure. */ field: pulumi.Input; /** * The single field index configuration for this field. * Creating an index configuration for this field will override any inherited configuration with the * indexes specified. Configuring the index configuration with an empty block disables all indexes on * the field. * Structure is documented below. */ indexConfig?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The TTL configuration for this Field. If set to an empty block (i.e. `ttlConfig {}`), a TTL policy is configured based on the field. If unset, a TTL policy is not configured (or will be disabled upon updating the resource). * Structure is documented below. */ ttlConfig?: pulumi.Input; }