Skip to content

Commit 68945e4

Browse files
committed
Add endpoint rules and endpoint test to kitchensink model
1 parent e4deb65 commit 68945e4

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

codegen/kitchensink-test-codegen/model/main.smithy

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,78 @@ namespace aws.kitchensinktest
44
@aws.api#service(sdkId: "awsJson1 kitchen sink")
55
@aws.protocols#awsJson1_0
66
@aws.auth#sigv4(name: "awsjson1kitchensink")
7+
@smithy.rules#endpointRuleSet({
8+
version: "1.0",
9+
parameters: {
10+
Region: {
11+
type: "string",
12+
builtIn: "AWS::Region",
13+
required: true,
14+
documentation: "The AWS region"
15+
},
16+
Id: {
17+
type: "string",
18+
documentation: "The item id"
19+
}
20+
},
21+
rules: [
22+
{
23+
type: "endpoint",
24+
documentation: "id-specific endpoint",
25+
conditions: [
26+
{ fn: "isSet", argv: [{ ref: "Id" }] }
27+
],
28+
endpoint: {
29+
url: "https://{Id}.example.{Region}.amazonaws.com"
30+
}
31+
},
32+
{
33+
type: "endpoint",
34+
documentation: "Default regional endpoint",
35+
conditions: [],
36+
endpoint: {
37+
url: "https://example.{Region}.amazonaws.com"
38+
}
39+
}
40+
]
41+
})
42+
@smithy.rules#endpointTests({
43+
version: "1.0",
44+
testCases: [
45+
{
46+
documentation: "id-specific endpoint",
47+
params: {
48+
Region: "us-east-1",
49+
Id: "some-id"
50+
},
51+
operationInputs: [{
52+
operationName: "GetItem",
53+
"builtInParams": {
54+
"AWS::Region": "us-east-1"
55+
}
56+
operationParams: {
57+
id: "some-id",
58+
}
59+
}],
60+
expect: {
61+
endpoint: {
62+
url: "https://some-id.example.us-east-1.amazonaws.com"
63+
}
64+
}
65+
},
66+
{
67+
documentation: "Default endpoint when id is not set",
68+
params: {
69+
Region: "us-west-2"
70+
},
71+
expect: {
72+
endpoint: {
73+
url: "https://example.us-west-2.amazonaws.com"
74+
}
75+
}
76+
}
77+
]
78+
})
779
service AwsJson1KitchenSink {
880
version: "2025-03-01",
981
operations: [GetItem],
@@ -17,6 +89,8 @@ operation GetItem {
1789

1890
structure GetItemInput {
1991
item: Item,
92+
@smithy.rules#contextParam(name: "Id")
93+
id: String,
2094
}
2195

2296
structure GetItemOutput {}

0 commit comments

Comments
 (0)