Skip to content

aws_lib: Consider migrating API from list strings to binaries #86

Description

@lukebakken

Problem

aws_lib uses Erlang list strings throughout its API (headers, paths, regions, credentials, etc.). aws-erlang and the broader Erlang ecosystem (Gun, hackney, uri_string) use binaries. This means aws_lib must convert between binaries and lists at every boundary:

  • direct_gun_request converts all header keys/values to binary before sending
  • aws_lib_json:decode converts all thoas binary output back to list strings
  • aws_lib_config:parse_credentials_response converts binary JSON values to lists
  • Callers working with modern Erlang libraries must convert to lists before calling aws_lib

This creates unnecessary allocations and makes interop awkward.

Context

The original rabbitmq_aws was written for httpc which uses list strings. The migration to Gun already requires binary conversion at the transport layer. The JSON library (thoas) returns binaries natively.

Proposed behavior

Move to binaries for the public API. This is a breaking change but the library is pre-alpha with no external consumers yet.

Key areas:

  • Headers: [{binary(), binary()}]
  • Paths, service names, regions: binary()
  • Credentials: binary()
  • Response bodies from JSON/XML: return native types (maps with binary keys from thoas, or keep proplists but with binary values)

This eliminates the conversion layers and aligns with Gun, uri_string, and thoas natively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aws-libArea: The imported aws_lib HTTP client and credential resolution.C-refactorCategory: Code restructuring without behavior changeE-largeEffort: Hard. Thorough code-base knowledge and high-level vision required.P-lowPriority: Low. Minor; can wait.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions