@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
155 lines • 6.54 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppRootAgentAssociation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Sets the root agent of a CES App after both the app and the agent have
* been created.
*
* Because a CES Agent must reference its parent app at creation time, the
* app must exist before any agent can be created. This means the root agent
* cannot be set on the app at creation time — use this resource to set it
* afterwards.
*
* > **Note:** This resource modifies the `rootAgent` field on the parent
* `gcp.ces.App`. Add `lifecycle { ignoreChanges = [rootAgent] }` to
* your `gcp.ces.App` resource to prevent Terraform from detecting drift
* and clearing the field on every plan.
*
* ## Example Usage
*
* ### Ces App Root Agent Association Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const app = new gcp.ces.App("app", {
* location: "eu",
* appId: "app-id",
* displayName: "Example App app-id",
* languageSettings: {
* defaultLanguageCode: "en-US",
* supportedLanguageCodes: ["es-ES"],
* fallbackAction: "escalate",
* },
* timeZoneSettings: {
* timeZone: "America/Los_Angeles",
* },
* });
* const agent = new gcp.ces.Agent("agent", {
* location: app.location,
* app: app.appId,
* agentId: "agent-id",
* displayName: "Example Agent",
* instruction: "You are a helpful assistant.",
* llmAgent: {},
* });
* const association = new gcp.ces.AppRootAgentAssociation("association", {
* location: app.location,
* appId: app.appId,
* agentId: agent.agentId,
* });
* ```
*
* ## Import
*
* AppRootAgentAssociation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/apps/{{app_id}}/agents/{{agent_id}}`
* * `{{project}}/{{location}}/{{app_id}}/{{agent_id}}`
* * `{{location}}/{{app_id}}/{{agent_id}}`
*
* When using the `pulumi import` command, AppRootAgentAssociation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:ces/appRootAgentAssociation:AppRootAgentAssociation default projects/{{project}}/locations/{{location}}/apps/{{app_id}}/agents/{{agent_id}}
* $ pulumi import gcp:ces/appRootAgentAssociation:AppRootAgentAssociation default {{project}}/{{location}}/{{app_id}}/{{agent_id}}
* $ pulumi import gcp:ces/appRootAgentAssociation:AppRootAgentAssociation default {{location}}/{{app_id}}/{{agent_id}}
* ```
*/
class AppRootAgentAssociation extends pulumi.CustomResource {
/**
* Get an existing AppRootAgentAssociation 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 AppRootAgentAssociation(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:ces/appRootAgentAssociation:AppRootAgentAssociation';
/**
* Returns true if the given object is an instance of AppRootAgentAssociation. 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'] === AppRootAgentAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["agentId"] = state?.agentId;
resourceInputs["appId"] = state?.appId;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["location"] = state?.location;
resourceInputs["project"] = state?.project;
}
else {
const args = argsOrState;
if (args?.agentId === undefined && !opts.urn) {
throw new Error("Missing required property 'agentId'");
}
if (args?.appId === undefined && !opts.urn) {
throw new Error("Missing required property 'appId'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["agentId"] = args?.agentId;
resourceInputs["appId"] = args?.appId;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["location"] = args?.location;
resourceInputs["project"] = args?.project;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AppRootAgentAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.AppRootAgentAssociation = AppRootAgentAssociation;
//# sourceMappingURL=appRootAgentAssociation.js.map