UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

164 lines 7.88 kB
"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.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, * instruction: "You are a friendly assistant who helps answer questions.", * 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, { ...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?.agentArn; resourceInputs["agentCollaboration"] = state?.agentCollaboration; resourceInputs["agentId"] = state?.agentId; resourceInputs["agentName"] = state?.agentName; resourceInputs["agentResourceRoleArn"] = state?.agentResourceRoleArn; resourceInputs["agentVersion"] = state?.agentVersion; resourceInputs["customerEncryptionKeyArn"] = state?.customerEncryptionKeyArn; resourceInputs["description"] = state?.description; resourceInputs["foundationModel"] = state?.foundationModel; resourceInputs["guardrailConfigurations"] = state?.guardrailConfigurations; resourceInputs["idleSessionTtlInSeconds"] = state?.idleSessionTtlInSeconds; resourceInputs["instruction"] = state?.instruction; resourceInputs["memoryConfigurations"] = state?.memoryConfigurations; resourceInputs["prepareAgent"] = state?.prepareAgent; resourceInputs["preparedAt"] = state?.preparedAt; resourceInputs["promptOverrideConfigurations"] = state?.promptOverrideConfigurations; resourceInputs["region"] = state?.region; resourceInputs["skipResourceInUseCheck"] = state?.skipResourceInUseCheck; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["timeouts"] = state?.timeouts; } else { const args = argsOrState; if (args?.agentName === undefined && !opts.urn) { throw new Error("Missing required property 'agentName'"); } if (args?.agentResourceRoleArn === undefined && !opts.urn) { throw new Error("Missing required property 'agentResourceRoleArn'"); } if (args?.foundationModel === undefined && !opts.urn) { throw new Error("Missing required property 'foundationModel'"); } resourceInputs["agentCollaboration"] = args?.agentCollaboration; resourceInputs["agentName"] = args?.agentName; resourceInputs["agentResourceRoleArn"] = args?.agentResourceRoleArn; resourceInputs["customerEncryptionKeyArn"] = args?.customerEncryptionKeyArn; resourceInputs["description"] = args?.description; resourceInputs["foundationModel"] = args?.foundationModel; resourceInputs["guardrailConfigurations"] = args?.guardrailConfigurations; resourceInputs["idleSessionTtlInSeconds"] = args?.idleSessionTtlInSeconds; resourceInputs["instruction"] = args?.instruction; resourceInputs["memoryConfigurations"] = args?.memoryConfigurations; resourceInputs["prepareAgent"] = args?.prepareAgent; resourceInputs["promptOverrideConfigurations"] = args?.promptOverrideConfigurations; resourceInputs["region"] = args?.region; resourceInputs["skipResourceInUseCheck"] = args?.skipResourceInUseCheck; resourceInputs["tags"] = args?.tags; resourceInputs["timeouts"] = args?.timeouts; 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