Low-level, data-driven core of boto 3 providing foundational AWS service access.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Data-driven service models that define AWS service APIs, operations, and data structures. Models automatically update with AWS API changes and provide type definitions for request/response handling.
Core service model class containing AWS service definitions.
class ServiceModel:
def __init__(self, service_description: dict, service_name: str = None):
"""
Initialize service model.
Args:
service_description: Service definition dictionary
service_name: AWS service name override
"""
@property
def service_name(self) -> str:
"""AWS service name (e.g., 's3', 'ec2')."""
@property
def service_id(self) -> str:
"""AWS service identifier."""
@property
def api_version(self) -> str:
"""API version string."""
@property
def protocol(self) -> str:
"""Service protocol (e.g., 'rest-xml', 'json')."""
@property
def operation_names(self) -> List[str]:
"""List of available operation names."""
def operation_model(self, operation_name: str) -> OperationModel:
"""
Get operation model by name.
Args:
operation_name: AWS operation name
Returns:
OperationModel: Operation model object
"""Model for individual AWS service operations.
class OperationModel:
def __init__(self, operation_model: dict, service_model: ServiceModel):
"""
Initialize operation model.
Args:
operation_model: Operation definition dictionary
service_model: Parent service model
"""
@property
def name(self) -> str:
"""Operation name."""
@property
def input_shape(self) -> Shape:
"""Input parameters shape definition."""
@property
def output_shape(self) -> Shape:
"""Output response shape definition."""
@property
def error_shapes(self) -> List[Shape]:
"""List of possible error response shapes."""
@property
def http(self) -> dict:
"""HTTP method and URI information."""Data shape definitions for request/response structures.
class Shape:
"""Base shape class for all data types."""
def __init__(self, shape_name: str, type_name: str, shape_model: dict):
"""
Initialize shape.
Args:
shape_name: Name of the shape
type_name: Shape type name
shape_model: Shape definition dictionary
"""
@property
def name(self) -> str:
"""Shape name."""
@property
def type_name(self) -> str:
"""Shape type name."""
class StructureShape(Shape):
"""Complex structure with named members."""
@property
def members(self) -> dict:
"""Dictionary of member shapes."""
@property
def required_members(self) -> List[str]:
"""List of required member names."""
class ListShape(Shape):
"""Array/list shape."""
@property
def member(self) -> Shape:
"""Shape of list elements."""
class MapShape(Shape):
"""Dictionary/map shape."""
@property
def key(self) -> Shape:
"""Shape of map keys."""
@property
def value(self) -> Shape:
"""Shape of map values."""
class StringShape(Shape):
"""String type shape."""
@property
def enum(self) -> List[str]:
"""Allowed string values (if enumerated)."""from botocore.session import get_session
session = get_session()
service_model = session.get_service_model('s3')
print(f"Service: {service_model.service_name}")
print(f"API Version: {service_model.api_version}")
print(f"Operations: {len(service_model.operation_names)}")# Get operation model
op_model = service_model.operation_model('GetObject')
print(f"Operation: {op_model.name}")
print(f"HTTP Method: {op_model.http.get('method')}")
print(f"URI: {op_model.http.get('requestUri')}")
# Analyze input parameters
input_shape = op_model.input_shape
if input_shape:
print(f"Required params: {input_shape.required_members}")
for member_name, member_shape in input_shape.members.items():
print(f" {member_name}: {member_shape.type_name}")Install with Tessl CLI
npx tessl i tessl/pypi-botocore