Skip to content

Commit

Permalink
Feature: Bedrock and Bedrock Agents (#7597)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLevyMN authored Apr 27, 2024
1 parent 636d508 commit f58a575
Show file tree
Hide file tree
Showing 16 changed files with 3,435 additions and 0 deletions.
2 changes: 2 additions & 0 deletions moto/backend_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
("backup", re.compile("https?://backup\\.(.+)\\.amazonaws\\.com")),
("batch", re.compile("https?://batch\\.(.+)\\.amazonaws.com")),
("budgets", re.compile("https?://budgets\\.amazonaws\\.com")),
("bedrock", re.compile("https?://bedrock\\.(.+)\\.amazonaws\\.com")),
("bedrockagent", re.compile("https?://bedrock-agent\\.(.+)\\.amazonaws\\.com")),
("ce", re.compile("https?://ce\\.(.+)\\.amazonaws\\.com")),
("cloudformation", re.compile("https?://cloudformation\\.(.+)\\.amazonaws\\.com")),
("cloudfront", re.compile("https?://cloudfront\\.amazonaws\\.com")),
Expand Down
10 changes: 10 additions & 0 deletions moto/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from moto.autoscaling.models import AutoScalingBackend
from moto.awslambda.models import LambdaBackend
from moto.batch.models import BatchBackend
from moto.bedrock.models import BedrockBackend
from moto.bedrockagent.models import AgentsforBedrockBackend
from moto.budgets.models import BudgetsBackend
from moto.ce.models import CostExplorerBackend
from moto.cloudformation.models import CloudFormationBackend
Expand Down Expand Up @@ -182,6 +184,8 @@ def get_service_from_url(url: str) -> Optional[str]:
"Literal['athena']",
"Literal['autoscaling']",
"Literal['batch']",
"Literal['bedrock']",
"Literal['bedrock-agent']",
"Literal['budgets']",
"Literal['ce']",
"Literal['cloudformation']",
Expand Down Expand Up @@ -344,6 +348,12 @@ def get_backend(
@overload
def get_backend(name: "Literal['batch']") -> "BackendDict[BatchBackend]": ...
@overload
def get_backend(name: "Literal['bedrock']") -> "BackendDict[BedrockBackend]": ...
@overload
def get_backend(
name: "Literal['bedrock-agent']",
) -> "BackendDict[AgentsforBedrockBackend]": ...
@overload
def get_backend(name: "Literal['budgets']") -> "BackendDict[BudgetsBackend]": ...
@overload
def get_backend(name: "Literal['ce']") -> "BackendDict[CostExplorerBackend]": ...
Expand Down
1 change: 1 addition & 0 deletions moto/bedrock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .models import bedrock_backends # noqa: F401
33 changes: 33 additions & 0 deletions moto/bedrock/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Exceptions raised by the bedrock service."""

from moto.core.exceptions import JsonRESTError

# Bedrock.Client.exceptions.ResourceNotFoundException


class BedrockClientError(JsonRESTError):
code = 400


class ResourceNotFoundException(BedrockClientError):
def __init__(self, msg: str):
super().__init__("ResourceNotFoundException", f"{msg}")


class ResourceInUseException(BedrockClientError):
def __init__(self, msg: str):
super().__init__("ResourceInUseException", f"{msg}")


class ValidationException(BedrockClientError):
def __init__(self, msg: str):
super().__init__(
"ValidationException",
"Input validation failed. Check your request parameters and retry the request.",
f"{msg}",
)


class TooManyTagsException(BedrockClientError):
def __init__(self, msg: str):
super().__init__("TooManyTagsException", f"{msg}")
Loading

0 comments on commit f58a575

Please sign in to comment.