UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

369 lines (368 loc) • 14.5 kB
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 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, * approximateNeighborsCount: 150, * shardSize: "SHARD_SIZE_SMALL", * distanceMeasureType: "DOT_PRODUCT_DISTANCE", * algorithmConfig: { * treeAhConfig: { * leafNodeEmbeddingCount: 500, * leafNodesToSearchPercent: 7, * }, * }, * }, * }, * indexUpdateMethod: "BATCH_UPDATE", * }); * ``` * ### 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<pulumi.ID>, 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<string>; /** * 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<outputs.vertex.AiIndexDeployedIndex[]>; /** * The description of the Index. */ readonly description: pulumi.Output<string | undefined>; /** * 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<string>; /** * 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; }>; /** * Used to perform consistent read-modify-write updates. */ readonly etag: pulumi.Output<string>; /** * Stats of the index resource. * Structure is documented below. */ readonly indexStats: pulumi.Output<outputs.vertex.AiIndexIndexStat[]>; /** * 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<string | undefined>; /** * 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>; /** * An additional information about the Index * Structure is documented below. */ readonly metadata: pulumi.Output<outputs.vertex.AiIndexMetadata | undefined>; /** * 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<string>; /** * The resource name of the Index. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * 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<string | undefined>; /** * 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<string>; /** * 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<string>; /** * 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<pulumi.Input<inputs.vertex.AiIndexDeployedIndex>[]>; /** * The description of the Index. */ description?: pulumi.Input<string>; /** * 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<string>; /** * 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<string>; }>; /** * Used to perform consistent read-modify-write updates. */ etag?: pulumi.Input<string>; /** * Stats of the index resource. * Structure is documented below. */ indexStats?: pulumi.Input<pulumi.Input<inputs.vertex.AiIndexIndexStat>[]>; /** * 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<string>; /** * 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<string>; }>; /** * An additional information about the Index * Structure is documented below. */ metadata?: pulumi.Input<inputs.vertex.AiIndexMetadata>; /** * 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<string>; /** * The resource name of the Index. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The region of the index. eg us-central1 */ region?: pulumi.Input<string>; /** * 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<string>; } /** * The set of arguments for constructing a AiIndex resource. */ export interface AiIndexArgs { /** * The description of the Index. */ description?: pulumi.Input<string>; /** * 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<string>; /** * 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<string>; /** * 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<string>; }>; /** * An additional information about the Index * Structure is documented below. */ metadata?: pulumi.Input<inputs.vertex.AiIndexMetadata>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The region of the index. eg us-central1 */ region?: pulumi.Input<string>; }