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