Skip to content

graflo.object_storage.s3_client

Shared boto3 S3 client construction.

Classes

Functions:

boto3_s3_client(cfg)

Build a boto3 S3 client from :class:~graflo.connections.sources.S3ConnConfig.

Source code in graflo/object_storage/s3_client.py
def boto3_s3_client(cfg: S3ConnConfig) -> Any:
    """Build a boto3 S3 client from :class:`~graflo.connections.sources.S3ConnConfig`."""
    import boto3

    return boto3.client(
        "s3",
        region_name=cfg.region or None,
        endpoint_url=cfg.endpoint_url or None,
        aws_access_key_id=cfg.aws_access_key_id or None,
        aws_secret_access_key=cfg.aws_secret_access_key or None,
    )

boto3_s3_client_from_endpoint(cfg)

Build a boto3 S3 client from :class:~graflo.object_storage.config.S3EndpointConfig.

Source code in graflo/object_storage/s3_client.py
def boto3_s3_client_from_endpoint(cfg: S3EndpointConfig) -> Any:
    """Build a boto3 S3 client from :class:`~graflo.object_storage.config.S3EndpointConfig`."""
    import boto3

    return boto3.client(
        "s3",
        region_name=cfg.region or None,
        endpoint_url=cfg.endpoint_url or None,
        aws_access_key_id=cfg.access_key,
        aws_secret_access_key=cfg.secret_key,
    )