@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
480 lines • 19 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A tool provides a list of actions which are available to the Playbook to attain its goal.
* A Tool consists of a description of the tool's usage and a specification of the tool which contains the schema and authentication information.
*
* To get more information about Tool, see:
*
* * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.tools)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
*
* ## Example Usage
*
* ### Dialogflowcx Tool 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 openApiTool = new gcp.diagflow.CxTool("open_api_tool", {
* parent: agent.id,
* displayName: "Example 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 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",
* 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 dataStoreTool = new gcp.diagflow.CxTool("data_store_tool", {
* parent: agent.id,
* displayName: "Example Data Store 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 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 functionTool = new gcp.diagflow.CxTool("function_tool", {
* parent: agent.id,
* displayName: "Example 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 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: "terraformdatasetdfcxtool",
* 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: "terraform-df-cx-tool-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: "terraformdatasetdfcxtooltable",
* });
* 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 connectorTool = new gcp.diagflow.CxTool("connector_tool", {
* parent: agent.id,
* displayName: "Example 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
*
* Tool can be imported using any of these accepted formats:
*
* * `{{parent}}/tools/{{name}}`
* * `{{parent}}/{{name}}`
*
* When using the `pulumi import` command, Tool can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/cxTool:CxTool default {{parent}}/tools/{{name}}
* $ pulumi import gcp:diagflow/cxTool:CxTool default {{parent}}/{{name}}
* ```
*/
export declare class CxTool extends pulumi.CustomResource {
/**
* Get an existing CxTool 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: string, id: pulumi.Input<pulumi.ID>, state?: CxToolState, opts?: pulumi.CustomResourceOptions): CxTool;
/**
* Returns true if the given object is an instance of CxTool. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is CxTool;
/**
* (Optional, Beta)
* Integration connectors tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, `functionSpec`, or `connectorSpec` may be set.
* Structure is documented below.
*/
readonly connectorSpec: pulumi.Output<outputs.diagflow.CxToolConnectorSpec | undefined>;
/**
* Data store search tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
readonly dataStoreSpec: pulumi.Output<outputs.diagflow.CxToolDataStoreSpec | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* High level description of the Tool and its usage.
*/
readonly description: pulumi.Output<string>;
/**
* The human-readable name of the tool, unique within the agent.
*/
readonly displayName: pulumi.Output<string>;
/**
* Client side executed function specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
readonly functionSpec: pulumi.Output<outputs.diagflow.CxToolFunctionSpec | undefined>;
/**
* The unique identifier of the Tool.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/tools/<Tool ID>.
*/
readonly name: pulumi.Output<string>;
/**
* OpenAPI specification of the Tool.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
readonly openApiSpec: pulumi.Output<outputs.diagflow.CxToolOpenApiSpec | undefined>;
/**
* The agent to create a Tool for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
readonly parent: pulumi.Output<string | undefined>;
/**
* The tool type.
*/
readonly toolType: pulumi.Output<string>;
/**
* Create a CxTool resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: CxToolArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering CxTool resources.
*/
export interface CxToolState {
/**
* (Optional, Beta)
* Integration connectors tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, `functionSpec`, or `connectorSpec` may be set.
* Structure is documented below.
*/
connectorSpec?: pulumi.Input<inputs.diagflow.CxToolConnectorSpec | undefined>;
/**
* Data store search tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
dataStoreSpec?: pulumi.Input<inputs.diagflow.CxToolDataStoreSpec | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* High level description of the Tool and its usage.
*/
description?: pulumi.Input<string | undefined>;
/**
* The human-readable name of the tool, unique within the agent.
*/
displayName?: pulumi.Input<string | undefined>;
/**
* Client side executed function specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
functionSpec?: pulumi.Input<inputs.diagflow.CxToolFunctionSpec | undefined>;
/**
* The unique identifier of the Tool.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/tools/<Tool ID>.
*/
name?: pulumi.Input<string | undefined>;
/**
* OpenAPI specification of the Tool.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
openApiSpec?: pulumi.Input<inputs.diagflow.CxToolOpenApiSpec | undefined>;
/**
* The agent to create a Tool for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
parent?: pulumi.Input<string | undefined>;
/**
* The tool type.
*/
toolType?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a CxTool resource.
*/
export interface CxToolArgs {
/**
* (Optional, Beta)
* Integration connectors tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, `functionSpec`, or `connectorSpec` may be set.
* Structure is documented below.
*/
connectorSpec?: pulumi.Input<inputs.diagflow.CxToolConnectorSpec | undefined>;
/**
* Data store search tool specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
dataStoreSpec?: pulumi.Input<inputs.diagflow.CxToolDataStoreSpec | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* High level description of the Tool and its usage.
*/
description: pulumi.Input<string>;
/**
* The human-readable name of the tool, unique within the agent.
*/
displayName: pulumi.Input<string>;
/**
* Client side executed function specification.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
functionSpec?: pulumi.Input<inputs.diagflow.CxToolFunctionSpec | undefined>;
/**
* OpenAPI specification of the Tool.
* This field is part of a union field `specification`: Only one of `openApiSpec`, `dataStoreSpec`, or `functionSpec` may be set.
* Structure is documented below.
*/
openApiSpec?: pulumi.Input<inputs.diagflow.CxToolOpenApiSpec | undefined>;
/**
* The agent to create a Tool for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
parent?: pulumi.Input<string | undefined>;
}
//# sourceMappingURL=cxTool.d.ts.map