1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Nosql
  5. Index
Oracle Cloud Infrastructure v1.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

oci.Nosql.Index

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

    This resource provides the Index resource in Oracle Cloud Infrastructure NoSQL Database service.

    Create a new index on the table identified by tableNameOrId.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testIndex = new oci.nosql.Index("test_index", {
        keys: [{
            columnName: indexKeysColumnName,
            jsonFieldType: indexKeysJsonFieldType,
            jsonPath: indexKeysJsonPath,
        }],
        name: indexName,
        tableNameOrId: testTableNameOr.id,
        compartmentId: compartmentId,
        isIfNotExists: indexIsIfNotExists,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_index = oci.nosql.Index("test_index",
        keys=[oci.nosql.IndexKeyArgs(
            column_name=index_keys_column_name,
            json_field_type=index_keys_json_field_type,
            json_path=index_keys_json_path,
        )],
        name=index_name,
        table_name_or_id=test_table_name_or["id"],
        compartment_id=compartment_id,
        is_if_not_exists=index_is_if_not_exists)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Nosql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Nosql.NewIndex(ctx, "test_index", &Nosql.IndexArgs{
    			Keys: nosql.IndexKeyArray{
    				&nosql.IndexKeyArgs{
    					ColumnName:    pulumi.Any(indexKeysColumnName),
    					JsonFieldType: pulumi.Any(indexKeysJsonFieldType),
    					JsonPath:      pulumi.Any(indexKeysJsonPath),
    				},
    			},
    			Name:          pulumi.Any(indexName),
    			TableNameOrId: pulumi.Any(testTableNameOr.Id),
    			CompartmentId: pulumi.Any(compartmentId),
    			IsIfNotExists: pulumi.Any(indexIsIfNotExists),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testIndex = new Oci.Nosql.Index("test_index", new()
        {
            Keys = new[]
            {
                new Oci.Nosql.Inputs.IndexKeyArgs
                {
                    ColumnName = indexKeysColumnName,
                    JsonFieldType = indexKeysJsonFieldType,
                    JsonPath = indexKeysJsonPath,
                },
            },
            Name = indexName,
            TableNameOrId = testTableNameOr.Id,
            CompartmentId = compartmentId,
            IsIfNotExists = indexIsIfNotExists,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Nosql.Index;
    import com.pulumi.oci.Nosql.IndexArgs;
    import com.pulumi.oci.Nosql.inputs.IndexKeyArgs;
    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 testIndex = new Index("testIndex", IndexArgs.builder()
                .keys(IndexKeyArgs.builder()
                    .columnName(indexKeysColumnName)
                    .jsonFieldType(indexKeysJsonFieldType)
                    .jsonPath(indexKeysJsonPath)
                    .build())
                .name(indexName)
                .tableNameOrId(testTableNameOr.id())
                .compartmentId(compartmentId)
                .isIfNotExists(indexIsIfNotExists)
                .build());
    
        }
    }
    
    resources:
      testIndex:
        type: oci:Nosql:Index
        name: test_index
        properties:
          keys:
            - columnName: ${indexKeysColumnName}
              jsonFieldType: ${indexKeysJsonFieldType}
              jsonPath: ${indexKeysJsonPath}
          name: ${indexName}
          tableNameOrId: ${testTableNameOr.id}
          compartmentId: ${compartmentId}
          isIfNotExists: ${indexIsIfNotExists}
    

    Create Index Resource

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

    Constructor syntax

    new Index(name: string, args: IndexArgs, opts?: CustomResourceOptions);
    @overload
    def Index(resource_name: str,
              args: IndexArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Index(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              keys: Optional[Sequence[_nosql.IndexKeyArgs]] = None,
              table_name_or_id: Optional[str] = None,
              compartment_id: Optional[str] = None,
              is_if_not_exists: Optional[bool] = None,
              name: Optional[str] = None)
    func NewIndex(ctx *Context, name string, args IndexArgs, opts ...ResourceOption) (*Index, error)
    public Index(string name, IndexArgs args, CustomResourceOptions? opts = null)
    public Index(String name, IndexArgs args)
    public Index(String name, IndexArgs args, CustomResourceOptions options)
    
    type: oci:Nosql:Index
    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 IndexArgs
    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 IndexArgs
    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 IndexArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var indexResource = new Oci.Nosql.Index("indexResource", new()
    {
        Keys = new[]
        {
            new Oci.Nosql.Inputs.IndexKeyArgs
            {
                ColumnName = "string",
                JsonFieldType = "string",
                JsonPath = "string",
            },
        },
        TableNameOrId = "string",
        CompartmentId = "string",
        IsIfNotExists = false,
        Name = "string",
    });
    
    example, err := Nosql.NewIndex(ctx, "indexResource", &Nosql.IndexArgs{
    	Keys: nosql.IndexKeyArray{
    		&nosql.IndexKeyArgs{
    			ColumnName:    pulumi.String("string"),
    			JsonFieldType: pulumi.String("string"),
    			JsonPath:      pulumi.String("string"),
    		},
    	},
    	TableNameOrId: pulumi.String("string"),
    	CompartmentId: pulumi.String("string"),
    	IsIfNotExists: pulumi.Bool(false),
    	Name:          pulumi.String("string"),
    })
    
    var indexResource = new Index("indexResource", IndexArgs.builder()
        .keys(IndexKeyArgs.builder()
            .columnName("string")
            .jsonFieldType("string")
            .jsonPath("string")
            .build())
        .tableNameOrId("string")
        .compartmentId("string")
        .isIfNotExists(false)
        .name("string")
        .build());
    
    index_resource = oci.nosql.Index("indexResource",
        keys=[oci.nosql.IndexKeyArgs(
            column_name="string",
            json_field_type="string",
            json_path="string",
        )],
        table_name_or_id="string",
        compartment_id="string",
        is_if_not_exists=False,
        name="string")
    
    const indexResource = new oci.nosql.Index("indexResource", {
        keys: [{
            columnName: "string",
            jsonFieldType: "string",
            jsonPath: "string",
        }],
        tableNameOrId: "string",
        compartmentId: "string",
        isIfNotExists: false,
        name: "string",
    });
    
    type: oci:Nosql:Index
    properties:
        compartmentId: string
        isIfNotExists: false
        keys:
            - columnName: string
              jsonFieldType: string
              jsonPath: string
        name: string
        tableNameOrId: string
    

    Index 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 Index resource accepts the following input properties:

    Keys List<IndexKey>
    A set of keys for a secondary index.
    TableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    CompartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    IsIfNotExists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    Name string
    Index name.
    Keys []IndexKeyArgs
    A set of keys for a secondary index.
    TableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    CompartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    IsIfNotExists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    Name string
    Index name.
    keys List<IndexKey>
    A set of keys for a secondary index.
    tableNameOrId String

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists Boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    name String
    Index name.
    keys IndexKey[]
    A set of keys for a secondary index.
    tableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    name string
    Index name.
    keys Sequence[nosql.IndexKeyArgs]
    A set of keys for a secondary index.
    table_name_or_id str

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartment_id str
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    is_if_not_exists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    name str
    Index name.
    keys List<Property Map>
    A set of keys for a secondary index.
    tableNameOrId String

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists Boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    name String
    Index name.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    LifecycleDetails string
    A message describing the current state in more detail.
    State string
    The state of an index.
    TableId string
    the OCID of the table to which this index belongs.
    TableName string
    The name of the table to which this index belongs.
    Id string
    The provider-assigned unique ID for this managed resource.
    LifecycleDetails string
    A message describing the current state in more detail.
    State string
    The state of an index.
    TableId string
    the OCID of the table to which this index belongs.
    TableName string
    The name of the table to which this index belongs.
    id String
    The provider-assigned unique ID for this managed resource.
    lifecycleDetails String
    A message describing the current state in more detail.
    state String
    The state of an index.
    tableId String
    the OCID of the table to which this index belongs.
    tableName String
    The name of the table to which this index belongs.
    id string
    The provider-assigned unique ID for this managed resource.
    lifecycleDetails string
    A message describing the current state in more detail.
    state string
    The state of an index.
    tableId string
    the OCID of the table to which this index belongs.
    tableName string
    The name of the table to which this index belongs.
    id str
    The provider-assigned unique ID for this managed resource.
    lifecycle_details str
    A message describing the current state in more detail.
    state str
    The state of an index.
    table_id str
    the OCID of the table to which this index belongs.
    table_name str
    The name of the table to which this index belongs.
    id String
    The provider-assigned unique ID for this managed resource.
    lifecycleDetails String
    A message describing the current state in more detail.
    state String
    The state of an index.
    tableId String
    the OCID of the table to which this index belongs.
    tableName String
    The name of the table to which this index belongs.

    Look up Existing Index Resource

    Get an existing Index 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?: IndexState, opts?: CustomResourceOptions): Index
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compartment_id: Optional[str] = None,
            is_if_not_exists: Optional[bool] = None,
            keys: Optional[Sequence[_nosql.IndexKeyArgs]] = None,
            lifecycle_details: Optional[str] = None,
            name: Optional[str] = None,
            state: Optional[str] = None,
            table_id: Optional[str] = None,
            table_name: Optional[str] = None,
            table_name_or_id: Optional[str] = None) -> Index
    func GetIndex(ctx *Context, name string, id IDInput, state *IndexState, opts ...ResourceOption) (*Index, error)
    public static Index Get(string name, Input<string> id, IndexState? state, CustomResourceOptions? opts = null)
    public static Index get(String name, Output<String> id, IndexState 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:
    CompartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    IsIfNotExists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    Keys List<IndexKey>
    A set of keys for a secondary index.
    LifecycleDetails string
    A message describing the current state in more detail.
    Name string
    Index name.
    State string
    The state of an index.
    TableId string
    the OCID of the table to which this index belongs.
    TableName string
    The name of the table to which this index belongs.
    TableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    CompartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    IsIfNotExists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    Keys []IndexKeyArgs
    A set of keys for a secondary index.
    LifecycleDetails string
    A message describing the current state in more detail.
    Name string
    Index name.
    State string
    The state of an index.
    TableId string
    the OCID of the table to which this index belongs.
    TableName string
    The name of the table to which this index belongs.
    TableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists Boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    keys List<IndexKey>
    A set of keys for a secondary index.
    lifecycleDetails String
    A message describing the current state in more detail.
    name String
    Index name.
    state String
    The state of an index.
    tableId String
    the OCID of the table to which this index belongs.
    tableName String
    The name of the table to which this index belongs.
    tableNameOrId String

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId string
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    keys IndexKey[]
    A set of keys for a secondary index.
    lifecycleDetails string
    A message describing the current state in more detail.
    name string
    Index name.
    state string
    The state of an index.
    tableId string
    the OCID of the table to which this index belongs.
    tableName string
    The name of the table to which this index belongs.
    tableNameOrId string

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartment_id str
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    is_if_not_exists bool
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    keys Sequence[nosql.IndexKeyArgs]
    A set of keys for a secondary index.
    lifecycle_details str
    A message describing the current state in more detail.
    name str
    Index name.
    state str
    The state of an index.
    table_id str
    the OCID of the table to which this index belongs.
    table_name str
    The name of the table to which this index belongs.
    table_name_or_id str

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    The OCID of the table's compartment. Required if the tableNameOrId path parameter is a table name. Optional if tableNameOrId is an OCID. If tableNameOrId is an OCID, and compartmentId is supplied, the latter must match the identified table's compartmentId.
    isIfNotExists Boolean
    If true, the operation completes successfully even when the index exists. Otherwise, an attempt to create an index that already exists will return an error.
    keys List<Property Map>
    A set of keys for a secondary index.
    lifecycleDetails String
    A message describing the current state in more detail.
    name String
    Index name.
    state String
    The state of an index.
    tableId String
    the OCID of the table to which this index belongs.
    tableName String
    The name of the table to which this index belongs.
    tableNameOrId String

    A table name within the compartment, or a table OCID.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Supporting Types

    IndexKey, IndexKeyArgs

    ColumnName string
    The name of a column to be included as an index key.
    JsonFieldType string
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    JsonPath string
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.
    ColumnName string
    The name of a column to be included as an index key.
    JsonFieldType string
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    JsonPath string
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.
    columnName String
    The name of a column to be included as an index key.
    jsonFieldType String
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    jsonPath String
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.
    columnName string
    The name of a column to be included as an index key.
    jsonFieldType string
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    jsonPath string
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.
    column_name str
    The name of a column to be included as an index key.
    json_field_type str
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    json_path str
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.
    columnName String
    The name of a column to be included as an index key.
    jsonFieldType String
    If the specified column is of type JSON, jsonFieldType contains the type of the field indicated by jsonPath.
    jsonPath String
    If the specified column is of type JSON, jsonPath contains a dotted path indicating the field within the JSON object that will be the index key.

    Import

    Indexes can be imported using the id, e.g.

    $ pulumi import oci:Nosql/index:Index test_index "tables/{tableNameOrId}/indexes/{indexName}"
    

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

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.40.0 published on Wednesday, Jun 12, 2024 by Pulumi