"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.Guardrail = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Description
 *
 * ## Example Usage
 *
 * ### Ces Guardrail Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cesAppForGuardrail = new gcp.ces.App("ces_app_for_guardrail", {
 *     appId: "app-id",
 *     location: "us",
 *     description: "App used as parent for CES Toolset example",
 *     displayName: "my-app",
 *     languageSettings: {
 *         defaultLanguageCode: "en-US",
 *         supportedLanguageCodes: [
 *             "es-ES",
 *             "fr-FR",
 *         ],
 *         enableMultilingualSupport: true,
 *         fallbackAction: "escalate",
 *     },
 *     timeZoneSettings: {
 *         timeZone: "America/Los_Angeles",
 *     },
 * });
 * const cesGuardrailBasic = new gcp.ces.Guardrail("ces_guardrail_basic", {
 *     guardrailId: "guardrail-id",
 *     location: cesAppForGuardrail.location,
 *     app: cesAppForGuardrail.appId,
 *     displayName: "my-guardrail",
 *     description: "Guardrail description",
 *     action: {
 *         respondImmediately: {
 *             responses: [{
 *                 text: "Text",
 *                 disabled: false,
 *             }],
 *         },
 *     },
 *     enabled: true,
 *     modelSafety: {
 *         safetySettings: [{
 *             category: "HARM_CATEGORY_HATE_SPEECH",
 *             threshold: "BLOCK_NONE",
 *         }],
 *     },
 * });
 * ```
 * ### Ces Guardrail Transfer Agent Content Filter
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cesAppForGuardrail = new gcp.ces.App("ces_app_for_guardrail", {
 *     appId: "app-id",
 *     location: "us",
 *     description: "App used as parent for CES Toolset example",
 *     displayName: "my-app",
 *     languageSettings: {
 *         defaultLanguageCode: "en-US",
 *         supportedLanguageCodes: [
 *             "es-ES",
 *             "fr-FR",
 *         ],
 *         enableMultilingualSupport: true,
 *         fallbackAction: "escalate",
 *     },
 *     timeZoneSettings: {
 *         timeZone: "America/Los_Angeles",
 *     },
 * });
 * const cesGuardrailTransferAgentContentFilter = new gcp.ces.Guardrail("ces_guardrail_transfer_agent_content_filter", {
 *     guardrailId: "guardrail-id",
 *     location: cesAppForGuardrail.location,
 *     app: cesAppForGuardrail.appId,
 *     displayName: "my-guardrail",
 *     description: "Guardrail description",
 *     action: {
 *         transferAgent: {
 *             agent: pulumi.interpolate`projects/${cesAppForGuardrail.project}/locations/us/apps/${cesAppForGuardrail.appId}/agents/fake-agent`,
 *         },
 *     },
 *     enabled: true,
 *     contentFilter: {
 *         bannedContents: ["example"],
 *         bannedContentsInUserInputs: ["example"],
 *         bannedContentsInAgentResponses: ["example"],
 *         matchType: "SIMPLE_STRING_MATCH",
 *         disregardDiacritics: true,
 *     },
 * });
 * ```
 * ### Ces Guardrail Generative Answer Llm Prompt Security
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cesAppForGuardrail = new gcp.ces.App("ces_app_for_guardrail", {
 *     appId: "app-id",
 *     location: "us",
 *     description: "App used as parent for CES Toolset example",
 *     displayName: "my-app",
 *     languageSettings: {
 *         defaultLanguageCode: "en-US",
 *         supportedLanguageCodes: [
 *             "es-ES",
 *             "fr-FR",
 *         ],
 *         enableMultilingualSupport: true,
 *         fallbackAction: "escalate",
 *     },
 *     timeZoneSettings: {
 *         timeZone: "America/Los_Angeles",
 *     },
 * });
 * const cesGuardrailGenerativeAnswerLlmPromptSecurity = new gcp.ces.Guardrail("ces_guardrail_generative_answer_llm_prompt_security", {
 *     guardrailId: "guardrail-id",
 *     location: cesAppForGuardrail.location,
 *     app: cesAppForGuardrail.appId,
 *     displayName: "my-guardrail",
 *     description: "Guardrail description",
 *     action: {
 *         generativeAnswer: {
 *             prompt: "example_prompt",
 *         },
 *     },
 *     enabled: true,
 *     llmPromptSecurity: {
 *         customPolicy: {
 *             maxConversationMessages: 10,
 *             modelSettings: {
 *                 model: "gemini-2.5-flash",
 *                 temperature: 50,
 *             },
 *             prompt: "example_prompt",
 *             policyScope: "USER_QUERY",
 *             failOpen: true,
 *             allowShortUtterance: true,
 *         },
 *     },
 * });
 * ```
 * ### Ces Guardrail Code Callback
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cesAppForGuardrail = new gcp.ces.App("ces_app_for_guardrail", {
 *     appId: "app-id",
 *     location: "us",
 *     description: "App used as parent for CES Toolset example",
 *     displayName: "my-app",
 *     languageSettings: {
 *         defaultLanguageCode: "en-US",
 *         supportedLanguageCodes: [
 *             "es-ES",
 *             "fr-FR",
 *         ],
 *         enableMultilingualSupport: true,
 *         fallbackAction: "escalate",
 *     },
 *     timeZoneSettings: {
 *         timeZone: "America/Los_Angeles",
 *     },
 * });
 * const cesGuardrailCodeCallback = new gcp.ces.Guardrail("ces_guardrail_code_callback", {
 *     guardrailId: "guardrail-id",
 *     location: cesAppForGuardrail.location,
 *     app: cesAppForGuardrail.appId,
 *     displayName: "my-guardrail",
 *     description: "Guardrail description",
 *     action: {
 *         generativeAnswer: {
 *             prompt: "example_prompt",
 *         },
 *     },
 *     enabled: true,
 *     codeCallback: {
 *         beforeAgentCallback: {
 *             description: "Example callback",
 *             disabled: true,
 *             pythonCode: `def callback(context):
 *     return {'override': False}`,
 *         },
 *         afterAgentCallback: {
 *             description: "Example callback",
 *             disabled: true,
 *             pythonCode: `def callback(context):
 *     return {'override': False}`,
 *         },
 *         beforeModelCallback: {
 *             description: "Example callback",
 *             disabled: true,
 *             pythonCode: `def callback(context):
 *     return {'override': False}`,
 *         },
 *         afterModelCallback: {
 *             description: "Example callback",
 *             disabled: true,
 *             pythonCode: `def callback(context):
 *     return {'override': False}`,
 *         },
 *     },
 * });
 * ```
 * ### Ces Guardrail Llm Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cesAppForGuardrail = new gcp.ces.App("ces_app_for_guardrail", {
 *     appId: "app-id",
 *     location: "us",
 *     description: "App used as parent for CES Toolset example",
 *     displayName: "my-app",
 *     languageSettings: {
 *         defaultLanguageCode: "en-US",
 *         supportedLanguageCodes: [
 *             "es-ES",
 *             "fr-FR",
 *         ],
 *         enableMultilingualSupport: true,
 *         fallbackAction: "escalate",
 *     },
 *     timeZoneSettings: {
 *         timeZone: "America/Los_Angeles",
 *     },
 * });
 * const cesGuardrailLlmPolicy = new gcp.ces.Guardrail("ces_guardrail_llm_policy", {
 *     guardrailId: "guardrail-id",
 *     location: cesAppForGuardrail.location,
 *     app: cesAppForGuardrail.appId,
 *     displayName: "my-guardrail",
 *     description: "Guardrail description",
 *     action: {
 *         generativeAnswer: {
 *             prompt: "example_prompt",
 *         },
 *     },
 *     enabled: true,
 *     llmPolicy: {
 *         maxConversationMessages: 10,
 *         modelSettings: {
 *             model: "gemini-2.5-flash",
 *             temperature: 50,
 *         },
 *         prompt: "example_prompt",
 *         policyScope: "USER_QUERY",
 *         failOpen: true,
 *         allowShortUtterance: true,
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Guardrail can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/apps/{{app}}/guardrails/{{name}}`
 *
 * * `{{project}}/{{location}}/{{app}}/{{name}}`
 *
 * * `{{location}}/{{app}}/{{name}}`
 *
 * When using the `pulumi import` command, Guardrail can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:ces/guardrail:Guardrail default projects/{{project}}/locations/{{location}}/apps/{{app}}/guardrails/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:ces/guardrail:Guardrail default {{project}}/{{location}}/{{app}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:ces/guardrail:Guardrail default {{location}}/{{app}}/{{name}}
 * ```
 */
class Guardrail extends pulumi.CustomResource {
    /**
     * Get an existing Guardrail 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 Guardrail(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Guardrail.  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'] === Guardrail.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["action"] = state?.action;
            resourceInputs["app"] = state?.app;
            resourceInputs["codeCallback"] = state?.codeCallback;
            resourceInputs["contentFilter"] = state?.contentFilter;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["description"] = state?.description;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["enabled"] = state?.enabled;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["guardrailId"] = state?.guardrailId;
            resourceInputs["llmPolicy"] = state?.llmPolicy;
            resourceInputs["llmPromptSecurity"] = state?.llmPromptSecurity;
            resourceInputs["location"] = state?.location;
            resourceInputs["modelSafety"] = state?.modelSafety;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.app === undefined && !opts.urn) {
                throw new Error("Missing required property 'app'");
            }
            if (args?.displayName === undefined && !opts.urn) {
                throw new Error("Missing required property 'displayName'");
            }
            if (args?.guardrailId === undefined && !opts.urn) {
                throw new Error("Missing required property 'guardrailId'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            resourceInputs["action"] = args?.action;
            resourceInputs["app"] = args?.app;
            resourceInputs["codeCallback"] = args?.codeCallback;
            resourceInputs["contentFilter"] = args?.contentFilter;
            resourceInputs["description"] = args?.description;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["enabled"] = args?.enabled;
            resourceInputs["guardrailId"] = args?.guardrailId;
            resourceInputs["llmPolicy"] = args?.llmPolicy;
            resourceInputs["llmPromptSecurity"] = args?.llmPromptSecurity;
            resourceInputs["location"] = args?.location;
            resourceInputs["modelSafety"] = args?.modelSafety;
            resourceInputs["project"] = args?.project;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Guardrail.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Guardrail = Guardrail;
/** @internal */
Guardrail.__pulumiType = 'gcp:ces/guardrail:Guardrail';
//# sourceMappingURL=guardrail.js.map