Пример #1
0
 def test_fixed_response_config_only_with_fixed_response(self):
     with self.assertRaises(ValueError):
         Action(
             Type="forward",
             FixedResponseConfig=FixedResponseConfig(
                 ContentType="text/plain", ),
         ).to_dict()
Пример #2
0
 def test_fixed_response_action(self):
     Action(
         Type="fixed-response",
         FixedResponseConfig=FixedResponseConfig(
             ContentType="text/plain",
             MessageBody="I am a fixed response",
             StatusCode="200",
         ),
     ).to_dict()
 def test_fixed_response_action(self):
     Action(
         Type='fixed-response',
         FixedResponseConfig=FixedResponseConfig(
             ContentType='text/plain',
             MessageBody='I am a fixed response',
             StatusCode='200'
         )
     ).to_dict()
Пример #4
0
def tea_pot(default_of_all=False) -> Action:
    """
    Predefined reply for ALB config rule, returning HTTP Tea Pot
    """
    return Action(
        FixedResponseConfig=FixedResponseConfig(
            ContentType="application/json",
            MessageBody=dumps({"Info": "Be our guest"}),
            StatusCode="418",
        ),
        Type="fixed-response",
        Order=Ref(AWS_NO_VALUE) if not default_of_all else 50000,
    )
Пример #5
0
 def test_fixed_response_config_one_of(self):
     with self.assertRaises(ValueError):
         FixedResponseConfig(
             ContentType="application/octet-stream", ).to_dict()
Пример #6
0
    Protocol = "HTTP"
)

https_listener = Listener(
    region.replace("-", "") + "ecslivehttpslistener",
    Certificates = [
        Certificate(
            CertificateArn = Ref(origin_issued_certificate)
        )
    ],
    DefaultActions = [
        Action(
            region.replace("-", "") + "ecslivehttpsfixedresponseaction",
            FixedResponseConfig = FixedResponseConfig(
                region.replace("-", "") + "ecslivehttpredirectconfig",
                ContentType = "text/plain",
                MessageBody = "Service Unavailable",
                StatusCode = "503"
            ),
            Order = 50000,
            Type = "fixed-response"
        )

    ],
    LoadBalancerArn = Ref(application_load_balancer),
    Port = 443,
    Protocol = "HTTPS",
    SslPolicy = "ELBSecurityPolicy-FS-1-2-2019-08",
)
# FS-1-2-2019-08 (forward secrecy, tls1.2 only)

template.add_resource(http_listener)