From 14fc1d3e419014a2aa5b08badb15c68c47e638c9 Mon Sep 17 00:00:00 2001 From: Viren Nadkarni Date: Sun, 17 Apr 2022 02:27:02 +0530 Subject: [PATCH] ELB: Fix response templates (#5032) --- moto/elbv2/models.py | 7 +++- moto/elbv2/responses.py | 76 ++++++++++++++++++++++++++++++---- tests/test_elbv2/test_elbv2.py | 12 +++++- 3 files changed, 85 insertions(+), 10 deletions(-) diff --git a/moto/elbv2/models.py b/moto/elbv2/models.py index dff529217..960bbad33 100644 --- a/moto/elbv2/models.py +++ b/moto/elbv2/models.py @@ -496,9 +496,14 @@ class FakeLoadBalancer(CloudFormationModel): "access_logs.s3.prefix", "deletion_protection.enabled", "idle_timeout.timeout_seconds", + "ipv6.deny_all_igw_traffic", "load_balancing.cross_zone.enabled", - "routing.http2.enabled", + "routing.http.desync_mitigation_mode", "routing.http.drop_invalid_header_fields.enabled", + "routing.http.x_amzn_tls_version_and_cipher_suite.enabled", + "routing.http.xff_client_port.enabled", + "routing.http2.enabled", + "waf.fail_open.enabled", } def __init__( diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py index e9a53d495..e275ef217 100644 --- a/moto/elbv2/responses.py +++ b/moto/elbv2/responses.py @@ -1430,24 +1430,85 @@ DESCRIBE_TARGET_HEALTH_TEMPLATE = """ + {% for rule in rules %} - {{ "true" if rules.is_default else "false" }} + {{ "true" if rule.is_default else "false" }} - {% for condition in rules.conditions %} + {% for condition in rule.conditions %} - {{ condition["field"] }} + {{ condition["Field"] }} + {% if "Values" in condition %} - {% for value in condition["values"] %} + {% for value in condition["Values"] %} {{ value }} {% endfor %} + {% endif %} + {% if "HttpHeaderConfig" in condition %} + + {{ condition["HttpHeaderConfig"]["HttpHeaderName"] }} + + {% for value in condition["HttpHeaderConfig"]["Values"] %} + {{ value }} + {% endfor %} + + + {% endif %} + {% if "HttpRequestMethodConfig" in condition %} + + + {% for value in condition["HttpRequestMethodConfig"]["Values"] %} + {{ value }} + {% endfor %} + + + {% endif %} + {% if "QueryStringConfig" in condition %} + + + {% for value in condition["QueryStringConfig"]["Values"] %} + + {{ value["Key"] }} + {{ value["Value"] }} + + {% endfor %} + + + {% endif %} + {% if "SourceIpConfig" in condition %} + + + {% for value in condition["SourceIpConfig"]["Values"] %} + {{ value }} + {% endfor %} + + + {% endif %} + {% if "PathPatternConfig" in condition %} + + + {% for value in condition["PathPatternConfig"]["Values"] %} + {{ value }} + {% endfor %} + + + {% endif %} + {% if "HostHeaderConfig" in condition %} + + + {% for value in condition["HostHeaderConfig"]["Values"] %} + {{ value }} + {% endfor %} + + + {% endif %} {% endfor %} - {{ rules.priority }} - {{ rules.arn }} + {{ rule.priority }} + {{ rule.arn }} - {% for action in rules.actions %} + {% for action in rule.actions %} {{ action["type"] }} {% if action["type"] == "forward" and "forward_config" in action.data %} @@ -1469,6 +1530,7 @@ SET_RULE_PRIORITIES_TEMPLATE = """