@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
317 lines (316 loc) • 11.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* You can use the built-in test feature to uncover bugs and prevent regressions. A test execution verifies that agent responses have not changed for end-user inputs defined in the test case.
*
* To get more information about TestCase, see:
*
* * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.testCases)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
*
* ## Example Usage
*
* ### Dialogflowcx Test Case Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent",
* location: "global",
* defaultLanguageCode: "en",
* supportedLanguageCodes: [
* "fr",
* "de",
* "es",
* ],
* timeZone: "America/New_York",
* description: "Example description.",
* avatarUri: "https://storage.cloud.google.com/dialogflow-test-host-image/cloud-logo.png",
* enableStackdriverLogging: true,
* enableSpellCorrection: true,
* speechToTextSettings: {
* enableSpeechAdaptation: true,
* },
* });
* const intent = new gcp.diagflow.CxIntent("intent", {
* parent: agent.id,
* displayName: "MyIntent",
* priority: 1,
* trainingPhrases: [{
* parts: [{
* text: "training phrase",
* }],
* repeatCount: 1,
* }],
* });
* const page = new gcp.diagflow.CxPage("page", {
* parent: agent.startFlow,
* displayName: "MyPage",
* transitionRoutes: [{
* intent: intent.id,
* triggerFulfillment: {
* messages: [{
* text: {
* texts: ["Training phrase response"],
* },
* }],
* },
* }],
* eventHandlers: [{
* event: "some-event",
* triggerFulfillment: {
* messages: [{
* text: {
* texts: ["Handling some event"],
* },
* }],
* },
* }],
* });
* const basicTestCase = new gcp.diagflow.CxTestCase("basic_test_case", {
* parent: agent.id,
* displayName: "MyTestCase",
* tags: ["#tag1"],
* notes: "demonstrates a simple training phrase response",
* testConfig: {
* trackingParameters: ["some_param"],
* page: page.id,
* },
* testCaseConversationTurns: [
* {
* userInput: {
* input: {
* languageCode: "en",
* text: {
* text: "training phrase",
* },
* },
* injectedParameters: JSON.stringify({
* some_param: "1",
* }),
* isWebhookEnabled: true,
* enableSentimentAnalysis: true,
* },
* virtualAgentOutput: {
* sessionParameters: JSON.stringify({
* some_param: "1",
* }),
* triggeredIntent: {
* name: intent.id,
* },
* currentPage: {
* name: page.id,
* },
* textResponses: [{
* texts: ["Training phrase response"],
* }],
* },
* },
* {
* userInput: {
* input: {
* event: {
* event: "some-event",
* },
* },
* },
* virtualAgentOutput: {
* currentPage: {
* name: page.id,
* },
* textResponses: [{
* texts: ["Handling some event"],
* }],
* },
* },
* {
* userInput: {
* input: {
* dtmf: {
* digits: "12",
* finishDigit: "3",
* },
* },
* },
* virtualAgentOutput: {
* textResponses: [{
* texts: ["I didn't get that. Can you say it again?"],
* }],
* },
* },
* ],
* });
* ```
*
* ## Import
*
* TestCase can be imported using any of these accepted formats:
*
* * `{{parent}}/testCases/{{name}}`
*
* When using the `pulumi import` command, TestCase can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/cxTestCase:CxTestCase default {{parent}}/testCases/{{name}}
* ```
*/
export declare class CxTestCase extends pulumi.CustomResource {
/**
* Get an existing CxTestCase 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?: CxTestCaseState, opts?: pulumi.CustomResourceOptions): CxTestCase;
/**
* Returns true if the given object is an instance of CxTestCase. 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 CxTestCase;
/**
* When the test was created. A timestamp in RFC3339 text format.
*/
readonly creationTime: pulumi.Output<string>;
/**
* The human-readable name of the test case, unique within the agent. Limit of 200 characters.
*
*
* - - -
*/
readonly displayName: pulumi.Output<string>;
/**
* The latest test result.
* Structure is documented below.
*/
readonly lastTestResults: pulumi.Output<outputs.diagflow.CxTestCaseLastTestResult[]>;
/**
* The unique identifier of the page.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/pages/<Page ID>.
*/
readonly name: pulumi.Output<string>;
/**
* Additional freeform notes about the test case. Limit of 400 characters.
*/
readonly notes: pulumi.Output<string | undefined>;
/**
* The agent to create the test case for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
readonly parent: pulumi.Output<string | undefined>;
/**
* Tags are short descriptions that users may apply to test cases for organizational and filtering purposes.
* Each tag should start with "#" and has a limit of 30 characters
*/
readonly tags: pulumi.Output<string[] | undefined>;
/**
* The conversation turns uttered when the test case was created, in chronological order. These include the canonical set of agent utterances that should occur when the agent is working properly.
* Structure is documented below.
*/
readonly testCaseConversationTurns: pulumi.Output<outputs.diagflow.CxTestCaseTestCaseConversationTurn[] | undefined>;
/**
* Config for the test case.
* Structure is documented below.
*/
readonly testConfig: pulumi.Output<outputs.diagflow.CxTestCaseTestConfig | undefined>;
/**
* Create a CxTestCase 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: CxTestCaseArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering CxTestCase resources.
*/
export interface CxTestCaseState {
/**
* When the test was created. A timestamp in RFC3339 text format.
*/
creationTime?: pulumi.Input<string>;
/**
* The human-readable name of the test case, unique within the agent. Limit of 200 characters.
*
*
* - - -
*/
displayName?: pulumi.Input<string>;
/**
* The latest test result.
* Structure is documented below.
*/
lastTestResults?: pulumi.Input<pulumi.Input<inputs.diagflow.CxTestCaseLastTestResult>[]>;
/**
* The unique identifier of the page.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/pages/<Page ID>.
*/
name?: pulumi.Input<string>;
/**
* Additional freeform notes about the test case. Limit of 400 characters.
*/
notes?: pulumi.Input<string>;
/**
* The agent to create the test case for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
parent?: pulumi.Input<string>;
/**
* Tags are short descriptions that users may apply to test cases for organizational and filtering purposes.
* Each tag should start with "#" and has a limit of 30 characters
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The conversation turns uttered when the test case was created, in chronological order. These include the canonical set of agent utterances that should occur when the agent is working properly.
* Structure is documented below.
*/
testCaseConversationTurns?: pulumi.Input<pulumi.Input<inputs.diagflow.CxTestCaseTestCaseConversationTurn>[]>;
/**
* Config for the test case.
* Structure is documented below.
*/
testConfig?: pulumi.Input<inputs.diagflow.CxTestCaseTestConfig>;
}
/**
* The set of arguments for constructing a CxTestCase resource.
*/
export interface CxTestCaseArgs {
/**
* The human-readable name of the test case, unique within the agent. Limit of 200 characters.
*
*
* - - -
*/
displayName: pulumi.Input<string>;
/**
* Additional freeform notes about the test case. Limit of 400 characters.
*/
notes?: pulumi.Input<string>;
/**
* The agent to create the test case for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
*/
parent?: pulumi.Input<string>;
/**
* Tags are short descriptions that users may apply to test cases for organizational and filtering purposes.
* Each tag should start with "#" and has a limit of 30 characters
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The conversation turns uttered when the test case was created, in chronological order. These include the canonical set of agent utterances that should occur when the agent is working properly.
* Structure is documented below.
*/
testCaseConversationTurns?: pulumi.Input<pulumi.Input<inputs.diagflow.CxTestCaseTestCaseConversationTurn>[]>;
/**
* Config for the test case.
* Structure is documented below.
*/
testConfig?: pulumi.Input<inputs.diagflow.CxTestCaseTestConfig>;
}