import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A representation of a collection of database items organized in a way that allows for approximate nearest neighbor (a.k.a ANN) algorithms search. * * To get more information about Index, see: * * * [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.indexes/) * * ## Example Usage * * ### Vertex Ai Index * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const vertexaiSa = new gcp.projects.ServiceIdentity("vertexai_sa", {service: "aiplatform.googleapis.com"}); * const bucket = new gcp.storage.Bucket("bucket", { * name: "vertex-ai-index-test", * location: "us-central1", * uniformBucketLevelAccess: true, * }); * // The sample data comes from the following link: * // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens * const data = new gcp.storage.BucketObject("data", { * name: "contents/data.json", * bucket: bucket.name, * content: `{\\"id\\": \\"42\\", \\"embedding\\": [0.5, 1.0], \\"restricts\\": [{\\"namespace\\": \\"class\\", \\"allow\\": [\\"cat\\", \\"pet\\"]},{\\"namespace\\": \\"category\\", \\"allow\\": [\\"feline\\"]}]} * {\\"id\\": \\"43\\", \\"embedding\\": [0.6, 1.0], \\"restricts\\": [{\\"namespace\\": \\"class\\", \\"allow\\": [\\"dog\\", \\"pet\\"]},{\\"namespace\\": \\"category\\", \\"allow\\": [\\"canine\\"]}]} * `, * }); * const vertexaiEncrypterdecrypter = new gcp.kms.CryptoKeyIAMMember("vertexai_encrypterdecrypter", { * cryptoKeyId: "kms-name", * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * member: vertexaiSa.member, * }); * const index = new gcp.vertex.AiIndex("index", { * labels: { * foo: "bar", * }, * region: "us-central1", * displayName: "test-index", * description: "index for test", * metadata: { * contentsDeltaUri: pulumi.interpolate`gs://${bucket.name}/contents`, * config: { * dimensions: 2, * approximateNeighborsCount: 150, * shardSize: "SHARD_SIZE_SMALL", * distanceMeasureType: "DOT_PRODUCT_DISTANCE", * algorithmConfig: { * treeAhConfig: { * leafNodeEmbeddingCount: 500, * leafNodesToSearchPercent: 7, * }, * }, * }, * }, * encryptionSpec: { * kmsKeyName: "kms-name", * }, * indexUpdateMethod: "BATCH_UPDATE", * }, { * dependsOn: [vertexaiEncrypterdecrypter], * }); * ``` * ### Vertex Ai Index Streaming * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const bucket = new gcp.storage.Bucket("bucket", { * name: "vertex-ai-index-test", * location: "us-central1", * uniformBucketLevelAccess: true, * }); * // The sample data comes from the following link: * // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens * const data = new gcp.storage.BucketObject("data", { * name: "contents/data.json", * bucket: bucket.name, * content: `{\\"id\\": \\"42\\", \\"embedding\\": [0.5, 1.0], \\"restricts\\": [{\\"namespace\\": \\"class\\", \\"allow\\": [\\"cat\\", \\"pet\\"]},{\\"namespace\\": \\"category\\", \\"allow\\": [\\"feline\\"]}]} * {\\"id\\": \\"43\\", \\"embedding\\": [0.6, 1.0], \\"restricts\\": [{\\"namespace\\": \\"class\\", \\"allow\\": [\\"dog\\", \\"pet\\"]},{\\"namespace\\": \\"category\\", \\"allow\\": [\\"canine\\"]}]} * `, * }); * const index = new gcp.vertex.AiIndex("index", { * labels: { * foo: "bar", * }, * region: "us-central1", * displayName: "test-index", * description: "index for test", * metadata: { * contentsDeltaUri: pulumi.interpolate`gs://${bucket.name}/contents`, * config: { * dimensions: 2, * shardSize: "SHARD_SIZE_LARGE", * distanceMeasureType: "COSINE_DISTANCE", * featureNormType: "UNIT_L2_NORM", * algorithmConfig: { * bruteForceConfig: {}, * }, * }, * }, * indexUpdateMethod: "STREAM_UPDATE", * }); * ``` * * ## Import * * Index can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/indexes/{{name}}` * * * `{{project}}/{{region}}/{{name}}` * * * `{{region}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Index can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:vertex/aiIndex:AiIndex default projects/{{project}}/locations/{{region}}/indexes/{{name}} * ``` * * ```sh * $ pulumi import gcp:vertex/aiIndex:AiIndex default {{project}}/{{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:vertex/aiIndex:AiIndex default {{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:vertex/aiIndex:AiIndex default {{name}} * ``` */ export declare class AiIndex extends pulumi.CustomResource { /** * Get an existing AiIndex 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?: AiIndexState, opts?: pulumi.CustomResourceOptions): AiIndex; /** * Returns true if the given object is an instance of AiIndex. 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 AiIndex; /** * The timestamp of when the Index was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ readonly createTime: pulumi.Output; /** * The pointers to DeployedIndexes created from this Index. An Index can be only deleted if all its DeployedIndexes had been undeployed first. * Structure is documented below. */ readonly deployedIndexes: pulumi.Output; /** * The description of the Index. */ readonly description: pulumi.Output; /** * The display name of the Index. The name can be up to 128 characters long and can consist of any UTF-8 characters. */ readonly displayName: pulumi.Output; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Customer-managed encryption key spec for an Index. If set, this Index and all sub-resources of this Index will be secured by this key. * Structure is documented below. */ readonly encryptionSpec: pulumi.Output; /** * Used to perform consistent read-modify-write updates. */ readonly etag: pulumi.Output; /** * Stats of the index resource. * Structure is documented below. */ readonly indexStats: pulumi.Output; /** * The update method to use with this Index. The value must be the followings. If not set, BATCH_UPDATE will be used by default. * * BATCH_UPDATE: user can call indexes.patch with files on Cloud Storage of datapoints to update. * * STREAM_UPDATE: user can call indexes.upsertDatapoints/DeleteDatapoints to update the Index and the updates will be applied in corresponding DeployedIndexes in nearly real-time. */ readonly indexUpdateMethod: pulumi.Output; /** * The labels with user-defined metadata to organize your Indexes. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Additional information about the Index. * Although this field is not marked as required in the API specification, it is currently required when creating an Index and must be provided. * Attempts to create an Index without this field will result in an API error. * Structure is documented below. */ readonly metadata: pulumi.Output; /** * Points to a YAML file stored on Google Cloud Storage describing additional information about the Index, that is specific to it. Unset if the Index does not have any additional information. */ readonly metadataSchemaUri: pulumi.Output; /** * The resource name of the Index. */ 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 combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The region of the index. eg us-central1 */ readonly region: pulumi.Output; /** * The timestamp of when the Index was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ readonly updateTime: pulumi.Output; /** * Create a AiIndex 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: AiIndexArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering AiIndex resources. */ export interface AiIndexState { /** * The timestamp of when the Index was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ createTime?: pulumi.Input; /** * The pointers to DeployedIndexes created from this Index. An Index can be only deleted if all its DeployedIndexes had been undeployed first. * Structure is documented below. */ deployedIndexes?: pulumi.Input[]>; /** * The description of the Index. */ description?: pulumi.Input; /** * The display name of the Index. The name can be up to 128 characters long and can consist of any UTF-8 characters. */ displayName?: pulumi.Input; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Customer-managed encryption key spec for an Index. If set, this Index and all sub-resources of this Index will be secured by this key. * Structure is documented below. */ encryptionSpec?: pulumi.Input; /** * Used to perform consistent read-modify-write updates. */ etag?: pulumi.Input; /** * Stats of the index resource. * Structure is documented below. */ indexStats?: pulumi.Input[]>; /** * The update method to use with this Index. The value must be the followings. If not set, BATCH_UPDATE will be used by default. * * BATCH_UPDATE: user can call indexes.patch with files on Cloud Storage of datapoints to update. * * STREAM_UPDATE: user can call indexes.upsertDatapoints/DeleteDatapoints to update the Index and the updates will be applied in corresponding DeployedIndexes in nearly real-time. */ indexUpdateMethod?: pulumi.Input; /** * The labels with user-defined metadata to organize your Indexes. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Additional information about the Index. * Although this field is not marked as required in the API specification, it is currently required when creating an Index and must be provided. * Attempts to create an Index without this field will result in an API error. * Structure is documented below. */ metadata?: pulumi.Input; /** * Points to a YAML file stored on Google Cloud Storage describing additional information about the Index, that is specific to it. Unset if the Index does not have any additional information. */ metadataSchemaUri?: pulumi.Input; /** * The resource name of the Index. */ 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 combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The region of the index. eg us-central1 */ region?: pulumi.Input; /** * The timestamp of when the Index was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ updateTime?: pulumi.Input; } /** * The set of arguments for constructing a AiIndex resource. */ export interface AiIndexArgs { /** * The description of the Index. */ description?: pulumi.Input; /** * The display name of the Index. The name can be up to 128 characters long and can consist of any UTF-8 characters. */ displayName: pulumi.Input; /** * Customer-managed encryption key spec for an Index. If set, this Index and all sub-resources of this Index will be secured by this key. * Structure is documented below. */ encryptionSpec?: pulumi.Input; /** * The update method to use with this Index. The value must be the followings. If not set, BATCH_UPDATE will be used by default. * * BATCH_UPDATE: user can call indexes.patch with files on Cloud Storage of datapoints to update. * * STREAM_UPDATE: user can call indexes.upsertDatapoints/DeleteDatapoints to update the Index and the updates will be applied in corresponding DeployedIndexes in nearly real-time. */ indexUpdateMethod?: pulumi.Input; /** * The labels with user-defined metadata to organize your Indexes. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Additional information about the Index. * Although this field is not marked as required in the API specification, it is currently required when creating an Index and must be provided. * Attempts to create an Index without this field will result in an API error. * Structure is documented below. */ metadata: 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 region of the index. eg us-central1 */ region?: pulumi.Input; }