1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. datastore
  5. DataStoreIndex
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.datastore.DataStoreIndex

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Describes a composite index for Cloud Datastore.

    To get more information about Index, see:

    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

    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",
            },
        ],
    }, {
        dependsOn: [database],
    });
    
    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",
            ),
        ],
        opts = pulumi.ResourceOptions(depends_on=[database]))
    
    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 {
    		database, 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"),
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			database,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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",
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                database,
            },
        });
    
    });
    
    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 com.pulumi.resources.CustomResourceOptions;
    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(), CustomResourceOptions.builder()
                    .dependsOn(database)
                    .build());
    
        }
    }
    
    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
        options:
          dependson:
            - ${database}
    

    Create DataStoreIndex Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DataStoreIndex(name: string, args: DataStoreIndexArgs, opts?: CustomResourceOptions);
    @overload
    def DataStoreIndex(resource_name: str,
                       args: DataStoreIndexArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def DataStoreIndex(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       kind: Optional[str] = None,
                       ancestor: Optional[str] = None,
                       project: Optional[str] = None,
                       properties: Optional[Sequence[DataStoreIndexPropertyArgs]] = None)
    func NewDataStoreIndex(ctx *Context, name string, args DataStoreIndexArgs, opts ...ResourceOption) (*DataStoreIndex, error)
    public DataStoreIndex(string name, DataStoreIndexArgs args, CustomResourceOptions? opts = null)
    public DataStoreIndex(String name, DataStoreIndexArgs args)
    public DataStoreIndex(String name, DataStoreIndexArgs args, CustomResourceOptions options)
    
    type: gcp:datastore:DataStoreIndex
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DataStoreIndexArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args DataStoreIndexArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args DataStoreIndexArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DataStoreIndexArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DataStoreIndexArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var dataStoreIndexResource = new Gcp.Datastore.DataStoreIndex("dataStoreIndexResource", new()
    {
        Kind = "string",
        Ancestor = "string",
        Project = "string",
        Properties = new[]
        {
            new Gcp.Datastore.Inputs.DataStoreIndexPropertyArgs
            {
                Direction = "string",
                Name = "string",
            },
        },
    });
    
    example, err := datastore.NewDataStoreIndex(ctx, "dataStoreIndexResource", &datastore.DataStoreIndexArgs{
    	Kind:     pulumi.String("string"),
    	Ancestor: pulumi.String("string"),
    	Project:  pulumi.String("string"),
    	Properties: datastore.DataStoreIndexPropertyArray{
    		&datastore.DataStoreIndexPropertyArgs{
    			Direction: pulumi.String("string"),
    			Name:      pulumi.String("string"),
    		},
    	},
    })
    
    var dataStoreIndexResource = new DataStoreIndex("dataStoreIndexResource", DataStoreIndexArgs.builder()
        .kind("string")
        .ancestor("string")
        .project("string")
        .properties(DataStoreIndexPropertyArgs.builder()
            .direction("string")
            .name("string")
            .build())
        .build());
    
    data_store_index_resource = gcp.datastore.DataStoreIndex("dataStoreIndexResource",
        kind="string",
        ancestor="string",
        project="string",
        properties=[gcp.datastore.DataStoreIndexPropertyArgs(
            direction="string",
            name="string",
        )])
    
    const dataStoreIndexResource = new gcp.datastore.DataStoreIndex("dataStoreIndexResource", {
        kind: "string",
        ancestor: "string",
        project: "string",
        properties: [{
            direction: "string",
            name: "string",
        }],
    });
    
    type: gcp:datastore:DataStoreIndex
    properties:
        ancestor: string
        kind: string
        project: string
        properties:
            - direction: string
              name: string
    

    DataStoreIndex Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The DataStoreIndex resource accepts the following input properties:

    Kind string
    The entity kind which the index applies to.


    Ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Properties List<DataStoreIndexProperty>
    An ordered list of properties to index on. Structure is documented below.
    Kind string
    The entity kind which the index applies to.


    Ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Properties []DataStoreIndexPropertyArgs
    An ordered list of properties to index on. Structure is documented below.
    kind String
    The entity kind which the index applies to.


    ancestor String
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties List<DataStoreIndexProperty>
    An ordered list of properties to index on. Structure is documented below.
    kind string
    The entity kind which the index applies to.


    ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties DataStoreIndexProperty[]
    An ordered list of properties to index on. Structure is documented below.
    kind str
    The entity kind which the index applies to.


    ancestor str
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties Sequence[DataStoreIndexPropertyArgs]
    An ordered list of properties to index on. Structure is documented below.
    kind String
    The entity kind which the index applies to.


    ancestor String
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties List<Property Map>
    An ordered list of properties to index on. Structure is documented below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DataStoreIndex resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    IndexId string
    The index id.
    Id string
    The provider-assigned unique ID for this managed resource.
    IndexId string
    The index id.
    id String
    The provider-assigned unique ID for this managed resource.
    indexId String
    The index id.
    id string
    The provider-assigned unique ID for this managed resource.
    indexId string
    The index id.
    id str
    The provider-assigned unique ID for this managed resource.
    index_id str
    The index id.
    id String
    The provider-assigned unique ID for this managed resource.
    indexId String
    The index id.

    Look up Existing DataStoreIndex Resource

    Get an existing DataStoreIndex resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: DataStoreIndexState, opts?: CustomResourceOptions): DataStoreIndex
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            ancestor: Optional[str] = None,
            index_id: Optional[str] = None,
            kind: Optional[str] = None,
            project: Optional[str] = None,
            properties: Optional[Sequence[DataStoreIndexPropertyArgs]] = None) -> DataStoreIndex
    func GetDataStoreIndex(ctx *Context, name string, id IDInput, state *DataStoreIndexState, opts ...ResourceOption) (*DataStoreIndex, error)
    public static DataStoreIndex Get(string name, Input<string> id, DataStoreIndexState? state, CustomResourceOptions? opts = null)
    public static DataStoreIndex get(String name, Output<String> id, DataStoreIndexState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    IndexId string
    The index id.
    Kind string
    The entity kind which the index applies to.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Properties List<DataStoreIndexProperty>
    An ordered list of properties to index on. Structure is documented below.
    Ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    IndexId string
    The index id.
    Kind string
    The entity kind which the index applies to.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Properties []DataStoreIndexPropertyArgs
    An ordered list of properties to index on. Structure is documented below.
    ancestor String
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    indexId String
    The index id.
    kind String
    The entity kind which the index applies to.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties List<DataStoreIndexProperty>
    An ordered list of properties to index on. Structure is documented below.
    ancestor string
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    indexId string
    The index id.
    kind string
    The entity kind which the index applies to.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties DataStoreIndexProperty[]
    An ordered list of properties to index on. Structure is documented below.
    ancestor str
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    index_id str
    The index id.
    kind str
    The entity kind which the index applies to.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties Sequence[DataStoreIndexPropertyArgs]
    An ordered list of properties to index on. Structure is documented below.
    ancestor String
    Policy for including ancestors in the index. Default value is NONE. Possible values are: NONE, ALL_ANCESTORS.
    indexId String
    The index id.
    kind String
    The entity kind which the index applies to.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    properties List<Property Map>
    An ordered list of properties to index on. Structure is documented below.

    Supporting Types

    DataStoreIndexProperty, DataStoreIndexPropertyArgs

    Direction string
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    Name string
    The property name to index.
    Direction string
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    Name string
    The property name to index.
    direction String
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    name String
    The property name to index.
    direction string
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    name string
    The property name to index.
    direction str
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    name str
    The property name to index.
    direction String
    The direction the index should optimize for sorting. Possible values are: ASCENDING, DESCENDING.
    name String
    The property name to index.

    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:

    $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default projects/{{project}}/indexes/{{index_id}}
    
    $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{project}}/{{index_id}}
    
    $ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{index_id}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi