UNPKG

@pulumi/gcp

Version:

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

290 lines • 13.5 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.AiIndexEndpointDeployedIndex = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * An endpoint indexes are deployed into. An index endpoint can have multiple deployed indexes. * * To get more information about IndexEndpointDeployedIndex, see: * * * [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.indexEndpoints#DeployedIndex) * * ## Example Usage * * ### Vertex Ai Index Endpoint Deployed Index Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const bucket = new gcp.storage.Bucket("bucket", { * name: "bucket-name", * location: "us-central1", * uniformBucketLevelAccess: true, * }); * const index = new gcp.vertex.AiIndex("index", { * region: "us-central1", * displayName: "test-index", * description: "index for test", * indexUpdateMethod: "BATCH_UPDATE", * labels: { * foo: "bar", * }, * 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, * }, * }, * }, * }, * }); * const vertexNetwork = gcp.compute.getNetwork({ * name: "network-name", * }); * const project = gcp.organizations.getProject({}); * const vertexIndexEndpointDeployed = new gcp.vertex.AiIndexEndpoint("vertex_index_endpoint_deployed", { * displayName: "sample-endpoint", * description: "A sample vertex endpoint", * region: "us-central1", * network: Promise.all([project, vertexNetwork]).then(([project, vertexNetwork]) => `projects/${project.number}/global/networks/${vertexNetwork.name}`), * labels: { * "label-one": "value-one", * }, * }); * const sa = new gcp.serviceaccount.Account("sa", {accountId: "vertex-sa"}); * const basicDeployedIndex = new gcp.vertex.AiIndexEndpointDeployedIndex("basic_deployed_index", { * deployedIndexId: "deployed_index_id", * displayName: "vertex-deployed-index", * region: "us-central1", * index: index.id, * indexEndpoint: vertexIndexEndpointDeployed.id, * enableAccessLogging: false, * reservedIpRanges: ["vertex-ai-range"], * deployedIndexAuthConfig: { * authProvider: { * audiences: ["123456-my-app"], * allowedIssuers: [sa.email], * }, * }, * }); * // 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\\"]}]} * `, * }); * ``` * ### Vertex Ai Index Endpoint Deployed Index Basic Two * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const sa = new gcp.serviceaccount.Account("sa", {accountId: "vertex-sa"}); * const bucket = new gcp.storage.Bucket("bucket", { * name: "bucket-name", * location: "us-central1", * uniformBucketLevelAccess: true, * }); * const index = new gcp.vertex.AiIndex("index", { * region: "us-central1", * displayName: "test-index", * description: "index for test", * indexUpdateMethod: "BATCH_UPDATE", * labels: { * foo: "bar", * }, * 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, * }, * }, * }, * }, * }); * const vertexNetwork = gcp.compute.getNetwork({ * name: "network-name", * }); * const project = gcp.organizations.getProject({}); * const vertexIndexEndpointDeployed = new gcp.vertex.AiIndexEndpoint("vertex_index_endpoint_deployed", { * displayName: "sample-endpoint", * description: "A sample vertex endpoint", * region: "us-central1", * network: Promise.all([project, vertexNetwork]).then(([project, vertexNetwork]) => `projects/${project.number}/global/networks/${vertexNetwork.name}`), * labels: { * "label-one": "value-one", * }, * }); * const basicDeployedIndex = new gcp.vertex.AiIndexEndpointDeployedIndex("basic_deployed_index", { * deployedIndexId: "deployed_index_id", * displayName: "vertex-deployed-index", * region: "us-central1", * index: index.id, * indexEndpoint: vertexIndexEndpointDeployed.id, * reservedIpRanges: ["vertex-ai-range"], * enableAccessLogging: false, * deployedIndexAuthConfig: { * authProvider: { * audiences: ["123456-my-app"], * allowedIssuers: [sa.email], * }, * }, * automaticResources: { * maxReplicaCount: 4, * }, * }); * // 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\\"]}]} * `, * }); * ``` * * ## Import * * IndexEndpointDeployedIndex can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/indexEndpoints/{{index_endpoint}}/deployedIndex/{{deployed_index_id}}` * * `{{project}}/{{region}}/{{index_endpoint}}/{{deployed_index_id}}` * * `{{region}}/{{index_endpoint}}/{{deployed_index_id}}` * * `{{index_endpoint}}/{{deployed_index_id}}` * * When using the `pulumi import` command, IndexEndpointDeployedIndex can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default projects/{{project}}/locations/{{region}}/indexEndpoints/{{index_endpoint}}/deployedIndex/{{deployed_index_id}} * $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default {{project}}/{{region}}/{{index_endpoint}}/{{deployed_index_id}} * $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default {{region}}/{{index_endpoint}}/{{deployed_index_id}} * $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default {{index_endpoint}}/{{deployed_index_id}} * ``` */ class AiIndexEndpointDeployedIndex extends pulumi.CustomResource { /** * Get an existing AiIndexEndpointDeployedIndex 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 AiIndexEndpointDeployedIndex(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex'; /** * Returns true if the given object is an instance of AiIndexEndpointDeployedIndex. 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'] === AiIndexEndpointDeployedIndex.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["automaticResources"] = state?.automaticResources; resourceInputs["createTime"] = state?.createTime; resourceInputs["dedicatedResources"] = state?.dedicatedResources; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["deployedIndexAuthConfig"] = state?.deployedIndexAuthConfig; resourceInputs["deployedIndexId"] = state?.deployedIndexId; resourceInputs["deploymentGroup"] = state?.deploymentGroup; resourceInputs["displayName"] = state?.displayName; resourceInputs["enableAccessLogging"] = state?.enableAccessLogging; resourceInputs["index"] = state?.index; resourceInputs["indexEndpoint"] = state?.indexEndpoint; resourceInputs["indexSyncTime"] = state?.indexSyncTime; resourceInputs["name"] = state?.name; resourceInputs["privateEndpoints"] = state?.privateEndpoints; resourceInputs["region"] = state?.region; resourceInputs["reservedIpRanges"] = state?.reservedIpRanges; } else { const args = argsOrState; if (args?.deployedIndexId === undefined && !opts.urn) { throw new Error("Missing required property 'deployedIndexId'"); } if (args?.index === undefined && !opts.urn) { throw new Error("Missing required property 'index'"); } if (args?.indexEndpoint === undefined && !opts.urn) { throw new Error("Missing required property 'indexEndpoint'"); } resourceInputs["automaticResources"] = args?.automaticResources; resourceInputs["dedicatedResources"] = args?.dedicatedResources; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["deployedIndexAuthConfig"] = args?.deployedIndexAuthConfig; resourceInputs["deployedIndexId"] = args?.deployedIndexId; resourceInputs["deploymentGroup"] = args?.deploymentGroup; resourceInputs["displayName"] = args?.displayName; resourceInputs["enableAccessLogging"] = args?.enableAccessLogging; resourceInputs["index"] = args?.index; resourceInputs["indexEndpoint"] = args?.indexEndpoint; resourceInputs["region"] = args?.region; resourceInputs["reservedIpRanges"] = args?.reservedIpRanges; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["indexSyncTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["privateEndpoints"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AiIndexEndpointDeployedIndex.__pulumiType, name, resourceInputs, opts); } } exports.AiIndexEndpointDeployedIndex = AiIndexEndpointDeployedIndex; //# sourceMappingURL=aiIndexEndpointDeployedIndex.js.map