Skip to content

add AWS_RECOMMENDED as partitional endpoint pattern #2575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions docs/source-2.0/aws/aws-endpoints-region.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ Trait value
- Description
* - endpointPatternType
- ``string``
- **Required** The pattern type to use for the partition endpoint. This value can be set to ``service_dnsSuffix`` to
use the ``https://{service}.{dnsSuffix}`` pattern or ``service_region_dnsSuffix`` to use
``https://{service}.{region}.{dnsSuffix}``.
- **Required** The pattern type to use for the partition endpoint. This value should be set to ``aws_recommended`` in almost all cases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we still require this to be set? We could default to using recommended

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't have a strong preference. The only thing I had in mind was that it might lead to a small bug downstream in some code that expects it to always be nonnull if we miss changing it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - I dont have a strong preference either. Its more explicit to require it and the documentation here and on the trait itself makes it clear what to use.

* - partitionEndpointSpecialCases
- ``map`` of partition to `PartitionEndpointSpecialCase object`_
- A map of partition to partition endpoint special cases - partitions that do not follow the
Expand All @@ -282,13 +280,9 @@ Conflicts with
:ref:`aws.endpoints#standardRegionalEndpoints-trait`

Partitional services (also known as "global" services) resolve a single endpoint per partition.
That single endpoint is located in the partition's ``defaultGlobalRegion``. Partitional
services should follow one of two standard patterns:
That single endpoint is located in the partition's ``defaultGlobalRegion``.

- ``service_dnsSuffix``: ``https://{service}.{dnsSuffix}``
- ``service_region_dnsSuffix``: ``https://{service}.{region}.{dnsSuffix}``

The following example defines a partitional service that uses ``{service}.{dnsSuffix}``:
The following example defines a partitional service that uses AWS recommended patterns for each partition:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide documentation on what those are? At least for AWS partition. We provide a list of the "standard patterns" eg here: https://smithy.io/2.0/aws/aws-endpoints-region.html#aws-endpoints-standardregionalendpoints-trait

Copy link
Contributor Author

@rchache rchache Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fairly complex though, and currently only captured on an internal AWS document, which I don't think is fit for the public docs. If you think we should go the full mile and put the detailed pattern cases in the docs, we can do that though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And just adding aws partition is a little misleading since aws partition is itself nonstandard

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah thats fair - I think its reasonable to leave it unspecified here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone asks, we can presumably link them to the authoritative doc for clarity :)


.. code-block:: smithy

Expand All @@ -298,19 +292,19 @@ The following example defines a partitional service that uses ``{service}.{dnsSu

use aws.endpoints#standardPartitionalEndpoints

@standardPartitionalEndpoints(endpointPatternType: "service_dnsSuffix")
@standardPartitionalEndpoints(endpointPatternType: "aws_recommended")
service MyService {
version: "2020-04-02"
}

Services should follow the standard patterns; however, occasionally there are special cases.
Services should follow the standard patterns set by the DNS naming guidelines; however, occasionally there are special cases.
The following example defines a partitional service that uses a special case pattern in
the ``aws`` partition and uses a non-standard global region in the ``aws-cn`` partition:

.. code-block:: smithy

@standardPartitionalEndpoints(
endpointPatternType: "service_dnsSuffix",
endpointPatternType: "aws_recommended",
partitionEndpointSpecialCases: {
aws: [{endpoint: "https://myservice.global.amazonaws.com"}],
aws-cn: [{region: "cn-north-1"}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
*/
public enum EndpointPatternType {
/** An endpoint with pattern `{service}.{dnsSuffix}`.*/
@Deprecated
SERVICE_DNSSUFFIX("service_dnsSuffix"),

/** An endpoint with pattern `{service}.{region}.{dnsSuffix}`. */
SERVICE_REGION_DNSSUFFIX("service_region_dnsSuffix");
@Deprecated
SERVICE_REGION_DNSSUFFIX("service_region_dnsSuffix"),

/** Uses the up-to-date standards for each AWS partition */
AWS_RECOMMENDED("aws_recommended");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ structure standardPartitionalEndpoints {

@private
enum PartitionEndpointPattern {
@deprecated(since: "2025-04-01", message: "Not recommended to use. Use AWS_RECOMMENDED instead")
SERVICE_DNSSUFFIX = "service_dnsSuffix"
@deprecated(since: "2025-04-01", message: "Not recommended to use. Use AWS_RECOMMENDED instead")
SERVICE_REGION_DNSSUFFIX = "service_region_dnsSuffix"
AWS_RECOMMENDED = "aws_recommended"
}

@private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ public void loadsFromModel() {
assertEquals(case2.getDualStack(), true);
assertEquals(case2.getRegion(), "us-west-2");
assertNull(case2.getFips());

trait = getTraitFromService(model, "ns.foo#Service3");

assertEquals(trait.getEndpointPatternType(), EndpointPatternType.AWS_RECOMMENDED);
assertEquals(trait.getPartitionEndpointSpecialCases().size(), 1);

cases = trait.getPartitionEndpointSpecialCases().get("aws");

case1 = cases.get(0);
assertEquals(case1.getEndpoint(), "https://myservice.{dnsSuffix}");
assertEquals(case1.getRegion(), "us-west-2");
assertNull(case1.getDualStack());
assertNull(case1.getFips());
}

private StandardPartitionalEndpointsTrait getTraitFromService(Model model, String service) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ service Service1 {
service Service2 {
version: "2021-06-29"
}

@standardPartitionalEndpoints(
endpointPatternType: "aws_recommended",
partitionEndpointSpecialCases: {
"aws": [
{
endpoint: "https://myservice.{dnsSuffix}",
region: "us-west-2"
},
]
}
)
service Service3 {
version: "2025-01-01"
}
Loading