UNPKG

@pulumi/gcp

Version:

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

229 lines • 9.07 kB
"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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Collection = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Description * * ## Example Usage * * ### Vectorsearch Collection Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example_collection = new gcp.vectorsearch.Collection("example-collection", { * location: "us-central1", * collectionId: "example-collection", * displayName: "My Awesome Collection", * description: "This collection stores important data.", * labels: { * env: "dev", * team: "my-team", * }, * dataSchema: `{ * \\"type\\": \\"object\\", * \\"properties\\": { * \\"title\\": { * \\"type\\": \\"string\\" * }, * \\"plot\\": { * \\"type\\": \\"string\\" * } * } * } * `, * vectorSchemas: [{ * fieldName: "text_embedding", * denseVector: { * dimensions: 768, * vertexEmbeddingConfig: { * modelId: "textembedding-gecko@003", * taskType: "RETRIEVAL_DOCUMENT", * textTemplate: "Title: {title} ---- Plot: {plot}", * }, * }, * }], * }); * ``` * ### Vectorsearch Collection Cmek * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const keyRing = new gcp.kms.KeyRing("key_ring", { * name: "example-cmek-collection", * location: "us-central1", * }); * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", { * name: "example-cmek-collection", * keyRing: keyRing.id, * }); * const project = gcp.organizations.getProject({}); * const cryptoKeyMemberVsSa = new gcp.kms.CryptoKeyIAMMember("crypto_key_member_vs_sa", { * cryptoKeyId: cryptoKey.id, * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-vectorsearch.iam.gserviceaccount.com`), * }); * const example_cmek_collection = new gcp.vectorsearch.Collection("example-cmek-collection", { * location: "us-central1", * collectionId: "example-cmek-collection", * displayName: "My Awesome Encrypted Collection", * description: "This collection stores important data.", * encryptionSpec: { * cryptoKeyName: cryptoKey.id, * }, * labels: { * env: "dev", * team: "my-team", * }, * dataSchema: `{ * \\"type\\": \\"object\\", * \\"properties\\": { * \\"title\\": { * \\"type\\": \\"string\\" * }, * \\"plot\\": { * \\"type\\": \\"string\\" * } * } * } * `, * vectorSchemas: [{ * fieldName: "text_embedding", * denseVector: { * dimensions: 768, * vertexEmbeddingConfig: { * modelId: "textembedding-gecko@003", * taskType: "RETRIEVAL_DOCUMENT", * textTemplate: "Title: {title} ---- Plot: {plot}", * }, * }, * }], * }, { * dependsOn: [cryptoKeyMemberVsSa], * }); * ``` * * ## Import * * Collection can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/collections/{{collection_id}}` * * `{{project}}/{{location}}/{{collection_id}}` * * `{{location}}/{{collection_id}}` * * When using the `pulumi import` command, Collection can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:vectorsearch/collection:Collection default projects/{{project}}/locations/{{location}}/collections/{{collection_id}} * $ pulumi import gcp:vectorsearch/collection:Collection default {{project}}/{{location}}/{{collection_id}} * $ pulumi import gcp:vectorsearch/collection:Collection default {{location}}/{{collection_id}} * ``` */ class Collection extends pulumi.CustomResource { /** * Get an existing Collection 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 Collection(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:vectorsearch/collection:Collection'; /** * Returns true if the given object is an instance of Collection. 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'] === Collection.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["collectionId"] = state?.collectionId; resourceInputs["createTime"] = state?.createTime; resourceInputs["dataSchema"] = state?.dataSchema; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["displayName"] = state?.displayName; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["encryptionSpec"] = state?.encryptionSpec; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["vectorSchemas"] = state?.vectorSchemas; } else { const args = argsOrState; if (args?.collectionId === undefined && !opts.urn) { throw new Error("Missing required property 'collectionId'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["collectionId"] = args?.collectionId; resourceInputs["dataSchema"] = args?.dataSchema; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["displayName"] = args?.displayName; resourceInputs["encryptionSpec"] = args?.encryptionSpec; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["project"] = args?.project; resourceInputs["vectorSchemas"] = args?.vectorSchemas; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = 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(Collection.__pulumiType, name, resourceInputs, opts); } } exports.Collection = Collection; //# sourceMappingURL=collection.js.map