@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
168 lines • 6.94 kB
JavaScript
// *** 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.Intent = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a Dialogflow intent. Intents convert a number of user expressions or patterns into an action. An action
* is an extraction of a user command or sentence semantics.
*
* To get more information about Intent, see:
*
* * [API documentation](https://cloud.google.com/dialogflow/docs/reference/rest/v2/projects.agent.intents)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/docs/)
*
* ## Example Usage
*
* ### Dialogflow Intent Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicAgent = new gcp.diagflow.Agent("basic_agent", {
* displayName: "example_agent",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* });
* const basicIntent = new gcp.diagflow.Intent("basic_intent", {displayName: "basic-intent"}, {
* dependsOn: [basicAgent],
* });
* ```
* ### Dialogflow Intent Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const agentProject = new gcp.organizations.Project("agent_project", {
* projectId: "my-project",
* name: "my-project",
* orgId: "123456789",
* deletionPolicy: "DELETE",
* });
* const agentProjectService = new gcp.projects.Service("agent_project", {
* project: agentProject.projectId,
* service: "dialogflow.googleapis.com",
* disableDependentServices: false,
* });
* const dialogflowServiceAccount = new gcp.serviceaccount.Account("dialogflow_service_account", {accountId: "my-account"});
* const agentCreate = new gcp.projects.IAMMember("agent_create", {
* project: agentProjectService.project,
* role: "roles/dialogflow.admin",
* member: pulumi.interpolate`serviceAccount:${dialogflowServiceAccount.email}`,
* });
* const basicAgent = new gcp.diagflow.Agent("basic_agent", {
* project: agentProject.projectId,
* displayName: "example_agent",
* defaultLanguageCode: "en",
* timeZone: "America/New_York",
* });
* const fullIntent = new gcp.diagflow.Intent("full_intent", {
* project: agentProject.projectId,
* displayName: "full-intent",
* webhookState: "WEBHOOK_STATE_ENABLED",
* priority: 1,
* isFallback: false,
* mlDisabled: true,
* action: "some_action",
* resetContexts: true,
* inputContextNames: [pulumi.interpolate`projects/${agentProject.projectId}/agent/sessions/-/contexts/some_id`],
* events: ["some_event"],
* defaultResponsePlatforms: [
* "FACEBOOK",
* "SLACK",
* ],
* }, {
* dependsOn: [basicAgent],
* });
* ```
*
* ## Import
*
* Intent can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, Intent can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:diagflow/intent:Intent default {{name}}
* ```
*/
class Intent extends pulumi.CustomResource {
/**
* Get an existing Intent 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 Intent(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Intent. 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'] === Intent.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["defaultResponsePlatforms"] = state?.defaultResponsePlatforms;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["events"] = state?.events;
resourceInputs["followupIntentInfos"] = state?.followupIntentInfos;
resourceInputs["inputContextNames"] = state?.inputContextNames;
resourceInputs["isFallback"] = state?.isFallback;
resourceInputs["mlDisabled"] = state?.mlDisabled;
resourceInputs["name"] = state?.name;
resourceInputs["parentFollowupIntentName"] = state?.parentFollowupIntentName;
resourceInputs["priority"] = state?.priority;
resourceInputs["project"] = state?.project;
resourceInputs["resetContexts"] = state?.resetContexts;
resourceInputs["rootFollowupIntentName"] = state?.rootFollowupIntentName;
resourceInputs["webhookState"] = state?.webhookState;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
resourceInputs["action"] = args?.action;
resourceInputs["defaultResponsePlatforms"] = args?.defaultResponsePlatforms;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["events"] = args?.events;
resourceInputs["inputContextNames"] = args?.inputContextNames;
resourceInputs["isFallback"] = args?.isFallback;
resourceInputs["mlDisabled"] = args?.mlDisabled;
resourceInputs["parentFollowupIntentName"] = args?.parentFollowupIntentName;
resourceInputs["priority"] = args?.priority;
resourceInputs["project"] = args?.project;
resourceInputs["resetContexts"] = args?.resetContexts;
resourceInputs["webhookState"] = args?.webhookState;
resourceInputs["followupIntentInfos"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["rootFollowupIntentName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Intent.__pulumiType, name, resourceInputs, opts);
}
}
exports.Intent = Intent;
/** @internal */
Intent.__pulumiType = 'gcp:diagflow/intent:Intent';
//# sourceMappingURL=intent.js.map
;