@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
849 lines (848 loc) • 38.6 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A Dialogflow CX conversation (session) can be described and visualized as a state machine. The states of a CX session are represented by pages.
*
* To get more information about Page, see:
*
* * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.flows.pages)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
*
* ## Example Usage
*
* ### Dialogflowcx Page 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://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
* enableStackdriverLogging: true,
* enableSpellCorrection: true,
* speechToTextSettings: {
* enableSpeechAdaptation: true,
* },
* });
* const myPage2 = new gcp.diagflow.CxPage("my_page2", {
* parent: agent.startFlow,
* displayName: "MyPage2",
* });
* const myWebhook = new gcp.diagflow.CxWebhook("my_webhook", {
* parent: agent.id,
* displayName: "MyWebhook",
* genericWebService: {
* uri: "https://example.com",
* },
* });
* const basicPage = new gcp.diagflow.CxPage("basic_page", {
* parent: agent.startFlow,
* displayName: "MyPage",
* entryFulfillment: {
* messages: [
* {
* channel: "some-channel",
* text: {
* texts: ["Welcome to page"],
* },
* },
* {
* payload: " {\"some-key\": \"some-value\", \"other-key\": [\"other-value\"]}\n",
* },
* {
* conversationSuccess: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* outputAudioText: {
* text: "some output text",
* },
* },
* {
* outputAudioText: {
* ssml: " <speak>Some example <say-as interpret-as=\"characters\">SSML XML</say-as></speak>\n",
* },
* },
* {
* liveAgentHandoff: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* playAudio: {
* audioUri: "http://example.com/some-audio-file.mp3",
* },
* },
* {
* telephonyTransferCall: {
* phoneNumber: "1-234-567-8901",
* },
* },
* ],
* setParameterActions: [
* {
* parameter: "some-param",
* value: "123.45",
* },
* {
* parameter: "another-param",
* value: JSON.stringify("abc"),
* },
* {
* parameter: "other-param",
* value: JSON.stringify(["foo"]),
* },
* ],
* conditionalCases: [{
* cases: JSON.stringify([
* {
* condition: "$sys.func.RAND() < 0.5",
* caseContent: [
* {
* message: {
* text: {
* text: ["First case"],
* },
* },
* },
* {
* additionalCases: {
* cases: [{
* condition: "$sys.func.RAND() < 0.2",
* caseContent: [{
* message: {
* text: {
* text: ["Nested case"],
* },
* },
* }],
* }],
* },
* },
* ],
* },
* {
* caseContent: [{
* message: {
* text: {
* text: ["Final case"],
* },
* },
* }],
* },
* ]),
* }],
* },
* eventHandlers: [{
* event: "some-event",
* triggerFulfillment: {
* returnPartialResponses: true,
* messages: [
* {
* channel: "some-channel",
* text: {
* texts: ["Some text"],
* },
* },
* {
* payload: " {\"some-key\": \"some-value\", \"other-key\": [\"other-value\"]}\n",
* },
* {
* conversationSuccess: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* outputAudioText: {
* text: "some output text",
* },
* },
* {
* outputAudioText: {
* ssml: " <speak>Some example <say-as interpret-as=\"characters\">SSML XML</say-as></speak>\n",
* },
* },
* {
* liveAgentHandoff: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* playAudio: {
* audioUri: "http://example.com/some-audio-file.mp3",
* },
* },
* {
* telephonyTransferCall: {
* phoneNumber: "1-234-567-8901",
* },
* },
* ],
* setParameterActions: [
* {
* parameter: "some-param",
* value: "123.45",
* },
* {
* parameter: "another-param",
* value: JSON.stringify("abc"),
* },
* {
* parameter: "other-param",
* value: JSON.stringify(["foo"]),
* },
* ],
* conditionalCases: [{
* cases: JSON.stringify([
* {
* condition: "$sys.func.RAND() < 0.5",
* caseContent: [
* {
* message: {
* text: {
* text: ["First case"],
* },
* },
* },
* {
* additionalCases: {
* cases: [{
* condition: "$sys.func.RAND() < 0.2",
* caseContent: [{
* message: {
* text: {
* text: ["Nested case"],
* },
* },
* }],
* }],
* },
* },
* ],
* },
* {
* caseContent: [{
* message: {
* text: {
* text: ["Final case"],
* },
* },
* }],
* },
* ]),
* }],
* },
* }],
* form: {
* parameters: [{
* displayName: "param1",
* entityType: "projects/-/locations/-/agents/-/entityTypes/sys.date",
* defaultValue: JSON.stringify("2000-01-01"),
* fillBehavior: {
* initialPromptFulfillment: {
* messages: [
* {
* channel: "some-channel",
* text: {
* texts: ["Please provide param1"],
* },
* },
* {
* payload: " {\"some-key\": \"some-value\", \"other-key\": [\"other-value\"]}\n",
* },
* {
* conversationSuccess: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* outputAudioText: {
* text: "some output text",
* },
* },
* {
* outputAudioText: {
* ssml: " <speak>Some example <say-as interpret-as=\"characters\">SSML XML</say-as></speak>\n",
* },
* },
* {
* liveAgentHandoff: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* playAudio: {
* audioUri: "http://example.com/some-audio-file.mp3",
* },
* },
* {
* telephonyTransferCall: {
* phoneNumber: "1-234-567-8901",
* },
* },
* ],
* setParameterActions: [
* {
* parameter: "some-param",
* value: "123.45",
* },
* {
* parameter: "another-param",
* value: JSON.stringify("abc"),
* },
* {
* parameter: "other-param",
* value: JSON.stringify(["foo"]),
* },
* ],
* conditionalCases: [{
* cases: JSON.stringify([
* {
* condition: "$sys.func.RAND() < 0.5",
* caseContent: [
* {
* message: {
* text: {
* text: ["First case"],
* },
* },
* },
* {
* additionalCases: {
* cases: [{
* condition: "$sys.func.RAND() < 0.2",
* caseContent: [{
* message: {
* text: {
* text: ["Nested case"],
* },
* },
* }],
* }],
* },
* },
* ],
* },
* {
* caseContent: [{
* message: {
* text: {
* text: ["Final case"],
* },
* },
* }],
* },
* ]),
* }],
* },
* repromptEventHandlers: [
* {
* event: "sys.no-match-1",
* triggerFulfillment: {
* returnPartialResponses: true,
* webhook: myWebhook.id,
* tag: "some-tag",
* messages: [
* {
* channel: "some-channel",
* text: {
* texts: ["Please provide param1"],
* },
* },
* {
* payload: " {\"some-key\": \"some-value\", \"other-key\": [\"other-value\"]}\n",
* },
* {
* conversationSuccess: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* outputAudioText: {
* text: "some output text",
* },
* },
* {
* outputAudioText: {
* ssml: " <speak>Some example <say-as interpret-as=\"characters\">SSML XML</say-as></speak>\n",
* },
* },
* {
* liveAgentHandoff: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* playAudio: {
* audioUri: "http://example.com/some-audio-file.mp3",
* },
* },
* {
* telephonyTransferCall: {
* phoneNumber: "1-234-567-8901",
* },
* },
* ],
* setParameterActions: [
* {
* parameter: "some-param",
* value: "123.45",
* },
* {
* parameter: "another-param",
* value: JSON.stringify("abc"),
* },
* {
* parameter: "other-param",
* value: JSON.stringify(["foo"]),
* },
* ],
* conditionalCases: [{
* cases: JSON.stringify([
* {
* condition: "$sys.func.RAND() < 0.5",
* caseContent: [
* {
* message: {
* text: {
* text: ["First case"],
* },
* },
* },
* {
* additionalCases: {
* cases: [{
* condition: "$sys.func.RAND() < 0.2",
* caseContent: [{
* message: {
* text: {
* text: ["Nested case"],
* },
* },
* }],
* }],
* },
* },
* ],
* },
* {
* caseContent: [{
* message: {
* text: {
* text: ["Final case"],
* },
* },
* }],
* },
* ]),
* }],
* },
* },
* {
* event: "sys.no-match-2",
* targetFlow: agent.startFlow,
* },
* {
* event: "sys.no-match-3",
* targetPage: myPage2.id,
* },
* ],
* },
* required: true,
* redact: true,
* advancedSettings: {
* dtmfSettings: {
* enabled: true,
* maxDigits: 1,
* finishDigit: "#",
* },
* },
* }],
* },
* transitionRoutes: [{
* condition: "$page.params.status = 'FINAL'",
* triggerFulfillment: {
* messages: [
* {
* channel: "some-channel",
* text: {
* texts: ["information completed, navigating to page 2"],
* },
* },
* {
* payload: " {\"some-key\": \"some-value\", \"other-key\": [\"other-value\"]}\n",
* },
* {
* conversationSuccess: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* outputAudioText: {
* text: "some output text",
* },
* },
* {
* outputAudioText: {
* ssml: " <speak>Some example <say-as interpret-as=\"characters\">SSML XML</say-as></speak>\n",
* },
* },
* {
* liveAgentHandoff: {
* metadata: " {\"some-metadata-key\": \"some-value\", \"other-metadata-key\": 1234}\n",
* },
* },
* {
* playAudio: {
* audioUri: "http://example.com/some-audio-file.mp3",
* },
* },
* {
* telephonyTransferCall: {
* phoneNumber: "1-234-567-8901",
* },
* },
* ],
* setParameterActions: [
* {
* parameter: "some-param",
* value: "123.45",
* },
* {
* parameter: "another-param",
* value: JSON.stringify("abc"),
* },
* {
* parameter: "other-param",
* value: JSON.stringify(["foo"]),
* },
* ],
* conditionalCases: [{
* cases: JSON.stringify([
* {
* condition: "$sys.func.RAND() < 0.5",
* caseContent: [
* {
* message: {
* text: {
* text: ["First case"],
* },
* },
* },
* {
* additionalCases: {
* cases: [{
* condition: "$sys.func.RAND() < 0.2",
* caseContent: [{
* message: {
* text: {
* text: ["Nested case"],
* },
* },
* }],
* }],
* },
* },
* ],
* },
* {
* caseContent: [{
* message: {
* text: {
* text: ["Final case"],
* },
* },
* }],
* },
* ]),
* }],
* },
* targetPage: myPage2.id,
* }],
* advancedSettings: {
* dtmfSettings: {
* enabled: true,
* maxDigits: 1,
* finishDigit: "#",
* },
* },
* });
* ```
*
* ## Import
*
* Page can be imported using any of these accepted formats:
*
* * `{{parent}}/pages/{{name}}`
*
* * `{{parent}}/{{name}}`
*
* When using the `pulumi import` command, Page can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/cxPage:CxPage default {{parent}}/pages/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:diagflow/cxPage:CxPage default {{parent}}/{{name}}
* ```
*/
export declare class CxPage extends pulumi.CustomResource {
/**
* Get an existing CxPage 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?: CxPageState, opts?: pulumi.CustomResourceOptions): CxPage;
/**
* Returns true if the given object is an instance of CxPage. 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 CxPage;
/**
* Hierarchical advanced settings for this page. The settings exposed at the lower level overrides the settings exposed at the higher level.
* Hierarchy: Agent->Flow->Page->Fulfillment/Parameter.
* Structure is documented below.
*/
readonly advancedSettings: pulumi.Output<outputs.diagflow.CxPageAdvancedSettings | undefined>;
/**
* The human-readable name of the page, unique within the agent.
*
*
* - - -
*/
readonly displayName: pulumi.Output<string>;
/**
* The fulfillment to call when the session is entering the page.
* Structure is documented below.
*/
readonly entryFulfillment: pulumi.Output<outputs.diagflow.CxPageEntryFulfillment | undefined>;
/**
* Handlers associated with the page to handle events such as webhook errors, no match or no input.
* Structure is documented below.
*/
readonly eventHandlers: pulumi.Output<outputs.diagflow.CxPageEventHandler[] | undefined>;
/**
* The form associated with the page, used for collecting parameters relevant to the page.
* Structure is documented below.
*/
readonly form: pulumi.Output<outputs.diagflow.CxPageForm | undefined>;
/**
* The language of the following fields in page:
* Page.entry_fulfillment.messages
* Page.entry_fulfillment.conditional_cases
* Page.event_handlers.trigger_fulfillment.messages
* Page.event_handlers.trigger_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.reprompt_event_handlers.messages
* Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
* Page.transition_routes.trigger_fulfillment.messages
* Page.transition_routes.trigger_fulfillment.conditional_cases
* If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
*/
readonly languageCode: pulumi.Output<string | undefined>;
/**
* 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>;
/**
* The flow to create a page for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.
*/
readonly parent: pulumi.Output<string | undefined>;
/**
* Ordered list of TransitionRouteGroups associated with the page. Transition route groups must be unique within a page.
* If multiple transition routes within a page scope refer to the same intent, then the precedence order is: page's transition route > page's transition route group > flow's transition routes.
* If multiple transition route groups within a page contain the same intent, then the first group in the ordered list takes precedence.
* Format:projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/transitionRouteGroups/<TransitionRouteGroup ID>.
*/
readonly transitionRouteGroups: pulumi.Output<string[] | undefined>;
/**
* A list of transitions for the transition rules of this page. They route the conversation to another page in the same flow, or another flow.
* When we are in a certain page, the TransitionRoutes are evalauted in the following order:
* TransitionRoutes defined in the page with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in flow with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in the page with only condition specified.
* TransitionRoutes defined in the transition route groups with only condition specified.
* Structure is documented below.
*/
readonly transitionRoutes: pulumi.Output<outputs.diagflow.CxPageTransitionRoute[] | undefined>;
/**
* Create a CxPage 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: CxPageArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering CxPage resources.
*/
export interface CxPageState {
/**
* Hierarchical advanced settings for this page. The settings exposed at the lower level overrides the settings exposed at the higher level.
* Hierarchy: Agent->Flow->Page->Fulfillment/Parameter.
* Structure is documented below.
*/
advancedSettings?: pulumi.Input<inputs.diagflow.CxPageAdvancedSettings>;
/**
* The human-readable name of the page, unique within the agent.
*
*
* - - -
*/
displayName?: pulumi.Input<string>;
/**
* The fulfillment to call when the session is entering the page.
* Structure is documented below.
*/
entryFulfillment?: pulumi.Input<inputs.diagflow.CxPageEntryFulfillment>;
/**
* Handlers associated with the page to handle events such as webhook errors, no match or no input.
* Structure is documented below.
*/
eventHandlers?: pulumi.Input<pulumi.Input<inputs.diagflow.CxPageEventHandler>[]>;
/**
* The form associated with the page, used for collecting parameters relevant to the page.
* Structure is documented below.
*/
form?: pulumi.Input<inputs.diagflow.CxPageForm>;
/**
* The language of the following fields in page:
* Page.entry_fulfillment.messages
* Page.entry_fulfillment.conditional_cases
* Page.event_handlers.trigger_fulfillment.messages
* Page.event_handlers.trigger_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.reprompt_event_handlers.messages
* Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
* Page.transition_routes.trigger_fulfillment.messages
* Page.transition_routes.trigger_fulfillment.conditional_cases
* If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
*/
languageCode?: pulumi.Input<string>;
/**
* 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>;
/**
* The flow to create a page for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.
*/
parent?: pulumi.Input<string>;
/**
* Ordered list of TransitionRouteGroups associated with the page. Transition route groups must be unique within a page.
* If multiple transition routes within a page scope refer to the same intent, then the precedence order is: page's transition route > page's transition route group > flow's transition routes.
* If multiple transition route groups within a page contain the same intent, then the first group in the ordered list takes precedence.
* Format:projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/transitionRouteGroups/<TransitionRouteGroup ID>.
*/
transitionRouteGroups?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of transitions for the transition rules of this page. They route the conversation to another page in the same flow, or another flow.
* When we are in a certain page, the TransitionRoutes are evalauted in the following order:
* TransitionRoutes defined in the page with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in flow with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in the page with only condition specified.
* TransitionRoutes defined in the transition route groups with only condition specified.
* Structure is documented below.
*/
transitionRoutes?: pulumi.Input<pulumi.Input<inputs.diagflow.CxPageTransitionRoute>[]>;
}
/**
* The set of arguments for constructing a CxPage resource.
*/
export interface CxPageArgs {
/**
* Hierarchical advanced settings for this page. The settings exposed at the lower level overrides the settings exposed at the higher level.
* Hierarchy: Agent->Flow->Page->Fulfillment/Parameter.
* Structure is documented below.
*/
advancedSettings?: pulumi.Input<inputs.diagflow.CxPageAdvancedSettings>;
/**
* The human-readable name of the page, unique within the agent.
*
*
* - - -
*/
displayName: pulumi.Input<string>;
/**
* The fulfillment to call when the session is entering the page.
* Structure is documented below.
*/
entryFulfillment?: pulumi.Input<inputs.diagflow.CxPageEntryFulfillment>;
/**
* Handlers associated with the page to handle events such as webhook errors, no match or no input.
* Structure is documented below.
*/
eventHandlers?: pulumi.Input<pulumi.Input<inputs.diagflow.CxPageEventHandler>[]>;
/**
* The form associated with the page, used for collecting parameters relevant to the page.
* Structure is documented below.
*/
form?: pulumi.Input<inputs.diagflow.CxPageForm>;
/**
* The language of the following fields in page:
* Page.entry_fulfillment.messages
* Page.entry_fulfillment.conditional_cases
* Page.event_handlers.trigger_fulfillment.messages
* Page.event_handlers.trigger_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages
* Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases
* Page.form.parameters.fill_behavior.reprompt_event_handlers.messages
* Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
* Page.transition_routes.trigger_fulfillment.messages
* Page.transition_routes.trigger_fulfillment.conditional_cases
* If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
*/
languageCode?: pulumi.Input<string>;
/**
* The flow to create a page for.
* Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.
*/
parent?: pulumi.Input<string>;
/**
* Ordered list of TransitionRouteGroups associated with the page. Transition route groups must be unique within a page.
* If multiple transition routes within a page scope refer to the same intent, then the precedence order is: page's transition route > page's transition route group > flow's transition routes.
* If multiple transition route groups within a page contain the same intent, then the first group in the ordered list takes precedence.
* Format:projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/transitionRouteGroups/<TransitionRouteGroup ID>.
*/
transitionRouteGroups?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of transitions for the transition rules of this page. They route the conversation to another page in the same flow, or another flow.
* When we are in a certain page, the TransitionRoutes are evalauted in the following order:
* TransitionRoutes defined in the page with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in flow with intent specified.
* TransitionRoutes defined in the transition route groups with intent specified.
* TransitionRoutes defined in the page with only condition specified.
* TransitionRoutes defined in the transition route groups with only condition specified.
* Structure is documented below.
*/
transitionRoutes?: pulumi.Input<pulumi.Input<inputs.diagflow.CxPageTransitionRoute>[]>;
}