1{
2    "version": "1.0",
3    "parameters": {
4        "Region": {
5            "builtIn": "AWS::Region",
6            "required": false,
7            "documentation": "The AWS region used to dispatch the request.",
8            "type": "String"
9        },
10        "UseFIPS": {
11            "builtIn": "AWS::UseFIPS",
12            "required": true,
13            "default": false,
14            "documentation": "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
15            "type": "Boolean"
16        },
17        "Endpoint": {
18            "builtIn": "SDK::Endpoint",
19            "required": false,
20            "documentation": "Override the endpoint used to send this request",
21            "type": "String"
22        }
23    },
24    "rules": [
25        {
26            "conditions": [
27                {
28                    "fn": "isSet",
29                    "argv": [
30                        {
31                            "ref": "Endpoint"
32                        }
33                    ]
34                }
35            ],
36            "type": "tree",
37            "rules": [
38                {
39                    "conditions": [
40                        {
41                            "fn": "booleanEquals",
42                            "argv": [
43                                {
44                                    "ref": "UseFIPS"
45                                },
46                                true
47                            ]
48                        }
49                    ],
50                    "error": "Invalid Configuration: FIPS and custom endpoint are not supported",
51                    "type": "error"
52                },
53                {
54                    "conditions": [],
55                    "endpoint": {
56                        "url": {
57                            "ref": "Endpoint"
58                        },
59                        "properties": {},
60                        "headers": {}
61                    },
62                    "type": "endpoint"
63                }
64            ]
65        },
66        {
67            "conditions": [
68                {
69                    "fn": "isSet",
70                    "argv": [
71                        {
72                            "ref": "Region"
73                        }
74                    ]
75                }
76            ],
77            "type": "tree",
78            "rules": [
79                {
80                    "conditions": [
81                        {
82                            "fn": "aws.partition",
83                            "argv": [
84                                {
85                                    "ref": "Region"
86                                }
87                            ],
88                            "assign": "PartitionResult"
89                        }
90                    ],
91                    "type": "tree",
92                    "rules": [
93                        {
94                            "conditions": [
95                                {
96                                    "fn": "booleanEquals",
97                                    "argv": [
98                                        true,
99                                        {
100                                            "fn": "getAttr",
101                                            "argv": [
102                                                {
103                                                    "ref": "PartitionResult"
104                                                },
105                                                "supportsDualStack"
106                                            ]
107                                        }
108                                    ]
109                                }
110                            ],
111                            "type": "tree",
112                            "rules": [
113                                {
114                                    "conditions": [
115                                        {
116                                            "fn": "booleanEquals",
117                                            "argv": [
118                                                {
119                                                    "ref": "UseFIPS"
120                                                },
121                                                true
122                                            ]
123                                        }
124                                    ],
125                                    "type": "tree",
126                                    "rules": [
127                                        {
128                                            "conditions": [
129                                                {
130                                                    "fn": "booleanEquals",
131                                                    "argv": [
132                                                        true,
133                                                        {
134                                                            "fn": "getAttr",
135                                                            "argv": [
136                                                                {
137                                                                    "ref": "PartitionResult"
138                                                                },
139                                                                "supportsFIPS"
140                                                            ]
141                                                        }
142                                                    ]
143                                                }
144                                            ],
145                                            "type": "tree",
146                                            "rules": [
147                                                {
148                                                    "conditions": [],
149                                                    "endpoint": {
150                                                        "url": "https://kendra-ranking-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
151                                                        "properties": {},
152                                                        "headers": {}
153                                                    },
154                                                    "type": "endpoint"
155                                                }
156                                            ]
157                                        },
158                                        {
159                                            "conditions": [],
160                                            "error": "FIPS is enabled but this partition does not support FIPS",
161                                            "type": "error"
162                                        }
163                                    ]
164                                },
165                                {
166                                    "conditions": [],
167                                    "endpoint": {
168                                        "url": "https://kendra-ranking.{Region}.{PartitionResult#dualStackDnsSuffix}",
169                                        "properties": {},
170                                        "headers": {}
171                                    },
172                                    "type": "endpoint"
173                                }
174                            ]
175                        },
176                        {
177                            "conditions": [
178                                {
179                                    "fn": "booleanEquals",
180                                    "argv": [
181                                        {
182                                            "ref": "UseFIPS"
183                                        },
184                                        true
185                                    ]
186                                }
187                            ],
188                            "type": "tree",
189                            "rules": [
190                                {
191                                    "conditions": [
192                                        {
193                                            "fn": "booleanEquals",
194                                            "argv": [
195                                                true,
196                                                {
197                                                    "fn": "getAttr",
198                                                    "argv": [
199                                                        {
200                                                            "ref": "PartitionResult"
201                                                        },
202                                                        "supportsFIPS"
203                                                    ]
204                                                }
205                                            ]
206                                        }
207                                    ],
208                                    "type": "tree",
209                                    "rules": [
210                                        {
211                                            "conditions": [],
212                                            "endpoint": {
213                                                "url": "https://kendra-ranking-fips.{Region}.{PartitionResult#dnsSuffix}",
214                                                "properties": {},
215                                                "headers": {}
216                                            },
217                                            "type": "endpoint"
218                                        }
219                                    ]
220                                },
221                                {
222                                    "conditions": [],
223                                    "error": "FIPS is enabled but this partition does not support FIPS",
224                                    "type": "error"
225                                }
226                            ]
227                        },
228                        {
229                            "conditions": [],
230                            "endpoint": {
231                                "url": "https://kendra-ranking.{Region}.{PartitionResult#dnsSuffix}",
232                                "properties": {},
233                                "headers": {}
234                            },
235                            "type": "endpoint"
236                        }
237                    ]
238                }
239            ]
240        },
241        {
242            "conditions": [],
243            "error": "Invalid Configuration: Missing Region",
244            "type": "error"
245        }
246    ]
247}