{
    "version": "1.0",
    "parameters": {
        "UseDualStack": {
            "builtIn": "AWS::UseDualStack",
            "required": true,
            "default": false,
            "documentation": "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
            "type": "boolean"
        },
        "UseFIPS": {
            "builtIn": "AWS::UseFIPS",
            "required": true,
            "default": false,
            "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.",
            "type": "boolean"
        },
        "Endpoint": {
            "builtIn": "SDK::Endpoint",
            "required": false,
            "documentation": "Override the endpoint used to send this request",
            "type": "string"
        },
        "Region": {
            "builtIn": "AWS::Region",
            "required": false,
            "documentation": "The AWS region used to dispatch the request.",
            "type": "string"
        }
    },
    "rules": [
        {
            "conditions": [
                {
                    "fn": "isSet",
                    "argv": [
                        {
                            "ref": "Endpoint"
                        }
                    ]
                }
            ],
            "rules": [
                {
                    "conditions": [
                        {
                            "fn": "booleanEquals",
                            "argv": [
                                {
                                    "ref": "UseFIPS"
                                },
                                true
                            ]
                        }
                    ],
                    "error": "Invalid Configuration: FIPS and custom endpoint are not supported",
                    "type": "error"
                },
                {
                    "conditions": [],
                    "rules": [
                        {
                            "conditions": [
                                {
                                    "fn": "booleanEquals",
                                    "argv": [
                                        {
                                            "ref": "UseDualStack"
                                        },
                                        true
                                    ]
                                }
                            ],
                            "error": "Invalid Configuration: Dualstack and custom endpoint are not supported",
                            "type": "error"
                        },
                        {
                            "conditions": [],
                            "endpoint": {
                                "url": {
                                    "ref": "Endpoint"
                                },
                                "properties": {},
                                "headers": {}
                            },
                            "type": "endpoint"
                        }
                    ],
                    "type": "tree"
                }
            ],
            "type": "tree"
        },
        {
            "conditions": [],
            "rules": [
                {
                    "conditions": [
                        {
                            "fn": "isSet",
                            "argv": [
                                {
                                    "ref": "Region"
                                }
                            ]
                        }
                    ],
                    "rules": [
                        {
                            "conditions": [
                                {
                                    "fn": "aws.partition",
                                    "argv": [
                                        {
                                            "ref": "Region"
                                        }
                                    ],
                                    "assign": "PartitionResult"
                                }
                            ],
                            "rules": [
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                true
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.us-east-1.api.aws",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "us-east-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-cn"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                true
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.cn-northwest-1.api.amazonwebservices.com.cn",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "cn-northwest-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-iso"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.us-iso-east-1.c2s.ic.gov",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "us-iso-east-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-iso-b"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.us-isob-east-1.sc2s.sgov.gov",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "us-isob-east-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-iso-e"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.eu-isoe-west-1.cloud.adc-e.uk",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "eu-isoe-west-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-iso-f"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.us-isof-south-1.csp.hci.ic.gov",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "us-isof-south-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-eusc"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                true
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.eusc-de-east-1.api.amazonwebservices.eu",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "eusc-de-east-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "stringEquals",
                                            "argv": [
                                                {
                                                    "fn": "getAttr",
                                                    "argv": [
                                                        {
                                                            "ref": "PartitionResult"
                                                        },
                                                        "name"
                                                    ]
                                                },
                                                "aws-eusc"
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "endpoint": {
                                        "url": "https://ce.eusc-de-east-1.api.amazonwebservices.eu",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "eusc-de-east-1"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                true
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                true
                                            ]
                                        }
                                    ],
                                    "rules": [
                                        {
                                            "conditions": [
                                                {
                                                    "fn": "booleanEquals",
                                                    "argv": [
                                                        true,
                                                        {
                                                            "fn": "getAttr",
                                                            "argv": [
                                                                {
                                                                    "ref": "PartitionResult"
                                                                },
                                                                "supportsFIPS"
                                                            ]
                                                        }
                                                    ]
                                                },
                                                {
                                                    "fn": "booleanEquals",
                                                    "argv": [
                                                        true,
                                                        {
                                                            "fn": "getAttr",
                                                            "argv": [
                                                                {
                                                                    "ref": "PartitionResult"
                                                                },
                                                                "supportsDualStack"
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ],
                                            "rules": [
                                                {
                                                    "conditions": [],
                                                    "endpoint": {
                                                        "url": "https://ce-fips.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dualStackDnsSuffix}",
                                                        "properties": {
                                                            "authSchemes": [
                                                                {
                                                                    "name": "sigv4",
                                                                    "signingRegion": "{PartitionResult#implicitGlobalRegion}"
                                                                }
                                                            ]
                                                        },
                                                        "headers": {}
                                                    },
                                                    "type": "endpoint"
                                                }
                                            ],
                                            "type": "tree"
                                        },
                                        {
                                            "conditions": [],
                                            "error": "FIPS and DualStack are enabled, but this partition does not support one or both",
                                            "type": "error"
                                        }
                                    ],
                                    "type": "tree"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                true
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                false
                                            ]
                                        }
                                    ],
                                    "rules": [
                                        {
                                            "conditions": [
                                                {
                                                    "fn": "booleanEquals",
                                                    "argv": [
                                                        {
                                                            "fn": "getAttr",
                                                            "argv": [
                                                                {
                                                                    "ref": "PartitionResult"
                                                                },
                                                                "supportsFIPS"
                                                            ]
                                                        },
                                                        true
                                                    ]
                                                }
                                            ],
                                            "rules": [
                                                {
                                                    "conditions": [],
                                                    "endpoint": {
                                                        "url": "https://ce-fips.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dnsSuffix}",
                                                        "properties": {
                                                            "authSchemes": [
                                                                {
                                                                    "name": "sigv4",
                                                                    "signingRegion": "{PartitionResult#implicitGlobalRegion}"
                                                                }
                                                            ]
                                                        },
                                                        "headers": {}
                                                    },
                                                    "type": "endpoint"
                                                }
                                            ],
                                            "type": "tree"
                                        },
                                        {
                                            "conditions": [],
                                            "error": "FIPS is enabled but this partition does not support FIPS",
                                            "type": "error"
                                        }
                                    ],
                                    "type": "tree"
                                },
                                {
                                    "conditions": [
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseFIPS"
                                                },
                                                false
                                            ]
                                        },
                                        {
                                            "fn": "booleanEquals",
                                            "argv": [
                                                {
                                                    "ref": "UseDualStack"
                                                },
                                                true
                                            ]
                                        }
                                    ],
                                    "rules": [
                                        {
                                            "conditions": [
                                                {
                                                    "fn": "booleanEquals",
                                                    "argv": [
                                                        true,
                                                        {
                                                            "fn": "getAttr",
                                                            "argv": [
                                                                {
                                                                    "ref": "PartitionResult"
                                                                },
                                                                "supportsDualStack"
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ],
                                            "rules": [
                                                {
                                                    "conditions": [],
                                                    "endpoint": {
                                                        "url": "https://ce.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dualStackDnsSuffix}",
                                                        "properties": {
                                                            "authSchemes": [
                                                                {
                                                                    "name": "sigv4",
                                                                    "signingRegion": "{PartitionResult#implicitGlobalRegion}"
                                                                }
                                                            ]
                                                        },
                                                        "headers": {}
                                                    },
                                                    "type": "endpoint"
                                                }
                                            ],
                                            "type": "tree"
                                        },
                                        {
                                            "conditions": [],
                                            "error": "DualStack is enabled but this partition does not support DualStack",
                                            "type": "error"
                                        }
                                    ],
                                    "type": "tree"
                                },
                                {
                                    "conditions": [],
                                    "endpoint": {
                                        "url": "https://ce.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dnsSuffix}",
                                        "properties": {
                                            "authSchemes": [
                                                {
                                                    "name": "sigv4",
                                                    "signingRegion": "{PartitionResult#implicitGlobalRegion}"
                                                }
                                            ]
                                        },
                                        "headers": {}
                                    },
                                    "type": "endpoint"
                                }
                            ],
                            "type": "tree"
                        }
                    ],
                    "type": "tree"
                },
                {
                    "conditions": [],
                    "error": "Invalid Configuration: Missing Region",
                    "type": "error"
                }
            ],
            "type": "tree"
        }
    ]
}