Documentation
¶
Overview ¶
Package acrun is a core application logic of acrun command line tool.
Index ¶
- Constants
- Variables
- func MakeVM(ctx context.Context, stsClient STSClient, ecrClient ECRClient, ...) *jsonnet.VM
- func ToLowerCamelCase(s string) string
- type AgentRuntime
- type App
- func (app *App) Delete(ctx context.Context, opt *DeleteOption) error
- func (app *App) Deploy(ctx context.Context, opt *DeployOption) error
- func (app *App) Diff(ctx context.Context, opt *DiffOption) error
- func (app *App) DumpIfVerbose(ctx context.Context, title string, v interface{})
- func (app *App) ECRImages(ctx context.Context, opt *ECRImagesOption) error
- func (app *App) GetAgentRuntime(ctx context.Context, name *string, qualifier *string) (*bedrockagentcorecontrol.GetAgentRuntimeOutput, error)
- func (app *App) GetAgentRuntimeARNByName(ctx context.Context, name string) (string, error)
- func (app *App) GetAgentRuntimeIDByName(ctx context.Context, name string) (string, error)
- func (app *App) GetAgentRuntimeVersionByEndpointName(ctx context.Context, name string, endpointName string) (string, error)
- func (app *App) Init(ctx context.Context, opt *InitOption) error
- func (app *App) Invoke(ctx context.Context, opt *InvokeOption) error
- func (app *App) Render(ctx context.Context, opt *RenderOption) error
- func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error
- func (app *App) SetOutput(stdout, stderr io.Writer)
- type BedrockAgentCoreClient
- type BedrockAgentCoreControlClient
- type CLI
- type DeleteOption
- type DeployOption
- type DiffOption
- type ECRClient
- type ECRImagesOption
- type ExitError
- type GlobalOption
- type InitOption
- type InvokeOption
- type RenderOption
- type RollbackOption
- type STSClient
- type Waiter
Constants ¶
const ( AppName = "acrun" DefaultEndpointName = "DEFAULT" )
Variables ¶
var ( DefaultAgentRuntimeFilenames = []string{ "agent_runtime.json", "agent_runtime.jsonnet", } CurrentEndpointName = "current" )
var (
ErrAgentRuntimeNotFound = errors.New("AgentRuntime not found")
)
var ErrDiff = &ExitError{Code: 2, Err: nil}
var Version = "v0.9.0"
Functions ¶
func ToLowerCamelCase ¶
ToLowerCamelCase converts a snake_case string to lowerCamelCase.
Types ¶
type AgentRuntime ¶
type AgentRuntime = bedrockagentcorecontrol.CreateAgentRuntimeInput
type App ¶
type App struct {
// contains filtered or unexported fields
}
func NewWithClient ¶
func NewWithClient( ctx context.Context, opts *GlobalOption, awsCfg aws.Config, ctrlClient BedrockAgentCoreControlClient, client BedrockAgentCoreClient, ecrClient ECRClient, stsClient STSClient, ) (*App, error)
func (*App) Deploy ¶
func (app *App) Deploy(ctx context.Context, opt *DeployOption) error
Deploy creates or updates the agent runtime described by the configuration file, then points the endpoint named by opt.EndpointName at the resulting version, creating that endpoint if it does not exist yet.
Deploying to the DEFAULT endpoint is rejected. Old versions are pruned afterwards as described on DeployOption; the prune is skipped when the runtime was just created. Pruning is best-effort: failures there are logged as warnings and never fail the deploy.
func (*App) DumpIfVerbose ¶ added in v0.6.1
func (*App) ECRImages ¶ added in v0.8.0
func (app *App) ECRImages(ctx context.Context, opt *ECRImagesOption) error
ECRImages retrieves the list of ECR image URIs used by the AgentRuntime. This includes images from all endpoints (DEFAULT and aliases) and recent N versions.
func (*App) GetAgentRuntime ¶
func (app *App) GetAgentRuntime(ctx context.Context, name *string, qualifier *string) (*bedrockagentcorecontrol.GetAgentRuntimeOutput, error)
func (*App) GetAgentRuntimeARNByName ¶
func (*App) GetAgentRuntimeIDByName ¶
func (*App) GetAgentRuntimeVersionByEndpointName ¶
type BedrockAgentCoreClient ¶
type BedrockAgentCoreClient interface {
InvokeAgentRuntime(ctx context.Context, params *bedrockagentcore.InvokeAgentRuntimeInput, optFns ...func(*bedrockagentcore.Options)) (*bedrockagentcore.InvokeAgentRuntimeOutput, error)
}
type BedrockAgentCoreControlClient ¶
type BedrockAgentCoreControlClient interface {
ListAgentRuntimes(ctx context.Context, params *bedrockagentcorecontrol.ListAgentRuntimesInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.ListAgentRuntimesOutput, error)
ListAgentRuntimeVersions(ctx context.Context, params *bedrockagentcorecontrol.ListAgentRuntimeVersionsInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.ListAgentRuntimeVersionsOutput, error)
ListAgentRuntimeEndpoints(ctx context.Context, params *bedrockagentcorecontrol.ListAgentRuntimeEndpointsInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.ListAgentRuntimeEndpointsOutput, error)
GetAgentRuntime(ctx context.Context, params *bedrockagentcorecontrol.GetAgentRuntimeInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.GetAgentRuntimeOutput, error)
GetAgentRuntimeEndpoint(ctx context.Context, params *bedrockagentcorecontrol.GetAgentRuntimeEndpointInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.GetAgentRuntimeEndpointOutput, error)
CreateAgentRuntime(ctx context.Context, params *bedrockagentcorecontrol.CreateAgentRuntimeInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.CreateAgentRuntimeOutput, error)
CreateAgentRuntimeEndpoint(ctx context.Context, params *bedrockagentcorecontrol.CreateAgentRuntimeEndpointInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.CreateAgentRuntimeEndpointOutput, error)
UpdateAgentRuntime(ctx context.Context, params *bedrockagentcorecontrol.UpdateAgentRuntimeInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.UpdateAgentRuntimeOutput, error)
UpdateAgentRuntimeEndpoint(ctx context.Context, params *bedrockagentcorecontrol.UpdateAgentRuntimeEndpointInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.UpdateAgentRuntimeEndpointOutput, error)
DeleteAgentRuntime(ctx context.Context, params *bedrockagentcorecontrol.DeleteAgentRuntimeInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.DeleteAgentRuntimeOutput, error)
DeleteAgentRuntimeEndpoint(ctx context.Context, params *bedrockagentcorecontrol.DeleteAgentRuntimeEndpointInput, optFns ...func(*bedrockagentcorecontrol.Options)) (*bedrockagentcorecontrol.DeleteAgentRuntimeEndpointOutput, error)
}
type CLI ¶
type CLI struct {
GlobalOption
Color bool `help:"enable colored output" default:"true" env:"ACRUN_COLOR" negatable:"" json:"color,omitempty"`
LogLevel string `help:"Log level" default:"info" enum:"debug,info,warn,error"`
LogFormat string `help:"Log format(text,json)" default:"text" enum:"text,json"`
Init InitOption `cmd:"" help:"Initialize acrun configuration."`
Invoke InvokeOption `cmd:"" help:"Invoke the agent."`
Diff DiffOption `cmd:"" help:"Diff the local and remote agent runtime."`
Deploy DeployOption `cmd:"" help:"Deploy the agent runtime."`
Render RenderOption `cmd:"" help:"Render the agent runtime configuration."`
Delete DeleteOption `cmd:"" help:"Delete the agent runtime."`
Rollback RollbackOption `cmd:"" help:"Rollback the agent runtime to a specific version."`
ECRImages ECRImagesOption `cmd:"ecr-images" help:"List ECR image URIs used by the agent runtime."`
Version struct{} `cmd:"" help:"Show version."`
}
type DeleteOption ¶
type DeleteOption struct {
DryRun bool `name:"dry-run" help:"dry run" default:"false"`
Force bool `name:"force" help:"force delete without confirmation" default:"false"`
WaitDuration time.Duration `name:"wait-duration" help:"maximum duration to wait until the agent runtime is ready" default:"30m"`
PollingInterval time.Duration `name:"polling-interval" help:"polling interval to check the agent runtime status" default:"5s"`
}
type DeployOption ¶
type DeployOption struct {
DryRun bool `name:"dry-run" help:"dry run" default:"false"`
EndpointName *string `name:"endpoint-name" help:"the endpoint name to deploy. if not specified, use the default endpoint."`
KeepVersions int `` /* 181-byte string literal not displayed */
WaitDuration time.Duration `name:"wait-duration" help:"maximum duration to wait until the agent runtime is ready" default:"30m"`
PollingInterval time.Duration `name:"polling-interval" help:"polling interval to check the agent runtime status" default:"5s"`
}
DeployOption holds the flags of the deploy command.
When KeepVersions is greater than zero, versions older than the newest KeepVersions are deleted after the endpoint has been updated. Versions that any endpoint references through its live or target version are always kept, so a version an endpoint was rolled back to is never deleted.
type DiffOption ¶
type ECRClient ¶
type ECRClient interface {
DescribeRepositories(ctx context.Context, params *ecr.DescribeRepositoriesInput, optFns ...func(*ecr.Options)) (*ecr.DescribeRepositoriesOutput, error)
}
type ECRImagesOption ¶ added in v0.8.0
type ECRImagesOption struct {
Versions int `help:"Number of recent versions to include." default:"5"`
}
ECRImagesOption represents the options for the ecr-images command.
type GlobalOption ¶
type GlobalOption struct {
AgentRuntime string `help:"Agent runtime file path" json:"agent_runtime,omitempty"`
TFState string `name:"tfstate" help:"Terraform state file URL (s3://... or local path)" env:"ACRUN_TFSTATE" json:"tfstate,omitempty"`
ExtStr map[string]string `help:"Set external string variable for Jsonnet VM" env:"ACRUN_EXTSTR" json:"ext_strs,omitempty"`
ExtCode map[string]string `help:"Set external code variable for Jsonnet VM" env:"ACRUN_EXTCODE" json:"ext_codes,omitempty"`
Verbose bool `name:"verbose" short:"v" help:"enable verbose logging" default:"false" json:"verbose,omitempty"`
Region string `name:"region" help:"AWS Region" env:"AWS_REGION,ACRUN_REGION" json:"region,omitempty"`
Profile string `name:"profile" help:"AWS CLI profile name" env:"AWS_PROFILE,ACRUN_PROFILE" json:"profile,omitempty"`
}
type InitOption ¶
type InitOption struct {
AgentRuntimeName string `help:"AgentRuntime name." required:"true"`
Qualifier *string `help:"the qualifier to initialize. if not specified, use the latest version." default:""`
Format string `help:"Output format. json or jsonnet" default:"jsonnet" enum:"json,jsonnet"`
ForceOverwrite bool `help:"Overwrite existing files without prompting" default:"false"`
}
type InvokeOption ¶
type InvokeOption struct {
Payload *string `help:"payload to invoke. if not specified, read from STDIN"`
ContentType *string `help:"The MIME type of the input data in the payload"`
Accept *string `help:"Accept header for the response"`
EndpointName *string `help:"the endpoint name to invoke. if not specified, use the CURRENT endpoint."`
MCPProtocolVersion *string `name:"mcp-proto-version" help:"The version of the MCP protocol being used."`
MCPSessionID *string `name:"mcp-session-id" help:"The identifier of the MCP session."`
RuntimeSessionID *string `name:"runtime-session-id" help:"The identifier of the runtime session."`
RuntimeUserID *string `name:"runtime-user-id" help:"The user identifier for the runtime session."`
Baggage *string `help:"Baggage for distributed tracing"`
TraceID *string `name:"trace-id" help:"The trace identifier for request tracking."`
TraceParent *string `name:"trace-parent" help:"The parent span identifier for distributed tracing."`
TraceState *string `name:"trace-state" help:"The state information for distributed tracing."`
}
type RenderOption ¶
type RenderOption struct {
Format string `help:"output format (json, jsonnet)" default:"json" enum:"json,jsonnet"`
}
type RollbackOption ¶
type RollbackOption struct {
DryRun bool `name:"dry-run" help:"dry run" default:"false"`
EndpointName *string `name:"endpoint-name" help:"the endpoint name to rollback. if not specified, use the default endpoint."`
Version *string `name:"version" help:"the version to rollback to. if not specified, rollback to current version - 1"`
}
type STSClient ¶
type STSClient interface {
GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
}