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