.. index:: single: s3_endpoints
.. _s3_endpoints/0:

.. rst-class:: right

**object**

``s3_endpoints``
================

Endpoint and canonical-URI helpers for S3-compatible services.

| **Availability:** 
|    ``logtalk_load(s3(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-07-09

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`options <options/0>`
| **Uses:**
|    :ref:`list <list/0>`
|    :ref:`url(Representation) <url/1>`
|    :ref:`user <user/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: request/6
.. _s3_endpoints/0::request/6:

``request/6``
^^^^^^^^^^^^^

Builds the request base URL plus signing endpoint context for an S3 operation.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``request(Operation,Bucket,Key,URL,Endpoint,Options)``
| **Mode and number of proofs:**
|    ``request(+atom,@atom,@atom,-atom,-compound,+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Operation`` is not a supported S3 operation:
|        ``domain_error(s3_operation,Operation)``
|    ``Bucket`` is a variable:
|        ``instantiation_error``
|    ``Bucket`` is neither a variable not a valid bucket:
|        ``domain_error(s3_request,Bucket)``
|    ``Key`` is a variable:
|        ``instantiation_error``
|    ``Key`` is neither a variable not a valid key:
|        ``domain_error(s3_request,Key)``
|    ``Options`` contains an invalid endpoint or addressing style:
|        ``domain_error(s3_endpoint,Endpoint)``

| **Remarks:**

    - Option ``region/1``: AWS region to use when ``endpoint/1`` is absent. Defaults to ``us-east-1``.
    - Option ``endpoint/1``: Optional custom S3-compatible base endpoint URL, which may include a path prefix.
    - Option ``addressing_style/1``: Endpoint addressing style, either ``virtual_hosted`` or ``path``. Defaults to ``virtual_hosted``.


------------

.. index:: canonical_uri/4
.. _s3_endpoints/0::canonical_uri/4:

``canonical_uri/4``
^^^^^^^^^^^^^^^^^^^

Returns the canonical request URI for an S3 operation using the selected endpoint style.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``canonical_uri(Operation,Bucket,Key,CanonicalURI)``
| **Mode and number of proofs:**
|    ``canonical_uri(+atom,@atom,@atom,-atom)`` - ``one_or_error``

| **Exceptions:**
|    ``Operation`` is not a supported S3 operation:
|        ``domain_error(s3_operation,Operation)``
|    ``Bucket`` is a variable:
|        ``instantiation_error``
|    ``Bucket`` is neither a variable not a valid bucket:
|        ``domain_error(s3_request,Bucket)``
|    ``Key`` is a variable:
|        ``instantiation_error``
|    ``Key`` is neither a variable not a valid key:
|        ``domain_error(s3_request,Key)``


------------

.. index:: canonical_uri/5
.. _s3_endpoints/0::canonical_uri/5:

``canonical_uri/5``
^^^^^^^^^^^^^^^^^^^

Returns the canonical request URI for an S3 operation using an explicit endpoint context.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``canonical_uri(Operation,Context,Bucket,Key,CanonicalURI)``
| **Mode and number of proofs:**
|    ``canonical_uri(+atom,+compound,@atom,@atom,-atom)`` - ``one_or_error``

| **Exceptions:**
|    ``Operation`` is not a supported S3 operation:
|        ``domain_error(s3_operation,Operation)``
|    ``Context`` is not a valid endpoint context:
|        ``domain_error(s3_endpoint,Context)``
|    ``Bucket`` is a variable:
|        ``instantiation_error``
|    ``Bucket`` or ``Key`` is invalid for the operation:
|        ``domain_error(s3_request,Argument)``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

