bedrockagentcorecontrol

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 49 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Bedrockagentcorecontrol

Parity grade: B · SDK aws-sdk-go-v2/service/bedrockagentcorecontrol@v1.73.0 · last audited 2026-10-22 (71065ec09)

Coverage

Metric Value
PARITY entries audited 171 (171 ok)
Feature families 14 (14 ok)
Known gaps 6
Structural gaps (can't be emulated) 3
Deferred items 0
Resource leaks clean
Known gaps
  • Gateway MCP endpoint: Smithy model and connector targets expose no tools (mcp_tools.go:168 returns errUnsupportedTarget). A Smithy tool call needs a per-protocol (restJson1, awsJson1_0/1_1, restXml, query) request builder and signer against the AWS service endpoint, and the connector catalogue (bedrock-knowledge-bases and others) is vendor-internal with no retrieval service behind it (no services/bedrockagentruntime)
  • Gateway targets: CreateGatewayTarget does not auto-synchronize MCP server targets (tools are discovered at tools/list or on SynchronizeGatewayTargets)
  • Authorizers: AWS_IAM verifies the SigV4 signature (secret from --sigv4-secret) but evaluates no IAM or resource policy, so every valid signature is authorized; IAM roles named in requests are checked for existence only, never for trust or permissions
  • Nested validation: deeper member constraints are still accepted as sent for Smithy model contents, VPC endpoint overrides (privateEndpointOverrides member shapes) and the harness, evaluator and policy-engine configuration unions
  • Failure states: CREATE_FAILED and UPDATE_FAILED are reached by dataset S3 sources and gateway targets whose OAuth authorization endpoint cannot be resolved (FAILED); no other asynchronous failure is modeled
  • Quotas: resource-count limits, memory strategies per memory, environment variable size, inline and S3 schema size, tools per target and tool name length are enforced, but request-rate limits (TPS throttling per API), configuration bundle (5 MB), policy size (10 KB, 200 KB) and resource policy (20 KB, 100 statements) limits and the active-concurrency limits (batch evaluation, AB tests, recommendations) are not; no ThrottlingException is ever returned
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • Gateway semantic tool search: real search embeds tool text with a model; the emulator ranks lexically with BM25, so a tool sharing no term with the query is not returned
  • StartPolicyGeneration: deriving Cedar from natural language needs a generative model, so every generation ends GENERATE_FAILED with no assets
  • Evaluators and online evaluation configs: evaluation needs a model and live agent traces, so configurations are validated and stored but never run

More

Documentation

Overview

Package bedrockagentcorecontrol emulates the Amazon Bedrock AgentCore control plane.

Index

Constants

This section is empty.

Variables

View Source
var ErrRestAPIHostUnavailable = errors.New("API Gateway is not available")

ErrRestAPIHostUnavailable is returned by a RestAPIHost that has no API Gateway behind it.

Functions

This section is empty.

Types

type AuthSession

type AuthSession struct {
	Created      time.Time `json:"created"`
	Expires      time.Time `json:"expires"`
	ID           string    `json:"id"`
	State        string    `json:"state"`
	Account      string    `json:"account"`
	Region       string    `json:"region"`
	Kind         string    `json:"kind"`
	ProviderID   string    `json:"providerId"`
	GatewayID    string    `json:"gatewayId,omitempty"`
	TargetID     string    `json:"targetId,omitempty"`
	UserID       string    `json:"userId"`
	ReturnURL    string    `json:"returnUrl,omitempty"`
	CustomState  string    `json:"customState,omitempty"`
	Status       string    `json:"status"`
	AccessToken  string    `json:"accessToken,omitempty"`
	RefreshToken string    `json:"refreshToken,omitempty"`
	Scopes       []string  `json:"scopes,omitempty"`
	Bound        bool      `json:"bound,omitempty"`
}

AuthSession is one three-legged OAuth authorization of a gateway target or of a workload user.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	DefaultRegion string
	// contains filtered or unexported fields
}

Handler serves the AgentCore control-plane REST-JSON API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions lists the regions this handler serves.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the resource ARN or identifier the request addresses.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists every implemented operation.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend is the AgentCore control-plane state; one coarse lock guards every table.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the default account.

func (*InMemoryBackend) DataPlane

func (b *InMemoryBackend) DataPlane() dataplane.Control

DataPlane returns the seam the AgentCore data plane resolves control-plane resources through.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default Region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) SetAllowExternalTargets

func (b *InMemoryBackend) SetAllowExternalTargets(allow bool)

SetAllowExternalTargets lets gateway targets and JWKS fetches reach hosts outside loopback.

func (*InMemoryBackend) SetJWKSProvider

func (b *InMemoryBackend) SetJWKSProvider(p JWKSProvider)

SetJWKSProvider resolves signing keys of issuers hosted by the emulator (Cognito user pools).

func (*InMemoryBackend) SetKeyChecker

func (b *InMemoryBackend) SetKeyChecker(c cmek.KeyChecker)

SetKeyChecker resolves kmsKeyArn and encryptionKeyArn members against AWS KMS; nil disables the lookup.

func (*InMemoryBackend) SetLifecycleDelay

func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)

SetLifecycleDelay keeps resources in CREATING, UPDATING and DELETING for d; zero settles immediately.

func (*InMemoryBackend) SetReferences

func (b *InMemoryBackend) SetReferences(r References)

