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            "rules": [
37                {
38                    "conditions": [
39                        {
40                            "fn": "booleanEquals",
41                            "argv": [
42                                {
43                                    "ref": "UseFIPS"
44                                },
45                                true
46                            ]
47                        }
48                    ],
49                    "error": "Invalid Configuration: FIPS and custom endpoint are not supported",
50                    "type": "error"
51                },
52                {
53                    "conditions": [],
54                    "endpoint": {
55                        "url": {
56                            "ref": "Endpoint"
57                        },
58                        "properties": {},
59                        "headers": {}
60                    },
61                    "type": "endpoint"
62                }
63            ],
64            "type": "tree"
65        },
66        {
67            "conditions": [
68                {
69                    "fn": "isSet",
70                    "argv": [
71                        {
72                            "ref": "Region"
73                        }
74                    ]
75                }
76            ],
77            "rules": [
78                {
79                    "conditions": [
80                        {
81                            "fn": "aws.partition",
82                            "argv": [
83                                {
84                                    "ref": "Region"
85                                }
86                            ],
87                            "assign": "PartitionResult"
88                        }
89                    ],
90                    "rules": [
91                        {
92                            "conditions": [
93                                {
94                                    "fn": "stringEquals",
95                                    "argv": [
96                                        {
97                                            "fn": "getAttr",
98                                            "argv": [
99                                                {
100                                                    "ref": "PartitionResult"
101                                                },
102                                                "name"
103                                            ]
104                                        },
105                                        "aws"
106                                    ]
107                                }
108                            ],
109                            "rules": [
110                                {
111                                    "conditions": [
112                                        {
113                                            "fn": "booleanEquals",
114                                            "argv": [
115                                                {
116                                                    "ref": "UseFIPS"
117                                                },
118                                                true
119                                            ]
120                                        }
121                                    ],
122                                    "rules": [
123                                        {
124                                            "conditions": [
125                                                {
126                                                    "fn": "booleanEquals",
127                                                    "argv": [
128                                                        {
129                                                            "fn": "getAttr",
130                                                            "argv": [
131                                                                {
132                                                                    "ref": "PartitionResult"
133                                                                },
134                                                                "supportsFIPS"
135                                                            ]
136                                                        },
137                                                        true
138                                                    ]
139                                                }
140                                            ],
141                                            "rules": [
142                                                {
143                                                    "conditions": [],
144                                                    "endpoint": {
145                                                        "url": "https://freetier-fips.{Region}.api.aws",
146                                                        "properties": {},
147                                                        "headers": {}
148                                                    },
149                                                    "type": "endpoint"
150                                                }
151                                            ],
152                                            "type": "tree"
153                                        },
154                                        {
155                                            "conditions": [],
156                                            "error": "FIPS is enabled but this partition does not support FIPS",
157                                            "type": "error"
158                                        }
159                                    ],
160                                    "type": "tree"
161                                },
162                                {
163                                    "conditions": [],
164                                    "endpoint": {
165                                        "url": "https://freetier.us-east-1.api.aws",
166                                        "properties": {
167                                            "authSchemes": [
168                                                {
169                                                    "name": "sigv4",
170                                                    "signingName": "freetier",
171                                                    "signingRegion": "us-east-1"
172                                                }
173                                            ]
174                                        },
175                                        "headers": {}
176                                    },
177                                    "type": "endpoint"
178                                }
179                            ],
180                            "type": "tree"
181                        },
182                        {
183                            "conditions": [
184                                {
185                                    "fn": "booleanEquals",
186                                    "argv": [
187                                        true,
188                                        {
189                                            "fn": "getAttr",
190                                            "argv": [
191                                                {
192                                                    "ref": "PartitionResult"
193                                                },
194                                                "supportsDualStack"
195                                            ]
196                                        }
197                                    ]
198                                }
199                            ],
200                            "rules": [
201                                {
202                                    "conditions": [
203                                        {
204                                            "fn": "booleanEquals",
205                                            "argv": [
206                                                {
207                                                    "ref": "UseFIPS"
208                                                },
209                                                true
210                                            ]
211                                        }
212                                    ],
213                                    "rules": [
214                                        {
215                                            "conditions": [
216                                                {
217                                                    "fn": "booleanEquals",
218                                                    "argv": [
219                                                        {
220                                                            "fn": "getAttr",
221                                                            "argv": [
222                                                                {
223                                                                    "ref": "PartitionResult"
224                                                                },
225                                                                "supportsFIPS"
226                                                            ]
227                                                        },
228                                                        true
229                                                    ]
230                                                }
231                                            ],
232                                            "rules": [
233                                                {
234                                                    "conditions": [],
235                                                    "endpoint": {
236                                                        "url": "https://freetier-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
237                                                        "properties": {},
238                                                        "headers": {}
239                                                    },
240                                                    "type": "endpoint"
241                                                }
242                                            ],
243                                            "type": "tree"
244                                        },
245                                        {
246                                            "conditions": [],
247                                            "error": "FIPS is enabled but this partition does not support FIPS",
248                                            "type": "error"
249                                        }
250                                    ],
251                                    "type": "tree"
252                                },
253                                {
254                                    "conditions": [
255                                        {
256                                            "fn": "stringEquals",
257                                            "argv": [
258                                                {
259                                                    "ref": "Region"
260                                                },
261                                                "aws-cn-global"
262                                            ]
263                                        }
264                                    ],
265                                    "endpoint": {
266                                        "url": "https://freetier.cn-northwest-1.api.amazonwebservices.com.cn",
267                                        "properties": {
268                                            "authSchemes": [
269                                                {
270                                                    "name": "sigv4",
271                                                    "signingName": "freetier",
272                                                    "signingRegion": "cn-northwest-1"
273                                                }
274                                            ]
275                                        },
276                                        "headers": {}
277                                    },
278                                    "type": "endpoint"
279                                },
280                                {
281                                    "conditions": [],
282                                    "endpoint": {
283                                        "url": "https://freetier.{Region}.{PartitionResult#dualStackDnsSuffix}",
284                                        "properties": {},
285                                        "headers": {}
286                                    },
287                                    "type": "endpoint"
288                                }
289                            ],
290                            "type": "tree"
291                        },
292                        {
293                            "conditions": [
294                                {
295                                    "fn": "booleanEquals",
296                                    "argv": [
297                                        {
298                                            "ref": "UseFIPS"
299                                        },
300                                        true
301                                    ]
302                                }
303                            ],
304                            "rules": [
305                                {
306                                    "conditions": [
307                                        {
308                                            "fn": "booleanEquals",
309                                            "argv": [
310                                                {
311                                                    "fn": "getAttr",
312                                                    "argv": [
313                                                        {
314                                                            "ref": "PartitionResult"
315                                                        },
316                                                        "supportsFIPS"
317                                                    ]
318                                                },
319                                                true
320                                            ]
321                                        }
322                                    ],
323                                    "rules": [
324                                        {
325                                            "conditions": [],
326                                            "endpoint": {
327                                                "url": "https://freetier-fips.{Region}.{PartitionResult#dnsSuffix}",
328                                                "properties": {},
329                                                "headers": {}
330                                            },
331                                            "type": "endpoint"
332                                        }
333                                    ],
334                                    "type": "tree"
335                                },
336                                {
337                                    "conditions": [],
338                                    "error": "FIPS is enabled but this partition does not support FIPS",
339                                    "type": "error"
340                                }
341                            ],
342                            "type": "tree"
343                        },
344                        {
345                            "conditions": [
346                                {
347                                    "fn": "stringEquals",
348                                    "argv": [
349                                        {
350                                            "ref": "Region"
351                                        },
352                                        "aws-cn-global"
353                                    ]
354                                }
355                            ],
356                            "endpoint": {
357                                "url": "https://freetier.cn-northwest-1.api.amazonwebservices.com.cn",
358                                "properties": {
359                                    "authSchemes": [
360                                        {
361                                            "name": "sigv4",
362                                            "signingName": "freetier",
363                                            "signingRegion": "cn-northwest-1"
364                                        }
365                                    ]
366                                },
367                                "headers": {}
368                            },
369                            "type": "endpoint"
370                        },
371                        {
372                            "conditions": [],
373                            "endpoint": {
374                                "url": "https://freetier.{Region}.{PartitionResult#dnsSuffix}",
375                                "properties": {},
376                                "headers": {}
377                            },
378                            "type": "endpoint"
379                        }
380                    ],
381                    "type": "tree"
382                }
383            ],
384            "type": "tree"
385        },
386        {
387            "conditions": [],
388            "error": "Invalid Configuration: Missing Region",
389            "type": "error"
390        }
391    ]
392}