"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.AiIndex = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * 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}}
 * ```
 */
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, id, state, opts) {
        return new AiIndex(name, state, { ...opts, id: id });
    }
    /**
     * 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) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === AiIndex.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["deployedIndexes"] = state?.deployedIndexes;
            resourceInputs["description"] = state?.description;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["encryptionSpec"] = state?.encryptionSpec;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["indexStats"] = state?.indexStats;
            resourceInputs["indexUpdateMethod"] = state?.indexUpdateMethod;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["metadata"] = state?.metadata;
            resourceInputs["metadataSchemaUri"] = state?.metadataSchemaUri;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["region"] = state?.region;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.displayName === undefined && !opts.urn) {
                throw new Error("Missing required property 'displayName'");
            }
            if (args?.metadata === undefined && !opts.urn) {
                throw new Error("Missing required property 'metadata'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["encryptionSpec"] = args?.encryptionSpec;
            resourceInputs["indexUpdateMethod"] = args?.indexUpdateMethod;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["metadata"] = args?.metadata;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["deployedIndexes"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["indexStats"] = undefined /*out*/;
            resourceInputs["metadataSchemaUri"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(AiIndex.__pulumiType, name, resourceInputs, opts);
    }
}
exports.AiIndex = AiIndex;
/** @internal */
AiIndex.__pulumiType = 'gcp:vertex/aiIndex:AiIndex';
//# sourceMappingURL=aiIndex.js.map