Skip to content

Commit 6f02795

Browse files
authored
Add AWS_RECOMMENDED as partitional endpoint pattern (#2575)
1 parent 1537b84 commit 6f02795

File tree

5 files changed

+43
-13
lines changed

5 files changed

+43
-13
lines changed

docs/source-2.0/aws/aws-endpoints-region.rst

+6-12
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,7 @@ Trait value
269269
- Description
270270
* - endpointPatternType
271271
- ``string``
272-
- **Required** The pattern type to use for the partition endpoint. This value can be set to ``service_dnsSuffix`` to
273-
use the ``https://{service}.{dnsSuffix}`` pattern or ``service_region_dnsSuffix`` to use
274-
``https://{service}.{region}.{dnsSuffix}``.
272+
- **Required** The pattern type to use for the partition endpoint. This value should be set to ``aws_recommended`` in almost all cases.
275273
* - partitionEndpointSpecialCases
276274
- ``map`` of partition to `PartitionEndpointSpecialCase object`_
277275
- A map of partition to partition endpoint special cases - partitions that do not follow the
@@ -282,13 +280,9 @@ Conflicts with
282280
:ref:`aws.endpoints#standardRegionalEndpoints-trait`
283281

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

288-
- ``service_dnsSuffix``: ``https://{service}.{dnsSuffix}``
289-
- ``service_region_dnsSuffix``: ``https://{service}.{region}.{dnsSuffix}``
290-
291-
The following example defines a partitional service that uses ``{service}.{dnsSuffix}``:
285+
The following example defines a partitional service that uses AWS recommended patterns for each partition:
292286

293287
.. code-block:: smithy
294288
@@ -298,19 +292,19 @@ The following example defines a partitional service that uses ``{service}.{dnsSu
298292
299293
use aws.endpoints#standardPartitionalEndpoints
300294
301-
@standardPartitionalEndpoints(endpointPatternType: "service_dnsSuffix")
295+
@standardPartitionalEndpoints(endpointPatternType: "aws_recommended")
302296
service MyService {
303297
version: "2020-04-02"
304298
}
305299
306-
Services should follow the standard patterns; however, occasionally there are special cases.
300+
Services should follow the standard patterns set by the DNS naming guidelines; however, occasionally there are special cases.
307301
The following example defines a partitional service that uses a special case pattern in
308302
the ``aws`` partition and uses a non-standard global region in the ``aws-cn`` partition:
309303

310304
.. code-block:: smithy
311305
312306
@standardPartitionalEndpoints(
313-
endpointPatternType: "service_dnsSuffix",
307+
endpointPatternType: "aws_recommended",
314308
partitionEndpointSpecialCases: {
315309
aws: [{endpoint: "https://myservice.global.amazonaws.com"}],
316310
aws-cn: [{region: "cn-north-1"}]

smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/traits/EndpointPatternType.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
*/
1313
public enum EndpointPatternType {
1414
/** An endpoint with pattern `{service}.{dnsSuffix}`.*/
15+
@Deprecated
1516
SERVICE_DNSSUFFIX("service_dnsSuffix"),
1617

1718
/** An endpoint with pattern `{service}.{region}.{dnsSuffix}`. */
18-
SERVICE_REGION_DNSSUFFIX("service_region_dnsSuffix");
19+
@Deprecated
20+
SERVICE_REGION_DNSSUFFIX("service_region_dnsSuffix"),
21+
22+
/** Uses the up-to-date standards for each AWS partition */
23+
AWS_RECOMMENDED("aws_recommended");
1924

2025
private final String name;
2126

smithy-aws-endpoints/src/main/resources/META-INF/smithy/aws.endpoints.smithy

+3
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ structure standardPartitionalEndpoints {
106106

107107
@private
108108
enum PartitionEndpointPattern {
109+
@deprecated(since: "2025-04-01", message: "Not recommended to use. Use AWS_RECOMMENDED instead")
109110
SERVICE_DNSSUFFIX = "service_dnsSuffix"
111+
@deprecated(since: "2025-04-01", message: "Not recommended to use. Use AWS_RECOMMENDED instead")
110112
SERVICE_REGION_DNSSUFFIX = "service_region_dnsSuffix"
113+
AWS_RECOMMENDED = "aws_recommended"
111114
}
112115

113116
@private

smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/traits/StandardPartitionalEndpointsTraitTest.java

+13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ public void loadsFromModel() {
4646
assertEquals(case2.getDualStack(), true);
4747
assertEquals(case2.getRegion(), "us-west-2");
4848
assertNull(case2.getFips());
49+
50+
trait = getTraitFromService(model, "ns.foo#Service3");
51+
52+
assertEquals(trait.getEndpointPatternType(), EndpointPatternType.AWS_RECOMMENDED);
53+
assertEquals(trait.getPartitionEndpointSpecialCases().size(), 1);
54+
55+
cases = trait.getPartitionEndpointSpecialCases().get("aws");
56+
57+
case1 = cases.get(0);
58+
assertEquals(case1.getEndpoint(), "https://myservice.{dnsSuffix}");
59+
assertEquals(case1.getRegion(), "us-west-2");
60+
assertNull(case1.getDualStack());
61+
assertNull(case1.getFips());
4962
}
5063

5164
private StandardPartitionalEndpointsTrait getTraitFromService(Model model, String service) {

smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/traits/standardPartitionalEndpoints.smithy

+15
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,18 @@ service Service1 {
2929
service Service2 {
3030
version: "2021-06-29"
3131
}
32+
33+
@standardPartitionalEndpoints(
34+
endpointPatternType: "aws_recommended",
35+
partitionEndpointSpecialCases: {
36+
"aws": [
37+
{
38+
endpoint: "https://myservice.{dnsSuffix}",
39+
region: "us-west-2"
40+
},
41+
]
42+
}
43+
)
44+
service Service3 {
45+
version: "2025-01-01"
46+
}

0 commit comments

Comments
 (0)