@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
163 lines • 8.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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentAgent = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing an AWS Agents for Amazon Bedrock Agent.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getCallerIdentity({});
* const currentGetPartition = aws.getPartition({});
* const currentGetRegion = aws.getRegion({});
* const exampleAgentTrust = Promise.all([current, currentGetPartition, currentGetRegion, current]).then(([current, currentGetPartition, currentGetRegion, current1]) => aws.iam.getPolicyDocument({
* statements: [{
* actions: ["sts:AssumeRole"],
* principals: [{
* identifiers: ["bedrock.amazonaws.com"],
* type: "Service",
* }],
* conditions: [
* {
* test: "StringEquals",
* values: [current.accountId],
* variable: "aws:SourceAccount",
* },
* {
* test: "ArnLike",
* values: [`arn:${currentGetPartition.partition}:bedrock:${currentGetRegion.region}:${current1.accountId}:agent/*`],
* variable: "AWS:SourceArn",
* },
* ],
* }],
* }));
* const exampleAgentPermissions = Promise.all([currentGetPartition, currentGetRegion]).then(([currentGetPartition, currentGetRegion]) => aws.iam.getPolicyDocument({
* statements: [{
* actions: ["bedrock:InvokeModel"],
* resources: [`arn:${currentGetPartition.partition}:bedrock:${currentGetRegion.region}::foundation-model/anthropic.claude-v2`],
* }],
* }));
* const example = new aws.iam.Role("example", {
* assumeRolePolicy: exampleAgentTrust.then(exampleAgentTrust => exampleAgentTrust.json),
* namePrefix: "AmazonBedrockExecutionRoleForAgents_",
* });
* const exampleRolePolicy = new aws.iam.RolePolicy("example", {
* policy: exampleAgentPermissions.then(exampleAgentPermissions => exampleAgentPermissions.json),
* role: example.id,
* });
* const exampleAgentAgent = new aws.bedrock.AgentAgent("example", {
* agentName: "my-agent-name",
* agentResourceRoleArn: example.arn,
* idleSessionTtlInSeconds: 500,
* foundationModel: "anthropic.claude-v2",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Agents for Amazon Bedrock Agent using the agent ID. For example:
*
* ```sh
* $ pulumi import aws:bedrock/agentAgent:AgentAgent example GGRRAED6JP
* ```
*/
class AgentAgent extends pulumi.CustomResource {
/**
* Get an existing AgentAgent 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 AgentAgent(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AgentAgent. 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'] === AgentAgent.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["agentArn"] = state ? state.agentArn : undefined;
resourceInputs["agentCollaboration"] = state ? state.agentCollaboration : undefined;
resourceInputs["agentId"] = state ? state.agentId : undefined;
resourceInputs["agentName"] = state ? state.agentName : undefined;
resourceInputs["agentResourceRoleArn"] = state ? state.agentResourceRoleArn : undefined;
resourceInputs["agentVersion"] = state ? state.agentVersion : undefined;
resourceInputs["customerEncryptionKeyArn"] = state ? state.customerEncryptionKeyArn : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["foundationModel"] = state ? state.foundationModel : undefined;
resourceInputs["guardrailConfigurations"] = state ? state.guardrailConfigurations : undefined;
resourceInputs["idleSessionTtlInSeconds"] = state ? state.idleSessionTtlInSeconds : undefined;
resourceInputs["instruction"] = state ? state.instruction : undefined;
resourceInputs["memoryConfigurations"] = state ? state.memoryConfigurations : undefined;
resourceInputs["prepareAgent"] = state ? state.prepareAgent : undefined;
resourceInputs["preparedAt"] = state ? state.preparedAt : undefined;
resourceInputs["promptOverrideConfigurations"] = state ? state.promptOverrideConfigurations : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["skipResourceInUseCheck"] = state ? state.skipResourceInUseCheck : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["timeouts"] = state ? state.timeouts : undefined;
}
else {
const args = argsOrState;
if ((!args || args.agentName === undefined) && !opts.urn) {
throw new Error("Missing required property 'agentName'");
}
if ((!args || args.agentResourceRoleArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'agentResourceRoleArn'");
}
if ((!args || args.foundationModel === undefined) && !opts.urn) {
throw new Error("Missing required property 'foundationModel'");
}
resourceInputs["agentCollaboration"] = args ? args.agentCollaboration : undefined;
resourceInputs["agentName"] = args ? args.agentName : undefined;
resourceInputs["agentResourceRoleArn"] = args ? args.agentResourceRoleArn : undefined;
resourceInputs["customerEncryptionKeyArn"] = args ? args.customerEncryptionKeyArn : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["foundationModel"] = args ? args.foundationModel : undefined;
resourceInputs["guardrailConfigurations"] = args ? args.guardrailConfigurations : undefined;
resourceInputs["idleSessionTtlInSeconds"] = args ? args.idleSessionTtlInSeconds : undefined;
resourceInputs["instruction"] = args ? args.instruction : undefined;
resourceInputs["memoryConfigurations"] = args ? args.memoryConfigurations : undefined;
resourceInputs["prepareAgent"] = args ? args.prepareAgent : undefined;
resourceInputs["promptOverrideConfigurations"] = args ? args.promptOverrideConfigurations : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["skipResourceInUseCheck"] = args ? args.skipResourceInUseCheck : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["timeouts"] = args ? args.timeouts : undefined;
resourceInputs["agentArn"] = undefined /*out*/;
resourceInputs["agentId"] = undefined /*out*/;
resourceInputs["agentVersion"] = undefined /*out*/;
resourceInputs["preparedAt"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AgentAgent.__pulumiType, name, resourceInputs, opts);
}
}
exports.AgentAgent = AgentAgent;
/** @internal */
AgentAgent.__pulumiType = 'aws:bedrock/agentAgent:AgentAgent';
//# sourceMappingURL=agentAgent.js.map