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        "EndpointId": {
31            "required": false,
32            "documentation": "Operation parameter for EndpointId",
33            "type": "String"
34        }
35    },
36    "rules": [
37        {
38            "conditions": [
39                {
40                    "fn": "isSet",
41                    "argv": [
42                        {
43                            "ref": "EndpointId"
44                        }
45                    ]
46                },
47                {
48                    "fn": "isSet",
49                    "argv": [
50                        {
51                            "ref": "Region"
52                        }
53                    ]
54                },
55                {
56                    "fn": "aws.partition",
57                    "argv": [
58                        {
59                            "ref": "Region"
60                        }
61                    ],
62                    "assign": "PartitionResult"
63                }
64            ],
65            "rules": [
66                {
67                    "conditions": [
68                        {
69                            "fn": "isValidHostLabel",
70                            "argv": [
71                                {
72                                    "ref": "EndpointId"
73                                },
74                                true
75                            ]
76                        }
77                    ],
78                    "rules": [
79                        {
80                            "conditions": [
81                                {
82                                    "fn": "booleanEquals",
83                                    "argv": [
84                                        {
85                                            "ref": "UseFIPS"
86                                        },
87                                        false
88                                    ]
89                                }
90                            ],
91                            "rules": [
92                                {
93                                    "conditions": [
94                                        {
95                                            "fn": "isSet",
96                                            "argv": [
97                                                {
98                                                    "ref": "Endpoint"
99                                                }
100                                            ]
101                                        }
102                                    ],
103                                    "endpoint": {
104                                        "url": {
105                                            "ref": "Endpoint"
106                                        },
107                                        "properties": {
108                                            "authSchemes": [
109                                                {
110                                                    "name": "sigv4a",
111                                                    "signingName": "events",
112                                                    "signingRegionSet": [
113                                                        "*"
114                                                    ]
115                                                }
116                                            ]
117                                        },
118                                        "headers": {}
119                                    },
120                                    "type": "endpoint"
121                                },
122                                {
123                                    "conditions": [
124                                        {
125                                            "fn": "booleanEquals",
126                                            "argv": [
127                                                {
128                                                    "ref": "UseDualStack"
129                                                },
130                                                true
131                                            ]
132                                        }
133                                    ],
134                                    "rules": [
135                                        {
136                                            "conditions": [
137                                                {
138                                                    "fn": "booleanEquals",
139                                                    "argv": [
140                                                        true,
141                                                        {
142                                                            "fn": "getAttr",
143                                                            "argv": [
144                                                                {
145                                                                    "ref": "PartitionResult"
146                                                                },
147                                                                "supportsDualStack"
148                                                            ]
149                                                        }
150                                                    ]
151                                                }
152                                            ],
153                                            "rules": [
154                                                {
155                                                    "conditions": [],
156                                                    "endpoint": {
157                                                        "url": "https://{EndpointId}.endpoint.events.{PartitionResult#dualStackDnsSuffix}",
158                                                        "properties": {
159                                                            "authSchemes": [
160                                                                {
161                                                                    "name": "sigv4a",
162                                                                    "signingName": "events",
163                                                                    "signingRegionSet": [
164                                                                        "*"
165                                                                    ]
166                                                                }
167                                                            ]
168                                                        },
169                                                        "headers": {}
170                                                    },
171                                                    "type": "endpoint"
172                                                }
173                                            ],
174                                            "type": "tree"
175                                        },
176                                        {
177                                            "conditions": [],
178                                            "error": "DualStack is enabled but this partition does not support DualStack",
179                                            "type": "error"
180                                        }
181                                    ],
182                                    "type": "tree"
183                                },
184                                {
185                                    "conditions": [],
186                                    "endpoint": {
187                                        "url": "https://{EndpointId}.endpoint.events.{PartitionResult#dnsSuffix}",
188                                        "properties": {
189                                            "authSchemes": [
190                                                {
191                                                    "name": "sigv4a",
192                                                    "signingName": "events",
193                                                    "signingRegionSet": [
194                                                        "*"
195                                                    ]
196                                                }
197                                            ]
198                                        },
199                                        "headers": {}
200                                    },
201                                    "type": "endpoint"
202                                }
203                            ],
204                            "type": "tree"
205                        },
206                        {
207                            "conditions": [],
208                            "error": "Invalid Configuration: FIPS is not supported with EventBridge multi-region endpoints.",
209                            "type": "error"
210                        }
211                    ],
212                    "type": "tree"
213                },
214                {
215                    "conditions": [],
216                    "error": "EndpointId must be a valid host label.",
217                    "type": "error"
218                }
219            ],
220            "type": "tree"
221        },
222        {
223            "conditions": [
224                {
225                    "fn": "isSet",
226                    "argv": [
227                        {
228                            "ref": "Endpoint"
229                        }
230                    ]
231                }
232            ],
233            "rules": [
234                {
235                    "conditions": [
236                        {
237                            "fn": "booleanEquals",
238                            "argv": [
239                                {
240                                    "ref": "UseFIPS"
241                                },
242                                true
243                            ]
244                        }
245                    ],
246                    "error": "Invalid Configuration: FIPS and custom endpoint are not supported",
247                    "type": "error"
248                },
249                {
250                    "conditions": [
251                        {
252                            "fn": "booleanEquals",
253                            "argv": [
254                                {
255                                    "ref": "UseDualStack"
256                                },
257                                true
258                            ]
259                        }
260                    ],
261                    "error": "Invalid Configuration: Dualstack and custom endpoint are not supported",
262                    "type": "error"
263                },
264                {
265                    "conditions": [],
266                    "endpoint": {
267                        "url": {
268                            "ref": "Endpoint"
269                        },
270                        "properties": {},
271                        "headers": {}
272                    },
273                    "type": "endpoint"
274                }
275            ],
276            "type": "tree"
277        },
278        {
279            "conditions": [
280                {
281                    "fn": "isSet",
282                    "argv": [
283                        {
284                            "ref": "Region"
285                        }
286                    ]
287                }
288            ],
289            "rules": [
290                {
291                    "conditions": [
292                        {
293                            "fn": "aws.partition",
294                            "argv": [
295                                {
296                                    "ref": "Region"
297                                }
298                            ],
299                            "assign": "PartitionResult"
300                        }
301                    ],
302                    "rules": [
303                        {
304                            "conditions": [
305                                {
306                                    "fn": "booleanEquals",
307                                    "argv": [
308                                        {
309                                            "ref": "UseFIPS"
310                                        },
311                                        true
312                                    ]
313                                },
314                                {
315                                    "fn": "booleanEquals",
316                                    "argv": [
317                                        {
318                                            "ref": "UseDualStack"
319                                        },
320                                        true
321                                    ]
322                                }
323                            ],
324                            "rules": [
325                                {
326                                    "conditions": [
327                                        {
328                                            "fn": "booleanEquals",
329                                            "argv": [
330                                                true,
331                                                {
332                                                    "fn": "getAttr",
333                                                    "argv": [
334                                                        {
335                                                            "ref": "PartitionResult"
336                                                        },
337                                                        "supportsFIPS"
338                                                    ]
339                                                }
340                                            ]
341                                        },
342                                        {
343                                            "fn": "booleanEquals",
344                                            "argv": [
345                                                true,
346                                                {
347                                                    "fn": "getAttr",
348                                                    "argv": [
349                                                        {
350                                                            "ref": "PartitionResult"
351                                                        },
352                                                        "supportsDualStack"
353                                                    ]
354                                                }
355                                            ]
356                                        }
357                                    ],
358                                    "rules": [
359                                        {
360                                            "conditions": [],
361                                            "endpoint": {
362                                                "url": "https://events-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
363                                                "properties": {},
364                                                "headers": {}
365                                            },
366                                            "type": "endpoint"
367                                        }
368                                    ],
369                                    "type": "tree"
370                                },
371                                {
372                                    "conditions": [],
373                                    "error": "FIPS and DualStack are enabled, but this partition does not support one or both",
374                                    "type": "error"
375                                }
376                            ],
377                            "type": "tree"
378                        },
379                        {
380                            "conditions": [
381                                {
382                                    "fn": "booleanEquals",
383                                    "argv": [
384                                        {
385                                            "ref": "UseFIPS"
386                                        },
387                                        true
388                                    ]
389                                }
390                            ],
391                            "rules": [
392                                {
393                                    "conditions": [
394                                        {
395                                            "fn": "booleanEquals",
396                                            "argv": [
397                                                {
398                                                    "fn": "getAttr",
399                                                    "argv": [
400                                                        {
401                                                            "ref": "PartitionResult"
402                                                        },
403                                                        "supportsFIPS"
404                                                    ]
405                                                },
406                                                true
407                                            ]
408                                        }
409                                    ],
410                                    "rules": [
411                                        {
412                                            "conditions": [
413                                                {
414                                                    "fn": "stringEquals",
415                                                    "argv": [
416                                                        {
417                                                            "ref": "Region"
418                                                        },
419                                                        "us-gov-east-1"
420                                                    ]
421                                                }
422                                            ],
423                                            "endpoint": {
424                                                "url": "https://events.us-gov-east-1.amazonaws.com",
425                                                "properties": {},
426                                                "headers": {}
427                                            },
428                                            "type": "endpoint"
429                                        },
430                                        {
431                                            "conditions": [
432                                                {
433                                                    "fn": "stringEquals",
434                                                    "argv": [
435                                                        {
436                                                            "ref": "Region"
437                                                        },
438                                                        "us-gov-west-1"
439                                                    ]
440                                                }
441                                            ],
442                                            "endpoint": {
443                                                "url": "https://events.us-gov-west-1.amazonaws.com",
444                                                "properties": {},
445                                                "headers": {}
446                                            },
447                                            "type": "endpoint"
448                                        },
449                                        {
450                                            "conditions": [],
451                                            "endpoint": {
452                                                "url": "https://events-fips.{Region}.{PartitionResult#dnsSuffix}",
453                                                "properties": {},
454                                                "headers": {}
455                                            },
456                                            "type": "endpoint"
457                                        }
458                                    ],
459                                    "type": "tree"
460                                },
461                                {
462                                    "conditions": [],
463                                    "error": "FIPS is enabled but this partition does not support FIPS",
464                                    "type": "error"
465                                }
466                            ],
467                            "type": "tree"
468                        },
469                        {
470                            "conditions": [
471                                {
472                                    "fn": "booleanEquals",
473                                    "argv": [
474                                        {
475                                            "ref": "UseDualStack"
476                                        },
477                                        true
478                                    ]
479                                }
480                            ],
481                            "rules": [
482                                {
483                                    "conditions": [
484                                        {
485                                            "fn": "booleanEquals",
486                                            "argv": [
487                                                true,
488                                                {
489                                                    "fn": "getAttr",
490                                                    "argv": [
491                                                        {
492                                                            "ref": "PartitionResult"
493                                                        },
494                                                        "supportsDualStack"
495                                                    ]
496                                                }
497                                            ]
498                                        }
499                                    ],
500                                    "rules": [
501                                        {
502                                            "conditions": [],
503                                            "endpoint": {
504                                                "url": "https://events.{Region}.{PartitionResult#dualStackDnsSuffix}",
505                                                "properties": {},
506                                                "headers": {}
507                                            },
508                                            "type": "endpoint"
509                                        }
510                                    ],
511                                    "type": "tree"
512                                },
513                                {
514                                    "conditions": [],
515                                    "error": "DualStack is enabled but this partition does not support DualStack",
516                                    "type": "error"
517                                }
518                            ],
519                            "type": "tree"
520                        },
521                        {
522                            "conditions": [],
523                            "endpoint": {
524                                "url": "https://events.{Region}.{PartitionResult#dnsSuffix}",
525                                "properties": {},
526                                "headers": {}
527                            },
528                            "type": "endpoint"
529                        }
530                    ],
531                    "type": "tree"
532                }
533            ],
534            "type": "tree"
535        },
536        {
537            "conditions": [],
538            "error": "Invalid Configuration: Missing Region",
539            "type": "error"
540        }
541    ]
542}