@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
524 lines • 19.6 kB
JavaScript
"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.CxToolVersion = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Tool version is a snapshot of the tool at certain timestamp.
*
* To get more information about ToolVersion, see:
*
* * [API documentation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.tools.versions)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
*
* ## Example Usage
*
* ### Dialogflowcx Tool Version Open Api
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent-open-api",
* location: "global",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* description: "Example description.",
* });
* const tool = new gcp.diagflow.CxTool("tool", {
* parent: agent.id,
* displayName: "open-api-tool",
* description: "Example Description",
* openApiSpec: {
* authentication: {
* oauthConfig: {
* oauthGrantType: "CLIENT_CREDENTIAL",
* clientId: "example client ID",
* clientSecret: "example client secret",
* scopes: ["example scope"],
* secretVersionForClientSecret: "projects/-/secrets/-/versions/-",
* tokenEndpoint: "https://example.com/oauth/token",
* },
* },
* tlsConfig: {
* caCerts: [{
* displayName: "example ca cert name",
* cert: std.base64encode({
* input: "example cert",
* }).then(invoke => invoke.result),
* }],
* },
* serviceDirectoryConfig: {
* service: "projects/-/locations/-/namespaces/-/services/-",
* },
* textSchema: ` {
* \\"openapi\\": \\"3.0.0\\",
* \\"info\\": {
* \\"title\\": \\"Time API\\",
* \\"version\\": \\"1.0.0\\",
* \\"description\\": \\"A simple API to get the current time.\\"
* },
* \\"servers\\": [
* {
* \\"url\\": \\"https://example-api-endpoint.com\\"
* }
* ],
* \\"paths\\": {
* \\"/time\\": {
* \\"get\\": {
* \\"operationId\\": \\"getCurrentTime\\",
* \\"summary\\": \\"Gets the current server time.\\",
* \\"responses\\": {
* \\"200\\": {
* \\"description\\": \\"Successful response with the current time.\\",
* \\"content\\": {
* \\"application/json\\": {
* \\"schema\\": {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"currentTime\\": {
* \\"type\\": \\"string\\",
* \\"format\\": \\"date-time\\",
* \\"description\\": \\"The current time in ISO 8601 format.\\"
* }
* }
* }
* }
* }
* }
* }
* }
* }
* }
* }
* `,
* },
* });
* const openApiToolVersion = new gcp.diagflow.CxToolVersion("open_api_tool_version", {
* parent: tool.id,
* displayName: "Example Open API Tool Version",
* tool: {
* displayName: "open-api-tool",
* description: "Example Description",
* openApiSpec: {
* authentication: {
* oauthConfig: {
* oauthGrantType: "CLIENT_CREDENTIAL",
* clientId: "example client ID",
* clientSecret: "example client secret",
* scopes: ["example scope"],
* secretVersionForClientSecret: "projects/-/secrets/-/versions/-",
* tokenEndpoint: "https://example.com/oauth/token",
* },
* },
* tlsConfig: {
* caCerts: [{
* displayName: "example ca cert name",
* cert: std.base64encode({
* input: "example cert",
* }).then(invoke => invoke.result),
* }],
* },
* serviceDirectoryConfig: {
* service: "projects/-/locations/-/namespaces/-/services/-",
* },
* textSchema: ` {
* \\"openapi\\": \\"3.0.0\\",
* \\"info\\": {
* \\"title\\": \\"Time API\\",
* \\"version\\": \\"1.0.0\\",
* \\"description\\": \\"A simple API to get the current time.\\"
* },
* \\"servers\\": [
* {
* \\"url\\": \\"https://example-api-endpoint.com\\"
* }
* ],
* \\"paths\\": {
* \\"/time\\": {
* \\"get\\": {
* \\"operationId\\": \\"getCurrentTime\\",
* \\"summary\\": \\"Gets the current server time.\\",
* \\"responses\\": {
* \\"200\\": {
* \\"description\\": \\"Successful response with the current time.\\",
* \\"content\\": {
* \\"application/json\\": {
* \\"schema\\": {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"currentTime\\": {
* \\"type\\": \\"string\\",
* \\"format\\": \\"date-time\\",
* \\"description\\": \\"The current time in ISO 8601 format.\\"
* }
* }
* }
* }
* }
* }
* }
* }
* }
* }
* }
* `,
* },
* },
* });
* ```
* ### Dialogflowcx Tool Version Data Store
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myDatastore = new gcp.discoveryengine.DataStore("my_datastore", {
* location: "global",
* dataStoreId: "datastore-tool-version",
* displayName: "datastore for Tool test",
* industryVertical: "GENERIC",
* contentConfig: "NO_CONTENT",
* solutionTypes: ["SOLUTION_TYPE_CHAT"],
* });
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent-data-store",
* location: "global",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* description: "Example description.",
* deleteChatEngineOnDestroy: true,
* }, {
* dependsOn: [myDatastore],
* });
* const project = gcp.organizations.getProject({});
* const tool = new gcp.diagflow.CxTool("tool", {
* parent: agent.id,
* displayName: "datastore-tool",
* description: "Example Description",
* dataStoreSpec: {
* dataStoreConnections: [{
* dataStoreType: "UNSTRUCTURED",
* dataStore: pulumi.all([project, myDatastore.dataStoreId]).apply(([project, dataStoreId]) => `projects/${project.number}/locations/global/collections/default_collection/dataStores/${dataStoreId}`),
* documentProcessingMode: "DOCUMENTS",
* }],
* fallbackPrompt: {},
* },
* }, {
* dependsOn: [
* myDatastore,
* agent,
* ],
* });
* const dataStoreToolVersion = new gcp.diagflow.CxToolVersion("data_store_tool_version", {
* parent: tool.id,
* displayName: "Example Data Store Tool Version",
* tool: {
* displayName: "datastore-tool",
* description: "Example Description",
* dataStoreSpec: {
* dataStoreConnections: [{
* dataStoreType: "UNSTRUCTURED",
* dataStore: pulumi.all([project, myDatastore.dataStoreId]).apply(([project, dataStoreId]) => `projects/${project.number}/locations/global/collections/default_collection/dataStores/${dataStoreId}`),
* documentProcessingMode: "DOCUMENTS",
* }],
* fallbackPrompt: {},
* },
* },
* }, {
* dependsOn: [
* myDatastore,
* agent,
* ],
* });
* ```
* ### Dialogflowcx Tool Version Function
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent-fucntion",
* location: "global",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* description: "Example description.",
* });
* const tool = new gcp.diagflow.CxTool("tool", {
* parent: agent.id,
* displayName: "function-tool",
* description: "Example Description",
* functionSpec: {
* inputSchema: ` {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"message_to_echo\\": {
* \\"type\\": \\"string\\",
* \\"description\\": \\"The message that should be echoed back.\\"
* }
* },
* \\"required\\": [
* \\"message_to_echo\\"
* ]
* }
* `,
* outputSchema: ` {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"echoed_message\\": {
* \\"type\\": \\"string\\",
* \\"description\\": \\"The message that is echoed back.\\"
* }
* }
* }
* `,
* },
* });
* const functionToolVersion = new gcp.diagflow.CxToolVersion("function_tool_version", {
* parent: tool.id,
* displayName: "Example Function Tool Version",
* tool: {
* displayName: "function-tool",
* description: "Example Description",
* functionSpec: {
* inputSchema: ` {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"message_to_echo\\": {
* \\"type\\": \\"string\\",
* \\"description\\": \\"The message that should be echoed back.\\"
* }
* },
* \\"required\\": [
* \\"message_to_echo\\"
* ]
* }
* `,
* outputSchema: ` {
* \\"type\\": \\"object\\",
* \\"properties\\": {
* \\"echoed_message\\": {
* \\"type\\": \\"string\\",
* \\"description\\": \\"The message that is echoed back.\\"
* }
* }
* }
* `,
* },
* },
* });
* ```
* ### Dialogflowcx Tool Version Connector
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent-connector",
* location: "us-central1",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* description: "Example description.",
* deleteChatEngineOnDestroy: true,
* });
* const bqDataset = new gcp.bigquery.Dataset("bq_dataset", {
* datasetId: "example_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "us-central1",
* deleteContentsOnDestroy: true,
* });
* const testProject = gcp.organizations.getProject({});
* const integrationConnector = new gcp.integrationconnectors.Connection("integration_connector", {
* name: "example-connection",
* location: "us-central1",
* connectorVersion: pulumi.interpolate`projects/${agent.project}/locations/global/providers/gcp/connectors/bigquery/versions/1`,
* description: "tf created description",
* configVariables: [
* {
* key: "dataset_id",
* stringValue: bqDataset.datasetId,
* },
* {
* key: "project_id",
* stringValue: agent.project,
* },
* {
* key: "support_native_data_type",
* booleanValue: false,
* },
* {
* key: "proxy_enabled",
* booleanValue: false,
* },
* ],
* serviceAccount: testProject.then(testProject => `${testProject.number}-compute@developer.gserviceaccount.com`),
* authConfig: {
* authType: "AUTH_TYPE_UNSPECIFIED",
* },
* });
* const bqTable = new gcp.bigquery.Table("bq_table", {
* deletionProtection: false,
* datasetId: bqDataset.datasetId,
* tableId: "example_table",
* });
* const connectorSaDatasetPerms = new gcp.bigquery.DatasetIamMember("connector_sa_dataset_perms", {
* project: testProject.then(testProject => testProject.projectId),
* datasetId: bqDataset.datasetId,
* role: "roles/bigquery.dataEditor",
* member: testProject.then(testProject => `serviceAccount:${testProject.number}-compute@developer.gserviceaccount.com`),
* });
* const tool = new gcp.diagflow.CxTool("tool", {
* parent: agent.id,
* displayName: "connector-tool",
* description: "Example Description",
* connectorSpec: {
* name: pulumi.interpolate`projects/${agent.project}/locations/us-central1/connections/${integrationConnector.name}`,
* actions: [
* {
* connectionActionId: "ExecuteCustomQuery",
* inputFields: ["test1"],
* outputFields: ["test1"],
* },
* {
* entityOperation: {
* entityId: bqTable.tableId,
* operation: "LIST",
* },
* },
* ],
* },
* });
* const connectorToolVersion = new gcp.diagflow.CxToolVersion("connector_tool_version", {
* parent: tool.id,
* displayName: "Example Connector Tool Version",
* tool: {
* displayName: "connector-tool",
* description: "Example Description",
* connectorSpec: {
* name: pulumi.interpolate`projects/${agent.project}/locations/us-central1/connections/${integrationConnector.name}`,
* actions: [
* {
* connectionActionId: "ExecuteCustomQuery",
* inputFields: ["test1"],
* outputFields: ["test1"],
* },
* {
* entityOperation: {
* entityId: bqTable.tableId,
* operation: "LIST",
* },
* },
* ],
* },
* },
* });
* ```
*
* ## Import
*
* ToolVersion can be imported using any of these accepted formats:
*
* * `{{parent}}/versions/{{name}}`
* * `{{parent}}/{{name}}`
*
* When using the `pulumi import` command, ToolVersion can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/cxToolVersion:CxToolVersion default {{parent}}/versions/{{name}}
* $ pulumi import gcp:diagflow/cxToolVersion:CxToolVersion default {{parent}}/{{name}}
* ```
*/
class CxToolVersion extends pulumi.CustomResource {
/**
* Get an existing CxToolVersion 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 CxToolVersion(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:diagflow/cxToolVersion:CxToolVersion';
/**
* Returns true if the given object is an instance of CxToolVersion. 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'] === CxToolVersion.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["name"] = state?.name;
resourceInputs["parent"] = state?.parent;
resourceInputs["tool"] = state?.tool;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.parent === undefined && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
if (args?.tool === undefined && !opts.urn) {
throw new Error("Missing required property 'tool'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["parent"] = args?.parent;
resourceInputs["tool"] = args?.tool;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CxToolVersion.__pulumiType, name, resourceInputs, opts);
}
}
exports.CxToolVersion = CxToolVersion;
//# sourceMappingURL=cxToolVersion.js.map