SetReferences wires lookups of resources owned by other services.

func (*InMemoryBackend) SetSigV4Secret

func (b *InMemoryBackend) SetSigV4Secret(secret string)

SetSigV4Secret sets the secret AWS_IAM gateways verify request signatures against.

func (*InMemoryBackend) SetTrustedRoots

func (b *InMemoryBackend) SetTrustedRoots(extra *x509.CertPool)

SetTrustedRoots adds CAs trusted (besides the system roots) by outbound gateway target, JWKS and OAuth requests.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state.

func (*InMemoryBackend) VerifyUserJWT

func (b *InMemoryBackend) VerifyUserJWT(ctx context.Context, token string) (string, error)

VerifyUserJWT verifies a user token's signature against the JWKS of its issuer and returns its subject. The issuer is read from the unverified token, so the JWKS is fetched only from loopback unless external targets are enabled.

type JWKSProvider

type JWKSProvider interface {
	GetJWTPublicKey(issuerURL, kid string) (*rsa.PublicKey, error)
}

JWKSProvider resolves RSA signing keys of issuers hosted by the emulator (Cognito user pools).

type LambdaInvoker

type LambdaInvoker interface {
	InvokeLambda(ctx context.Context, functionARN, clientContext string, payload []byte) (
		result []byte, functionError string, err error)
}

LambdaInvoker runs a Lambda function in-process; functionError is the X-Amz-Function-Error value.

type ObjectChecker

type ObjectChecker interface {
	ObjectExists(bucket, key string) bool
}

ObjectChecker is the optional References extension that tests an S3 object exists without reading it.

type Provider

type Provider struct{}

Provider implements service.Provider for the Bedrock AgentCore control plane.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type References

type References interface {
	ECRRepositoryExists(account, region, repository string) bool
	LambdaFunctionExists(arn string) bool
	SecretExists(arn string) bool
	// ReadObjectUpTo reads at most limit bytes; an object larger than limit is reported as tooLarge, not buffered.
	ReadObjectUpTo(bucket, key string, limit int64) (data []byte, found, tooLarge bool)
}

References resolves resources owned by other emulated services; nil members skip the check.

type Resource

type Resource struct {
	Created    time.Time         `json:"created"`
	Updated    time.Time         `json:"updated"`
	SettleAt   time.Time         `json:"settleAt"`
	Doc        map[string]any    `json:"doc"`
	Tags       map[string]string `json:"tags,omitempty"`
	Aux        map[string]any    `json:"aux,omitempty"`
	Account    string            `json:"account"`
	Region     string            `json:"region"`
	Kind       string            `json:"kind"`
	Parent     string            `json:"parent,omitempty"`
	ParentARN  string            `json:"parentArn,omitempty"`
	ID         string            `json:"id"`
	ARN        string            `json:"arn,omitempty"`
	Status     string            `json:"status,omitempty"`
	Transition string            `json:"transition,omitempty"`
	Versions   []Version         `json:"versions,omitempty"`
	Deleting   bool              `json:"deleting,omitempty"`
	System     bool              `json:"system,omitempty"`
}

Resource is one AgentCore control-plane resource. Doc holds the caller-supplied members verbatim (JSON-decoded); server-assigned identity, status, timestamps and tags live in typed fields.

func (*Resource) Aux2

func (r *Resource) Aux2() map[string]any

Aux2 returns the auxiliary map, never nil.

type ResourcePolicy

type ResourcePolicy struct {
	ARN    string `json:"arn"`
	Policy string `json:"policy"`
}

ResourcePolicy is the resource-based policy attached to a runtime, endpoint or gateway ARN.

type RestAPIHost

type RestAPIHost interface {
	RestAPIExport(region, restAPIID, stage string) (map[string]any, error)
	InvokeRestAPI(ctx context.Context, region string, req RestAPIRequest) (RestAPIResponse, error)
}

RestAPIHost reaches REST APIs of the emulated API Gateway: it exports a stage as OpenAPI 3 and serves a request through the stage's data-plane path.

type RestAPIRequest

type RestAPIRequest struct {
	Headers map[string]string
	Query   map[string]string
	APIID   string
	Stage   string
	Method  string
	Path    string
	Body    []byte
}

RestAPIRequest is an in-process call to a REST API stage.

type RestAPIResponse

type RestAPIResponse struct {
	Body   []byte
	Status int
}

RestAPIResponse is the stage's reply.

type RoleChecker

type RoleChecker interface {
	RoleExists(roleARN string) bool
}

RoleChecker is the optional References extension that verifies IAM roles exist.

type SecretStore

type SecretStore interface {
	PutSecret(account, region, name, value string) (string, error)
	GetSecret(arn string) (string, bool)
	DeleteSecret(arn string)
}

SecretStore is the optional References extension that persists credential provider secrets in Secrets Manager.

type TokenVault

type TokenVault struct {
	Modified time.Time      `json:"modified"`
	KMS      map[string]any `json:"kms"`
	Key      string         `json:"key"`
}

TokenVault is the per-account token vault configuration.

type Version

type Version struct {
	Created time.Time      `json:"created"`
	Doc     map[string]any `json:"doc"`
	ID      string         `json:"id"`
	Branch  string         `json:"branch,omitempty"`
	Parents []string       `json:"parents,omitempty"`
}

Version is an immutable snapshot taken on create and on every update of a versioned resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL