Commit Graph
6 Commits
Author SHA1 Message Date
Niels Kootstra 30db535f2e feat(bedrock): list and get foundation models and system-defined inference profiles (#7675)
* feat(bedrock): list and get foundation models and system-defined inference profiles

fix(bedrock): resolve only ARNs that name the catalog resource in the calling Region, and report on-demand inference only where a model is served in-Region

fix(bedrock): accept SPEECH and VIDEO output modalities and refuse an unserved model with ValidationException

fix(bedrock): report enum violations and read the model catalog through the shared helpers

An invalid ListFoundationModels or ListInferenceProfiles enum value now
answers with the "1 validation error detected:" prefix AWS sends and
lists the allowed values in the model's order.

* fix(bedrock): answer an unresolvable model or profile identifier with the error AWS returns

GetFoundationModel answers an unknown model id or an ARN that names no
foundation model in the calling Region with ValidationException.
GetInferenceProfile answers an ARN of another service or without an
account with ValidationException, and one of another account with
AccessDeniedException; one of another Region stays ResourceNotFoundException.
2026-11-08 05:02:41 -04:00
galsuchetzky-act a69b3621a0 feat(bedrock): store resource-based policies on guardrail profiles (#7208)
AWS lets a system-defined guardrail profile carry a resource-based
policy as well as a guardrail, and a guardrail with cross-Region
inference is shared only once each destination-Region profile ARN
carries one. The policy is stored in the Region whose endpoint
received PutResourcePolicy, under the ARN passed, so GetResourcePolicy
on a profile ARN through an endpoint that stored nothing returns {}.
A profile policy may allow only bedrock:ApplyGuardrail:
https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-resource-based-policies.html

PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy now
accept a guardrail-profile ARN. Its policy is stored per calling Region
and profile ARN, GetResourcePolicy returns {} when that pair holds
none, and DeleteResourcePolicy clears only that pair. PutResourcePolicy
holds the policy to the guardrail language with bedrock:ApplyGuardrail
as the only action. A profile ARN of another account or partition, or
whose profile id is not of the form <prefix>.guardrail.v<N>:<M>, is
ResourceNotFoundException. Which destination Regions are valid for the
calling Region is not checked, and the policy is not evaluated against
callers.

Closes #6671
2026-11-02 09:01:14 -04:00
galsuchetzky-act b987e822be feat(bedrock): add PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy for guardrails (#7188) 2026-11-01 08:23:49 -04:00
berce c4ad788e62 fix(bedrock): list guardrails in the tagging api and route its writes (#6646)
* fix(bedrock): list guardrails in the tagging api and route its writes

guardrails were not a ResourceProvider, so GetResources with bedrock:guardrail came back empty, and TagResources had no bedrock handler to forward to. list the draft of each guardrail with its own tags and add a tagging-api-only handler that calls the existing tag methods.

* test(bedrock): cover guardrail discovery and tagging writes with the sdk
2026-10-26 12:05:47 -04:00
Aniket Shukla 589a6a91f7 fix(bedrock): validate guardrail ARNs for tag actions (#6342) 2026-10-23 09:41:24 -04:00
lex00 cae8f9a013 feat(bedrock): add guardrail lifecycle and versions (#3380)
* feat(bedrock): add guardrail lifecycle and versions

Amazon Bedrock control plane over REST JSON: CreateGuardrail through
DeleteGuardrail, CreateGuardrailVersion, ListGuardrails with pagination, and
resource tagging on /tagResource, /untagResource and /listTagsForResource.
Guardrails report READY on the first read, so the Terraform provider's status
poll for aws_bedrock_guardrail completes without a transition.

The control plane and bedrock-runtime both sign as "bedrock". The runtime
descriptor keeps that credential scope, and the new descriptor routes through
its resource class, which ServiceEnabledFilter checks first.

Policy blocks are stored under the read-shape member names, so a *Config
submitted on create or update reads back unsuffixed. ListGuardrails honours
maxResults and nextToken, and DeleteGuardrail rejects a guardrailVersion that
is not a GuardrailNumericalVersion.

* fix(bedrock): enforce guardrail length caps and resolve kmsKeyId to a key ARN

The AWS model caps description at 200 characters and both blockedInputMessaging
and blockedOutputsMessaging at 500, each with a minimum of 1. None of those were
checked, so an over-long value was stored and read back. name was already bounded
by its [0-9a-zA-Z-_]{1,50} pattern.

kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key
ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn,
which is only ever the full key ARN. The request value was echoed back verbatim,
so a bare key id or an alias produced a response that does not match the shape
GetGuardrail declares. It now resolves through KmsService.describeKey, the same
way RDS, DocDB and ElastiCache already resolve their KmsKeyId, and a key that is
missing, disabled or pending deletion is rejected with ValidationException.

* test(bedrock): drive the guardrail lifecycle from the AWS SDK v2 client

Adds the bedrock SDK module to the compatibility project, a BedrockClient
factory on TestFixtures, and a BedrockGuardrailTest covering create, read,
update, versioning, listing, tagging and delete. The test also submits kmsKeyId
as a bare key id and as an alias and asserts both read back as the same full KMS
key ARN.

* fix(bedrock): enforce the guardrail tag caps from the AWS model

The AWS model gives TagList a max of 200 items, and that shape backs the tags
member of both CreateGuardrail and TagResource. TooManyTagsException, declared
on both operations, documents a separate limit of 50 tags per resource counted
over the tags already on the resource together with the ones in the request.

parseTagList now rejects an array over 200 items with ValidationException, and
it moved to BedrockService so both entry points share it. CreateGuardrail and
TagResource raise TooManyTagsException once the total the guardrail would be
left holding passes 50, carrying resourceName as the model declares.
2026-09-11 20:36:45 -04:00