@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
143 lines • 6.24 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.AgentAgentAlias = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing an AWS Agents for Amazon Bedrock Agent Alias.
*
* ## 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,
* idleTtl: 500,
* foundationModel: "anthropic.claude-v2",
* });
* const exampleAgentAgentAlias = new aws.bedrock.AgentAgentAlias("example", {
* agentAliasName: "my-agent-alias",
* agentId: exampleAgentAgent.agentId,
* description: "Test Alias",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Agents for Amazon Bedrock Agent Alias using the alias ID and the agent ID separated by `,`. For example:
*
* ```sh
* $ pulumi import aws:bedrock/agentAgentAlias:AgentAgentAlias example 66IVY0GUTF,GGRRAED6JP
* ```
*/
class AgentAgentAlias extends pulumi.CustomResource {
/**
* Get an existing AgentAgentAlias 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 AgentAgentAlias(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AgentAgentAlias. 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'] === AgentAgentAlias.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["agentAliasArn"] = state?.agentAliasArn;
resourceInputs["agentAliasId"] = state?.agentAliasId;
resourceInputs["agentAliasName"] = state?.agentAliasName;
resourceInputs["agentId"] = state?.agentId;
resourceInputs["description"] = state?.description;
resourceInputs["region"] = state?.region;
resourceInputs["routingConfigurations"] = state?.routingConfigurations;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["timeouts"] = state?.timeouts;
}
else {
const args = argsOrState;
if (args?.agentAliasName === undefined && !opts.urn) {
throw new Error("Missing required property 'agentAliasName'");
}
if (args?.agentId === undefined && !opts.urn) {
throw new Error("Missing required property 'agentId'");
}
resourceInputs["agentAliasName"] = args?.agentAliasName;
resourceInputs["agentId"] = args?.agentId;
resourceInputs["description"] = args?.description;
resourceInputs["region"] = args?.region;
resourceInputs["routingConfigurations"] = args?.routingConfigurations;
resourceInputs["tags"] = args?.tags;
resourceInputs["timeouts"] = args?.timeouts;
resourceInputs["agentAliasArn"] = undefined /*out*/;
resourceInputs["agentAliasId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AgentAgentAlias.__pulumiType, name, resourceInputs, opts);
}
}
exports.AgentAgentAlias = AgentAgentAlias;
/** @internal */
AgentAgentAlias.__pulumiType = 'aws:bedrock/agentAgentAlias:AgentAgentAlias';
//# sourceMappingURL=agentAgentAlias.js.map