@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
312 lines • 12.2 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CxWebhook = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Webhooks host the developer's business logic. During a session, webhooks allow the developer to use the data extracted by Dialogflow's natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend.
*
* To get more information about Webhook, see:
*
* * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.webhooks)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
*
* ## Example Usage
*
* ### Dialogflowcx Webhook Standard
*
* ```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: [
* "it",
* "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 standardWebhook = new gcp.diagflow.CxWebhook("standard_webhook", {
* parent: agent.id,
* displayName: "MyFlow",
* genericWebService: {
* allowedCaCerts: ["BQA="],
* uri: "https://example.com",
* requestHeaders: {
* "example-key": "example-value",
* },
* webhookType: "STANDARD",
* oauthConfig: {
* clientId: "example-client-id",
* secretVersionForClientSecret: "projects/example-proj/secrets/example-secret/versions/example-version",
* tokenEndpoint: "https://example.com",
* scopes: ["example-scope"],
* },
* serviceAgentAuth: "NONE",
* secretVersionForUsernamePassword: "projects/example-proj/secrets/example-secret/versions/example-version",
* secretVersionsForRequestHeaders: [
* {
* key: "example-key-1",
* secretVersion: "projects/example-proj/secrets/example-secret/versions/example-version",
* },
* {
* key: "example-key-2",
* secretVersion: "projects/example-proj/secrets/example-secret/versions/example-version-2",
* },
* ],
* },
* });
* ```
* ### Dialogflowcx Webhook Flexible
*
* ```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: [
* "it",
* "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 flexibleWebhook = new gcp.diagflow.CxWebhook("flexible_webhook", {
* parent: agent.id,
* displayName: "MyFlow",
* genericWebService: {
* uri: "https://example.com",
* requestHeaders: {
* "example-key": "example-value",
* },
* webhookType: "FLEXIBLE",
* oauthConfig: {
* clientId: "example-client-id",
* clientSecret: "projects/example-proj/secrets/example-secret/versions/example-version",
* tokenEndpoint: "https://example.com",
* },
* serviceAgentAuth: "NONE",
* httpMethod: "POST",
* requestBody: "{\"example-key\": \"example-value\"}",
* parameterMapping: {
* "example-parameter": "examplePath",
* },
* },
* });
* ```
* ### Dialogflowcx Webhook Service Directory Standard
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent",
* location: "us-central1",
* defaultLanguageCode: "en",
* supportedLanguageCodes: [
* "it",
* "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 standardWebhook = new gcp.diagflow.CxWebhook("standard_webhook", {
* parent: agent.id,
* displayName: "MyFlow",
* serviceDirectory: {
* service: "projects/example-proj/locations/us-central1/namespaces/example-namespace/services/example-service",
* genericWebService: {
* allowedCaCerts: ["BQA="],
* uri: "https://example.com",
* requestHeaders: {
* "example-key": "example-value",
* },
* webhookType: "STANDARD",
* oauthConfig: {
* clientId: "example-client-id",
* secretVersionForClientSecret: "projects/example-proj/secrets/example-secret/versions/example-version",
* tokenEndpoint: "https://example.com",
* scopes: ["example-scope"],
* },
* serviceAgentAuth: "NONE",
* secretVersionForUsernamePassword: "projects/example-proj/secrets/example-secret/versions/example-version",
* secretVersionsForRequestHeaders: [
* {
* key: "example-key-1",
* secretVersion: "projects/example-proj/secrets/example-secret/versions/example-version",
* },
* {
* key: "example-key-2",
* secretVersion: "projects/example-proj/secrets/example-secret/versions/example-version-2",
* },
* ],
* },
* },
* });
* ```
* ### Dialogflowcx Webhook Service Directory Flexible
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agent = new gcp.diagflow.CxAgent("agent", {
* displayName: "dialogflowcx-agent",
* location: "us-central1",
* defaultLanguageCode: "en",
* supportedLanguageCodes: [
* "it",
* "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 flexibleWebhook = new gcp.diagflow.CxWebhook("flexible_webhook", {
* parent: agent.id,
* displayName: "MyFlow",
* serviceDirectory: {
* service: "projects/example-proj/locations/us-central1/namespaces/example-namespace/services/example-service",
* genericWebService: {
* uri: "https://example.com",
* requestHeaders: {
* "example-key": "example-value",
* },
* webhookType: "FLEXIBLE",
* oauthConfig: {
* clientId: "example-client-id",
* clientSecret: "projects/example-proj/secrets/example-secret/versions/example-version",
* tokenEndpoint: "https://example.com",
* },
* serviceAgentAuth: "NONE",
* httpMethod: "POST",
* requestBody: "{\"example-key\": \"example-value\"}",
* parameterMapping: {
* "example-parameter": "examplePath",
* },
* },
* },
* });
* ```
*
* ## Import
*
* Webhook can be imported using any of these accepted formats:
*
* * `{{parent}}/webhooks/{{name}}`
*
* * `{{parent}}/{{name}}`
*
* When using the `pulumi import` command, Webhook can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/cxWebhook:CxWebhook default {{parent}}/webhooks/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:diagflow/cxWebhook:CxWebhook default {{parent}}/{{name}}
* ```
*/
class CxWebhook extends pulumi.CustomResource {
/**
* Get an existing CxWebhook 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 CxWebhook(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CxWebhook. 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'] === CxWebhook.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["enableSpellCorrection"] = state?.enableSpellCorrection;
resourceInputs["enableStackdriverLogging"] = state?.enableStackdriverLogging;
resourceInputs["genericWebService"] = state?.genericWebService;
resourceInputs["name"] = state?.name;
resourceInputs["parent"] = state?.parent;
resourceInputs["securitySettings"] = state?.securitySettings;
resourceInputs["serviceDirectory"] = state?.serviceDirectory;
resourceInputs["startFlow"] = state?.startFlow;
resourceInputs["timeout"] = state?.timeout;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
resourceInputs["disabled"] = args?.disabled;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["enableSpellCorrection"] = args?.enableSpellCorrection;
resourceInputs["enableStackdriverLogging"] = args?.enableStackdriverLogging;
resourceInputs["genericWebService"] = args?.genericWebService;
resourceInputs["parent"] = args?.parent;
resourceInputs["securitySettings"] = args?.securitySettings;
resourceInputs["serviceDirectory"] = args?.serviceDirectory;
resourceInputs["timeout"] = args?.timeout;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["startFlow"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CxWebhook.__pulumiType, name, resourceInputs, opts);
}
}
exports.CxWebhook = CxWebhook;
/** @internal */
CxWebhook.__pulumiType = 'gcp:diagflow/cxWebhook:CxWebhook';
//# sourceMappingURL=cxWebhook.js.map