@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
283 lines • 12.7 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.AiIndexEndpointDeployedIndex = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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 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", {
* 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",
* });
* 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",
* labels: {
* "label-one": "value-one",
* },
* network: Promise.all([project, vertexNetwork]).then(([project, vertexNetwork]) => `projects/${project.number}/global/networks/${vertexNetwork.name}`),
* });
* const basicDeployedIndex = new gcp.vertex.AiIndexEndpointDeployedIndex("basic_deployed_index", {
* indexEndpoint: vertexIndexEndpointDeployed.id,
* index: index.id,
* deployedIndexId: "deployed_index_id",
* reservedIpRanges: ["vertex-ai-range"],
* enableAccessLogging: false,
* displayName: "vertex-deployed-index",
* deployedIndexAuthConfig: {
* authProvider: {
* audiences: ["123456-my-app"],
* allowedIssuers: [sa.email],
* },
* },
* }, {
* dependsOn: [
* vertexIndexEndpointDeployed,
* sa,
* ],
* });
* // 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", {
* 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",
* });
* 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",
* labels: {
* "label-one": "value-one",
* },
* network: Promise.all([project, vertexNetwork]).then(([project, vertexNetwork]) => `projects/${project.number}/global/networks/${vertexNetwork.name}`),
* });
* const basicDeployedIndex = new gcp.vertex.AiIndexEndpointDeployedIndex("basic_deployed_index", {
* indexEndpoint: vertexIndexEndpointDeployed.id,
* index: index.id,
* deployedIndexId: "deployed_index_id",
* reservedIpRanges: ["vertex-ai-range"],
* enableAccessLogging: false,
* displayName: "vertex-deployed-index",
* deployedIndexAuthConfig: {
* authProvider: {
* audiences: ["123456-my-app"],
* allowedIssuers: [sa.email],
* },
* },
* automaticResources: {
* maxReplicaCount: 4,
* },
* }, {
* dependsOn: [
* vertexIndexEndpointDeployed,
* sa,
* ],
* });
* // 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}}
* ```
*
* ```sh
* $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default {{project}}/{{region}}/{{index_endpoint}}/{{deployed_index_id}}
* ```
*
* ```sh
* $ pulumi import gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex default {{region}}/{{index_endpoint}}/{{deployed_index_id}}
* ```
*
* ```sh
* $ 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.automaticResources : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["dedicatedResources"] = state ? state.dedicatedResources : undefined;
resourceInputs["deployedIndexAuthConfig"] = state ? state.deployedIndexAuthConfig : undefined;
resourceInputs["deployedIndexId"] = state ? state.deployedIndexId : undefined;
resourceInputs["deploymentGroup"] = state ? state.deploymentGroup : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["enableAccessLogging"] = state ? state.enableAccessLogging : undefined;
resourceInputs["index"] = state ? state.index : undefined;
resourceInputs["indexEndpoint"] = state ? state.indexEndpoint : undefined;
resourceInputs["indexSyncTime"] = state ? state.indexSyncTime : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["privateEndpoints"] = state ? state.privateEndpoints : undefined;
resourceInputs["reservedIpRanges"] = state ? state.reservedIpRanges : undefined;
}
else {
const args = argsOrState;
if ((!args || args.deployedIndexId === undefined) && !opts.urn) {
throw new Error("Missing required property 'deployedIndexId'");
}
if ((!args || args.index === undefined) && !opts.urn) {
throw new Error("Missing required property 'index'");
}
if ((!args || args.indexEndpoint === undefined) && !opts.urn) {
throw new Error("Missing required property 'indexEndpoint'");
}
resourceInputs["automaticResources"] = args ? args.automaticResources : undefined;
resourceInputs["dedicatedResources"] = args ? args.dedicatedResources : undefined;
resourceInputs["deployedIndexAuthConfig"] = args ? args.deployedIndexAuthConfig : undefined;
resourceInputs["deployedIndexId"] = args ? args.deployedIndexId : undefined;
resourceInputs["deploymentGroup"] = args ? args.deploymentGroup : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["enableAccessLogging"] = args ? args.enableAccessLogging : undefined;
resourceInputs["index"] = args ? args.index : undefined;
resourceInputs["indexEndpoint"] = args ? args.indexEndpoint : undefined;
resourceInputs["reservedIpRanges"] = args ? args.reservedIpRanges : undefined;
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;
/** @internal */
AiIndexEndpointDeployedIndex.__pulumiType = 'gcp:vertex/aiIndexEndpointDeployedIndex:AiIndexEndpointDeployedIndex';
//# sourceMappingURL=aiIndexEndpointDeployedIndex.js.map