2014-08-27 15:17:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2015-03-22 14:35:27 +00:00
|
|
|
from boto.ec2.elb.attributes import (
|
|
|
|
ConnectionSettingAttribute,
|
|
|
|
ConnectionDrainingAttribute,
|
|
|
|
AccessLogAttribute,
|
|
|
|
CrossZoneLoadBalancingAttribute,
|
|
|
|
)
|
2015-07-14 23:54:58 +00:00
|
|
|
from boto.ec2.elb.policies import (
|
|
|
|
AppCookieStickinessPolicy,
|
|
|
|
OtherPolicy,
|
|
|
|
)
|
2013-07-23 02:50:58 +00:00
|
|
|
|
|
|
|
from moto.core.responses import BaseResponse
|
2014-11-15 18:34:52 +00:00
|
|
|
from .models import elb_backends
|
2016-04-28 13:21:54 +00:00
|
|
|
from .exceptions import DuplicateTagKeysError, LoadBalancerNotFoundError
|
2015-12-09 20:30:40 +00:00
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
|
|
|
|
class ELBResponse(BaseResponse):
|
|
|
|
|
2014-11-15 18:34:52 +00:00
|
|
|
@property
|
|
|
|
def elb_backend(self):
|
|
|
|
return elb_backends[self.region]
|
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
def create_load_balancer(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
availability_zones = self._get_multi_param("AvailabilityZones.member")
|
|
|
|
ports = self._get_list_prefix("Listeners.member")
|
2015-12-02 22:46:24 +00:00
|
|
|
scheme = self._get_param('Scheme')
|
2016-04-14 12:43:03 +00:00
|
|
|
subnets = self._get_multi_param("Subnets.member")
|
2017-07-19 22:58:49 +00:00
|
|
|
security_groups = self._get_multi_param("SecurityGroups.member")
|
2014-07-15 00:54:45 +00:00
|
|
|
|
2016-04-28 13:21:54 +00:00
|
|
|
load_balancer = self.elb_backend.create_load_balancer(
|
2013-07-23 02:50:58 +00:00
|
|
|
name=load_balancer_name,
|
|
|
|
zones=availability_zones,
|
|
|
|
ports=ports,
|
2016-04-14 12:43:03 +00:00
|
|
|
scheme=scheme,
|
2016-04-14 13:50:51 +00:00
|
|
|
subnets=subnets,
|
2017-07-19 22:58:49 +00:00
|
|
|
security_groups=security_groups,
|
2013-07-23 02:50:58 +00:00
|
|
|
)
|
2016-04-28 13:21:54 +00:00
|
|
|
self._add_tags(load_balancer)
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(CREATE_LOAD_BALANCER_TEMPLATE)
|
2016-04-28 13:21:54 +00:00
|
|
|
return template.render(load_balancer=load_balancer)
|
2013-07-23 02:50:58 +00:00
|
|
|
|
2014-07-15 00:54:45 +00:00
|
|
|
def create_load_balancer_listeners(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
ports = self._get_list_prefix("Listeners.member")
|
2014-07-15 00:54:45 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.create_load_balancer_listeners(
|
|
|
|
name=load_balancer_name, ports=ports)
|
2014-07-15 00:54:45 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
template = self.response_template(
|
|
|
|
CREATE_LOAD_BALANCER_LISTENERS_TEMPLATE)
|
2014-07-15 00:54:45 +00:00
|
|
|
return template.render()
|
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
def describe_load_balancers(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
names = self._get_multi_param("LoadBalancerNames.member")
|
2017-05-11 01:58:42 +00:00
|
|
|
all_load_balancers = list(self.elb_backend.describe_load_balancers(names))
|
|
|
|
marker = self._get_param('Marker')
|
|
|
|
all_names = [balancer.name for balancer in all_load_balancers]
|
|
|
|
if marker:
|
|
|
|
start = all_names.index(marker) + 1
|
|
|
|
else:
|
|
|
|
start = 0
|
2018-03-05 21:52:56 +00:00
|
|
|
page_size = self._get_int_param('PageSize', 50) # the default is 400, but using 50 to make testing easier
|
2017-05-11 01:58:42 +00:00
|
|
|
load_balancers_resp = all_load_balancers[start:start + page_size]
|
|
|
|
next_marker = None
|
|
|
|
if len(all_load_balancers) > start + page_size:
|
|
|
|
next_marker = load_balancers_resp[-1].name
|
|
|
|
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(DESCRIBE_LOAD_BALANCERS_TEMPLATE)
|
2017-05-11 01:58:42 +00:00
|
|
|
return template.render(load_balancers=load_balancers_resp, marker=next_marker)
|
2013-07-23 02:50:58 +00:00
|
|
|
|
2014-07-15 00:54:45 +00:00
|
|
|
def delete_load_balancer_listeners(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
ports = self._get_multi_param("LoadBalancerPorts.member")
|
|
|
|
ports = [int(port) for port in ports]
|
2014-07-19 00:31:57 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.delete_load_balancer_listeners(
|
|
|
|
load_balancer_name, ports)
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(DELETE_LOAD_BALANCER_LISTENERS)
|
2014-07-15 00:54:45 +00:00
|
|
|
return template.render()
|
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
def delete_load_balancer(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2014-11-15 18:34:52 +00:00
|
|
|
self.elb_backend.delete_load_balancer(load_balancer_name)
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(DELETE_LOAD_BALANCER_TEMPLATE)
|
2013-07-23 02:50:58 +00:00
|
|
|
return template.render()
|
|
|
|
|
2017-07-19 22:58:49 +00:00
|
|
|
def apply_security_groups_to_load_balancer(self):
|
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
security_group_ids = self._get_multi_param("SecurityGroups.member")
|
|
|
|
self.elb_backend.apply_security_groups_to_load_balancer(load_balancer_name, security_group_ids)
|
|
|
|
template = self.response_template(APPLY_SECURITY_GROUPS_TEMPLATE)
|
|
|
|
return template.render(security_group_ids=security_group_ids)
|
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
def configure_health_check(self):
|
2014-11-15 18:34:52 +00:00
|
|
|
check = self.elb_backend.configure_health_check(
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name=self._get_param('LoadBalancerName'),
|
|
|
|
timeout=self._get_param('HealthCheck.Timeout'),
|
|
|
|
healthy_threshold=self._get_param('HealthCheck.HealthyThreshold'),
|
2017-02-24 02:37:43 +00:00
|
|
|
unhealthy_threshold=self._get_param(
|
|
|
|
'HealthCheck.UnhealthyThreshold'),
|
2015-07-18 13:08:27 +00:00
|
|
|
interval=self._get_param('HealthCheck.Interval'),
|
|
|
|
target=self._get_param('HealthCheck.Target'),
|
2013-07-23 02:50:58 +00:00
|
|
|
)
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(CONFIGURE_HEALTH_CHECK_TEMPLATE)
|
2013-07-23 02:50:58 +00:00
|
|
|
return template.render(check=check)
|
|
|
|
|
|
|
|
def register_instances_with_load_balancer(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2017-07-19 23:33:24 +00:00
|
|
|
instance_ids = [list(param.values())[0] for param in self._get_list_prefix('Instances.member')]
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(REGISTER_INSTANCES_TEMPLATE)
|
2017-02-24 02:37:43 +00:00
|
|
|
load_balancer = self.elb_backend.register_instances(
|
|
|
|
load_balancer_name, instance_ids)
|
2013-07-23 02:50:58 +00:00
|
|
|
return template.render(load_balancer=load_balancer)
|
|
|
|
|
2017-03-16 03:39:36 +00:00
|
|
|
def set_load_balancer_listener_ssl_certificate(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2014-07-15 00:54:45 +00:00
|
|
|
ssl_certificate_id = self.querystring['SSLCertificateId'][0]
|
|
|
|
lb_port = self.querystring['LoadBalancerPort'][0]
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_load_balancer_listener_sslcertificate(
|
|
|
|
load_balancer_name, lb_port, ssl_certificate_id)
|
2014-07-15 00:54:45 +00:00
|
|
|
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(SET_LOAD_BALANCER_SSL_CERTIFICATE)
|
2014-07-15 00:54:45 +00:00
|
|
|
return template.render()
|
|
|
|
|
2013-07-23 02:50:58 +00:00
|
|
|
def deregister_instances_from_load_balancer(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2017-07-19 23:33:24 +00:00
|
|
|
instance_ids = [list(param.values())[0] for param in self._get_list_prefix('Instances.member')]
|
2014-12-12 20:46:07 +00:00
|
|
|
template = self.response_template(DEREGISTER_INSTANCES_TEMPLATE)
|
2017-02-24 02:37:43 +00:00
|
|
|
load_balancer = self.elb_backend.deregister_instances(
|
|
|
|
load_balancer_name, instance_ids)
|
2013-07-23 02:50:58 +00:00
|
|
|
return template.render(load_balancer=load_balancer)
|
|
|
|
|
2015-03-22 14:35:27 +00:00
|
|
|
def describe_load_balancer_attributes(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
load_balancer = self.elb_backend.get_load_balancer(load_balancer_name)
|
2015-03-22 14:35:27 +00:00
|
|
|
template = self.response_template(DESCRIBE_ATTRIBUTES_TEMPLATE)
|
|
|
|
return template.render(attributes=load_balancer.attributes)
|
|
|
|
|
|
|
|
def modify_load_balancer_attributes(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
load_balancer = self.elb_backend.get_load_balancer(load_balancer_name)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
cross_zone = self._get_dict_param(
|
|
|
|
"LoadBalancerAttributes.CrossZoneLoadBalancing.")
|
2015-03-22 14:35:27 +00:00
|
|
|
if cross_zone:
|
|
|
|
attribute = CrossZoneLoadBalancingAttribute()
|
2015-07-18 13:08:27 +00:00
|
|
|
attribute.enabled = cross_zone["enabled"] == "true"
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_cross_zone_load_balancing_attribute(
|
|
|
|
load_balancer_name, attribute)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2015-07-18 13:08:27 +00:00
|
|
|
access_log = self._get_dict_param("LoadBalancerAttributes.AccessLog.")
|
2015-03-22 14:35:27 +00:00
|
|
|
if access_log:
|
|
|
|
attribute = AccessLogAttribute()
|
2015-07-18 13:08:27 +00:00
|
|
|
attribute.enabled = access_log["enabled"] == "true"
|
|
|
|
attribute.s3_bucket_name = access_log['s3_bucket_name']
|
|
|
|
attribute.s3_bucket_prefix = access_log['s3_bucket_prefix']
|
|
|
|
attribute.emit_interval = access_log["emit_interval"]
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_access_log_attribute(
|
|
|
|
load_balancer_name, attribute)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
connection_draining = self._get_dict_param(
|
|
|
|
"LoadBalancerAttributes.ConnectionDraining.")
|
2015-03-22 14:35:27 +00:00
|
|
|
if connection_draining:
|
|
|
|
attribute = ConnectionDrainingAttribute()
|
2015-07-18 13:08:27 +00:00
|
|
|
attribute.enabled = connection_draining["enabled"] == "true"
|
2017-05-31 22:53:31 +00:00
|
|
|
attribute.timeout = connection_draining.get("timeout", 300)
|
|
|
|
self.elb_backend.set_connection_draining_attribute(load_balancer_name, attribute)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
connection_settings = self._get_dict_param(
|
|
|
|
"LoadBalancerAttributes.ConnectionSettings.")
|
2015-03-22 14:35:27 +00:00
|
|
|
if connection_settings:
|
|
|
|
attribute = ConnectionSettingAttribute()
|
2015-07-18 13:08:27 +00:00
|
|
|
attribute.idle_timeout = connection_settings["idle_timeout"]
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_connection_settings_attribute(
|
|
|
|
load_balancer_name, attribute)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
|
|
|
template = self.response_template(MODIFY_ATTRIBUTES_TEMPLATE)
|
2017-05-31 22:53:31 +00:00
|
|
|
return template.render(load_balancer=load_balancer, attributes=load_balancer.attributes)
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2015-07-14 23:54:58 +00:00
|
|
|
def create_load_balancer_policy(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
other_policy = OtherPolicy()
|
2015-07-18 13:08:27 +00:00
|
|
|
policy_name = self._get_param("PolicyName")
|
2015-07-14 23:54:58 +00:00
|
|
|
other_policy.policy_name = policy_name
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.create_lb_other_policy(
|
|
|
|
load_balancer_name, other_policy)
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
template = self.response_template(CREATE_LOAD_BALANCER_POLICY_TEMPLATE)
|
|
|
|
return template.render()
|
|
|
|
|
|
|
|
def create_app_cookie_stickiness_policy(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
policy = AppCookieStickinessPolicy()
|
2015-07-18 13:08:27 +00:00
|
|
|
policy.policy_name = self._get_param("PolicyName")
|
|
|
|
policy.cookie_name = self._get_param("CookieName")
|
2015-07-14 23:54:58 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.create_app_cookie_stickiness_policy(
|
|
|
|
load_balancer_name, policy)
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
template = self.response_template(CREATE_LOAD_BALANCER_POLICY_TEMPLATE)
|
|
|
|
return template.render()
|
|
|
|
|
2017-03-16 03:39:36 +00:00
|
|
|
def create_lb_cookie_stickiness_policy(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
policy = AppCookieStickinessPolicy()
|
2015-07-18 13:08:27 +00:00
|
|
|
policy.policy_name = self._get_param("PolicyName")
|
|
|
|
cookie_expirations = self._get_param("CookieExpirationPeriod")
|
2015-07-14 23:54:58 +00:00
|
|
|
if cookie_expirations:
|
2015-07-18 13:08:27 +00:00
|
|
|
policy.cookie_expiration_period = int(cookie_expirations)
|
2015-07-14 23:54:58 +00:00
|
|
|
else:
|
|
|
|
policy.cookie_expiration_period = None
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.create_lb_cookie_stickiness_policy(
|
|
|
|
load_balancer_name, policy)
|
2015-07-14 23:54:58 +00:00
|
|
|
|
|
|
|
template = self.response_template(CREATE_LOAD_BALANCER_POLICY_TEMPLATE)
|
|
|
|
return template.render()
|
|
|
|
|
|
|
|
def set_load_balancer_policies_of_listener(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
|
|
|
load_balancer = self.elb_backend.get_load_balancer(load_balancer_name)
|
|
|
|
load_balancer_port = int(self._get_param('LoadBalancerPort'))
|
2015-07-14 23:54:58 +00:00
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
mb_listener = [l for l in load_balancer.listeners if int(
|
|
|
|
l.load_balancer_port) == load_balancer_port]
|
2015-07-14 23:54:58 +00:00
|
|
|
if mb_listener:
|
2015-07-18 13:08:27 +00:00
|
|
|
policies = self._get_multi_param("PolicyNames.member")
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_load_balancer_policies_of_listener(
|
|
|
|
load_balancer_name, load_balancer_port, policies)
|
2015-07-14 23:54:58 +00:00
|
|
|
# else: explode?
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
template = self.response_template(
|
|
|
|
SET_LOAD_BALANCER_POLICIES_OF_LISTENER_TEMPLATE)
|
2015-07-14 23:54:58 +00:00
|
|
|
return template.render()
|
2015-07-18 13:08:27 +00:00
|
|
|
|
2015-07-14 23:54:58 +00:00
|
|
|
def set_load_balancer_policies_for_backend_server(self):
|
|
|
|
load_balancer_name = self.querystring.get('LoadBalancerName')[0]
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer = self.elb_backend.get_load_balancer(load_balancer_name)
|
2015-07-14 23:54:58 +00:00
|
|
|
instance_port = int(self.querystring.get('InstancePort')[0])
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
mb_backend = [b for b in load_balancer.backends if int(
|
|
|
|
b.instance_port) == instance_port]
|
2015-07-14 23:54:58 +00:00
|
|
|
if mb_backend:
|
2015-07-18 13:08:27 +00:00
|
|
|
policies = self._get_multi_param('PolicyNames.member')
|
2017-02-24 02:37:43 +00:00
|
|
|
self.elb_backend.set_load_balancer_policies_of_backend_server(
|
|
|
|
load_balancer_name, instance_port, policies)
|
2015-07-14 23:54:58 +00:00
|
|
|
# else: explode?
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
template = self.response_template(
|
|
|
|
SET_LOAD_BALANCER_POLICIES_FOR_BACKEND_SERVER_TEMPLATE)
|
2015-07-14 23:54:58 +00:00
|
|
|
return template.render()
|
|
|
|
|
2015-03-22 20:00:16 +00:00
|
|
|
def describe_instance_health(self):
|
2015-07-18 13:08:27 +00:00
|
|
|
load_balancer_name = self._get_param('LoadBalancerName')
|
2018-08-06 08:47:00 +00:00
|
|
|
provided_instance_ids = [
|
|
|
|
list(param.values())[0]
|
|
|
|
for param in self._get_list_prefix('Instances.member')
|
|
|
|
]
|
|
|
|
registered_instances_id = self.elb_backend.get_load_balancer(
|
|
|
|
load_balancer_name).instance_ids
|
|
|
|
if len(provided_instance_ids) == 0:
|
|
|
|
provided_instance_ids = registered_instances_id
|
2015-03-22 20:00:16 +00:00
|
|
|
template = self.response_template(DESCRIBE_INSTANCE_HEALTH_TEMPLATE)
|
2018-08-06 08:47:00 +00:00
|
|
|
instances = []
|
|
|
|
for instance_id in provided_instance_ids:
|
|
|
|
state = "InService" \
|
|
|
|
if instance_id in registered_instances_id\
|
|
|
|
else "Unknown"
|
|
|
|
instances.append({"InstanceId": instance_id, "State": state})
|
|
|
|
return template.render(instances=instances)
|
2015-03-22 20:00:16 +00:00
|
|
|
|
2015-12-09 20:30:40 +00:00
|
|
|
def add_tags(self):
|
2016-10-15 13:08:44 +00:00
|
|
|
|
2015-12-09 20:30:40 +00:00
|
|
|
for key, value in self.querystring.items():
|
|
|
|
if "LoadBalancerNames.member" in key:
|
|
|
|
load_balancer_name = value[0]
|
|
|
|
elb = self.elb_backend.get_load_balancer(load_balancer_name)
|
|
|
|
if not elb:
|
|
|
|
raise LoadBalancerNotFoundError(load_balancer_name)
|
|
|
|
|
2016-04-14 13:50:51 +00:00
|
|
|
self._add_tags(elb)
|
2015-12-09 20:30:40 +00:00
|
|
|
|
|
|
|
template = self.response_template(ADD_TAGS_TEMPLATE)
|
|
|
|
return template.render()
|
|
|
|
|
|
|
|
def remove_tags(self):
|
|
|
|
for key, value in self.querystring.items():
|
|
|
|
if "LoadBalancerNames.member" in key:
|
|
|
|
number = key.split('.')[2]
|
2017-02-24 02:37:43 +00:00
|
|
|
load_balancer_name = self._get_param(
|
|
|
|
'LoadBalancerNames.member.{0}'.format(number))
|
2015-12-09 20:30:40 +00:00
|
|
|
elb = self.elb_backend.get_load_balancer(load_balancer_name)
|
|
|
|
if not elb:
|
2016-04-28 13:21:54 +00:00
|
|
|
raise LoadBalancerNotFoundError(load_balancer_name)
|
2015-12-09 20:30:40 +00:00
|
|
|
|
2015-12-10 17:22:03 +00:00
|
|
|
key = 'Tag.member.{0}.Key'.format(number)
|
2015-12-09 20:30:40 +00:00
|
|
|
for t_key, t_val in self.querystring.items():
|
|
|
|
if t_key.startswith('Tags.member.'):
|
|
|
|
if t_key.split('.')[3] == 'Key':
|
|
|
|
elb.remove_tag(t_val[0])
|
|
|
|
|
|
|
|
template = self.response_template(REMOVE_TAGS_TEMPLATE)
|
|
|
|
return template.render()
|
|
|
|
|
|
|
|
def describe_tags(self):
|
2015-12-14 11:38:10 +00:00
|
|
|
elbs = []
|
2015-12-09 20:30:40 +00:00
|
|
|
for key, value in self.querystring.items():
|
|
|
|
if "LoadBalancerNames.member" in key:
|
|
|
|
number = key.split('.')[2]
|
2017-02-24 02:37:43 +00:00
|
|
|
load_balancer_name = self._get_param(
|
|
|
|
'LoadBalancerNames.member.{0}'.format(number))
|
2015-12-09 20:30:40 +00:00
|
|
|
elb = self.elb_backend.get_load_balancer(load_balancer_name)
|
|
|
|
if not elb:
|
2016-04-28 13:21:54 +00:00
|
|
|
raise LoadBalancerNotFoundError(load_balancer_name)
|
2015-12-14 11:38:10 +00:00
|
|
|
elbs.append(elb)
|
2015-12-09 20:30:40 +00:00
|
|
|
|
|
|
|
template = self.response_template(DESCRIBE_TAGS_TEMPLATE)
|
2015-12-14 11:38:10 +00:00
|
|
|
return template.render(load_balancers=elbs)
|
2015-12-09 20:30:40 +00:00
|
|
|
|
2016-04-14 13:50:51 +00:00
|
|
|
def _add_tags(self, elb):
|
|
|
|
tag_values = []
|
|
|
|
tag_keys = []
|
|
|
|
|
|
|
|
for t_key, t_val in sorted(self.querystring.items()):
|
|
|
|
if t_key.startswith('Tags.member.'):
|
|
|
|
if t_key.split('.')[3] == 'Key':
|
|
|
|
tag_keys.extend(t_val)
|
|
|
|
elif t_key.split('.')[3] == 'Value':
|
|
|
|
tag_values.extend(t_val)
|
|
|
|
|
|
|
|
counts = {}
|
|
|
|
for i in tag_keys:
|
|
|
|
counts[i] = tag_keys.count(i)
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
counts = sorted(counts.items(), key=lambda i: i[1], reverse=True)
|
2016-04-14 13:50:51 +00:00
|
|
|
|
|
|
|
if counts and counts[0][1] > 1:
|
|
|
|
# We have dupes...
|
|
|
|
raise DuplicateTagKeysError(counts[0])
|
|
|
|
|
|
|
|
for tag_key, tag_value in zip(tag_keys, tag_values):
|
|
|
|
elb.add_tag(tag_key, tag_value)
|
|
|
|
|
|
|
|
|
2015-12-09 20:30:40 +00:00
|
|
|
ADD_TAGS_TEMPLATE = """<AddTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<AddTagsResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>360e81f7-1100-11e4-b6ed-0f30EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</AddTagsResponse>"""
|
|
|
|
|
|
|
|
REMOVE_TAGS_TEMPLATE = """<RemoveTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<RemoveTagsResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>360e81f7-1100-11e4-b6ed-0f30EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</RemoveTagsResponse>"""
|
|
|
|
|
|
|
|
DESCRIBE_TAGS_TEMPLATE = """<DescribeTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DescribeTagsResult>
|
|
|
|
<TagDescriptions>
|
2015-12-14 11:38:10 +00:00
|
|
|
{% for elb in load_balancers %}
|
2015-12-09 20:30:40 +00:00
|
|
|
<member>
|
2015-12-14 11:38:10 +00:00
|
|
|
<LoadBalancerName>{{ elb.name }}</LoadBalancerName>
|
2015-12-09 20:30:40 +00:00
|
|
|
<Tags>
|
2015-12-14 11:38:10 +00:00
|
|
|
{% for key, value in elb.tags.items() %}
|
2015-12-09 20:30:40 +00:00
|
|
|
<member>
|
|
|
|
<Value>{{ value }}</Value>
|
|
|
|
<Key>{{ key }}</Key>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</Tags>
|
|
|
|
</member>
|
2015-12-14 11:38:10 +00:00
|
|
|
{% endfor %}
|
2015-12-09 20:30:40 +00:00
|
|
|
</TagDescriptions>
|
|
|
|
</DescribeTagsResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>360e81f7-1100-11e4-b6ed-0f30EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DescribeTagsResponse>"""
|
|
|
|
|
2015-03-22 14:35:27 +00:00
|
|
|
|
2015-08-24 15:07:14 +00:00
|
|
|
CREATE_LOAD_BALANCER_TEMPLATE = """<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<CreateLoadBalancerResult>
|
2016-04-28 13:21:54 +00:00
|
|
|
<DNSName>{{ load_balancer.dns_name }}</DNSName>
|
2015-08-24 15:07:14 +00:00
|
|
|
</CreateLoadBalancerResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</CreateLoadBalancerResponse>"""
|
2013-07-23 02:50:58 +00:00
|
|
|
|
2014-07-15 00:54:45 +00:00
|
|
|
CREATE_LOAD_BALANCER_LISTENERS_TEMPLATE = """<CreateLoadBalancerListenersResponse xmlns="http://elasticloadbalancing.amazon aws.com/doc/2012-06-01/">
|
|
|
|
<CreateLoadBalancerListenersResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</CreateLoadBalancerListenersResponse>"""
|
|
|
|
|
2015-08-24 15:07:14 +00:00
|
|
|
DELETE_LOAD_BALANCER_TEMPLATE = """<DeleteLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DeleteLoadBalancerResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DeleteLoadBalancerResponse>"""
|
2013-07-23 02:50:58 +00:00
|
|
|
|
|
|
|
DESCRIBE_LOAD_BALANCERS_TEMPLATE = """<DescribeLoadBalancersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DescribeLoadBalancersResult>
|
|
|
|
<LoadBalancerDescriptions>
|
|
|
|
{% for load_balancer in load_balancers %}
|
|
|
|
<member>
|
|
|
|
<SecurityGroups>
|
2017-07-19 22:58:49 +00:00
|
|
|
{% for security_group_id in load_balancer.security_groups %}
|
|
|
|
<member>{{ security_group_id }}</member>
|
|
|
|
{% endfor %}
|
2013-07-23 02:50:58 +00:00
|
|
|
</SecurityGroups>
|
|
|
|
<LoadBalancerName>{{ load_balancer.name }}</LoadBalancerName>
|
2017-04-13 02:25:07 +00:00
|
|
|
<CreatedTime>{{ load_balancer.created_time }}</CreatedTime>
|
2013-07-23 02:50:58 +00:00
|
|
|
<HealthCheck>
|
|
|
|
{% if load_balancer.health_check %}
|
|
|
|
<Interval>{{ load_balancer.health_check.interval }}</Interval>
|
|
|
|
<Target>{{ load_balancer.health_check.target }}</Target>
|
|
|
|
<HealthyThreshold>{{ load_balancer.health_check.healthy_threshold }}</HealthyThreshold>
|
|
|
|
<Timeout>{{ load_balancer.health_check.timeout }}</Timeout>
|
|
|
|
<UnhealthyThreshold>{{ load_balancer.health_check.unhealthy_threshold }}</UnhealthyThreshold>
|
|
|
|
{% endif %}
|
|
|
|
</HealthCheck>
|
2016-04-14 12:43:03 +00:00
|
|
|
{% if load_balancer.vpc_id %}
|
|
|
|
<VPCId>{{ load_balancer.vpc_id }}</VPCId>
|
|
|
|
{% else %}
|
|
|
|
<VPCId />
|
|
|
|
{% endif %}
|
2013-07-23 02:50:58 +00:00
|
|
|
<ListenerDescriptions>
|
|
|
|
{% for listener in load_balancer.listeners %}
|
|
|
|
<member>
|
|
|
|
<PolicyNames>
|
2015-07-14 23:54:58 +00:00
|
|
|
{% for policy_name in listener.policy_names %}
|
|
|
|
<member>{{ policy_name }}</member>
|
|
|
|
{% endfor %}
|
2013-07-23 02:50:58 +00:00
|
|
|
</PolicyNames>
|
|
|
|
<Listener>
|
|
|
|
<Protocol>{{ listener.protocol }}</Protocol>
|
|
|
|
<LoadBalancerPort>{{ listener.load_balancer_port }}</LoadBalancerPort>
|
|
|
|
<InstanceProtocol>{{ listener.protocol }}</InstanceProtocol>
|
|
|
|
<InstancePort>{{ listener.instance_port }}</InstancePort>
|
2014-07-15 00:54:45 +00:00
|
|
|
<SSLCertificateId>{{ listener.ssl_certificate_id }}</SSLCertificateId>
|
2013-07-23 02:50:58 +00:00
|
|
|
</Listener>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</ListenerDescriptions>
|
|
|
|
<Instances>
|
|
|
|
{% for instance_id in load_balancer.instance_ids %}
|
|
|
|
<member>
|
|
|
|
<InstanceId>{{ instance_id }}</InstanceId>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</Instances>
|
|
|
|
<Policies>
|
2015-07-14 23:54:58 +00:00
|
|
|
<AppCookieStickinessPolicies>
|
|
|
|
{% if load_balancer.policies.app_cookie_stickiness_policies %}
|
|
|
|
{% for policy in load_balancer.policies.app_cookie_stickiness_policies %}
|
|
|
|
<member>
|
|
|
|
<CookieName>{{ policy.cookie_name }}</CookieName>
|
|
|
|
<PolicyName>{{ policy.policy_name }}</PolicyName>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
</AppCookieStickinessPolicies>
|
2013-07-23 02:50:58 +00:00
|
|
|
<LBCookieStickinessPolicies>
|
2015-07-14 23:54:58 +00:00
|
|
|
{% if load_balancer.policies.lb_cookie_stickiness_policies %}
|
|
|
|
{% for policy in load_balancer.policies.lb_cookie_stickiness_policies %}
|
|
|
|
<member>
|
|
|
|
{% if policy.cookie_expiration_period %}
|
|
|
|
<CookieExpirationPeriod>{{ policy.cookie_expiration_period }}</CookieExpirationPeriod>
|
|
|
|
{% endif %}
|
|
|
|
<PolicyName>{{ policy.policy_name }}</PolicyName>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2013-07-23 02:50:58 +00:00
|
|
|
</LBCookieStickinessPolicies>
|
2015-07-14 23:54:58 +00:00
|
|
|
<OtherPolicies>
|
|
|
|
{% if load_balancer.policies.other_policies %}
|
|
|
|
{% for policy in load_balancer.policies.other_policies %}
|
|
|
|
<member>{{ policy.policy_name }}</member>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
</OtherPolicies>
|
2013-07-23 02:50:58 +00:00
|
|
|
</Policies>
|
|
|
|
<AvailabilityZones>
|
|
|
|
{% for zone in load_balancer.zones %}
|
|
|
|
<member>{{ zone }}</member>
|
|
|
|
{% endfor %}
|
|
|
|
</AvailabilityZones>
|
2016-05-15 18:04:00 +00:00
|
|
|
<CanonicalHostedZoneName>{{ load_balancer.dns_name }}</CanonicalHostedZoneName>
|
2013-07-23 02:50:58 +00:00
|
|
|
<CanonicalHostedZoneNameID>Z3ZONEID</CanonicalHostedZoneNameID>
|
2015-12-02 22:46:24 +00:00
|
|
|
<Scheme>{{ load_balancer.scheme }}</Scheme>
|
2016-04-28 13:21:54 +00:00
|
|
|
<DNSName>{{ load_balancer.dns_name }}</DNSName>
|
2015-07-14 23:54:58 +00:00
|
|
|
<BackendServerDescriptions>
|
|
|
|
{% for backend in load_balancer.backends %}
|
2017-01-19 04:02:04 +00:00
|
|
|
{% if backend.policy_names %}
|
2015-07-14 23:54:58 +00:00
|
|
|
<member>
|
|
|
|
<InstancePort>{{ backend.instance_port }}</InstancePort>
|
2017-01-19 04:02:04 +00:00
|
|
|
<PolicyNames>
|
|
|
|
{% for policy in backend.policy_names %}
|
|
|
|
<member>{{ policy }}</member>
|
|
|
|
{% endfor %}
|
|
|
|
</PolicyNames>
|
2015-07-14 23:54:58 +00:00
|
|
|
</member>
|
2017-01-19 04:02:04 +00:00
|
|
|
{% endif %}
|
2015-07-14 23:54:58 +00:00
|
|
|
{% endfor %}
|
|
|
|
</BackendServerDescriptions>
|
2013-07-23 02:50:58 +00:00
|
|
|
<Subnets>
|
2016-04-14 12:43:03 +00:00
|
|
|
{% for subnet in load_balancer.subnets %}
|
2016-04-14 12:48:57 +00:00
|
|
|
<member>{{ subnet }}</member>
|
2016-04-14 12:43:03 +00:00
|
|
|
{% endfor %}
|
2013-07-23 02:50:58 +00:00
|
|
|
</Subnets>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</LoadBalancerDescriptions>
|
2017-05-11 01:58:42 +00:00
|
|
|
{% if marker %}
|
|
|
|
<NextMarker>{{ marker }}</NextMarker>
|
|
|
|
{% endif %}
|
2013-07-23 02:50:58 +00:00
|
|
|
</DescribeLoadBalancersResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>f9880f01-7852-629d-a6c3-3ae2-666a409287e6dc0c</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DescribeLoadBalancersResponse>"""
|
|
|
|
|
2017-07-19 22:58:49 +00:00
|
|
|
APPLY_SECURITY_GROUPS_TEMPLATE = """<ApplySecurityGroupsToLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<ApplySecurityGroupsToLoadBalancerResult>
|
|
|
|
<SecurityGroups>
|
|
|
|
{% for security_group_id in security_group_ids %}
|
|
|
|
<member>{{ security_group_id }}</member>
|
|
|
|
{% endfor %}
|
|
|
|
</SecurityGroups>
|
|
|
|
</ApplySecurityGroupsToLoadBalancerResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>f9880f01-7852-629d-a6c3-3ae2-666a409287e6dc0c</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</ApplySecurityGroupsToLoadBalancerResponse>"""
|
|
|
|
|
2015-08-24 15:07:14 +00:00
|
|
|
CONFIGURE_HEALTH_CHECK_TEMPLATE = """<ConfigureHealthCheckResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<ConfigureHealthCheckResult>
|
|
|
|
<HealthCheck>
|
|
|
|
<Interval>{{ check.interval }}</Interval>
|
|
|
|
<Target>{{ check.target }}</Target>
|
|
|
|
<HealthyThreshold>{{ check.healthy_threshold }}</HealthyThreshold>
|
|
|
|
<Timeout>{{ check.timeout }}</Timeout>
|
|
|
|
<UnhealthyThreshold>{{ check.unhealthy_threshold }}</UnhealthyThreshold>
|
|
|
|
</HealthCheck>
|
|
|
|
</ConfigureHealthCheckResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>f9880f01-7852-629d-a6c3-3ae2-666a409287e6dc0c</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</ConfigureHealthCheckResponse>"""
|
|
|
|
|
|
|
|
REGISTER_INSTANCES_TEMPLATE = """<RegisterInstancesWithLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<RegisterInstancesWithLoadBalancerResult>
|
|
|
|
<Instances>
|
|
|
|
{% for instance_id in load_balancer.instance_ids %}
|
|
|
|
<member>
|
|
|
|
<InstanceId>{{ instance_id }}</InstanceId>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</Instances>
|
|
|
|
</RegisterInstancesWithLoadBalancerResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>f9880f01-7852-629d-a6c3-3ae2-666a409287e6dc0c</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</RegisterInstancesWithLoadBalancerResponse>"""
|
|
|
|
|
|
|
|
DEREGISTER_INSTANCES_TEMPLATE = """<DeregisterInstancesFromLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DeregisterInstancesFromLoadBalancerResult>
|
|
|
|
<Instances>
|
|
|
|
{% for instance_id in load_balancer.instance_ids %}
|
|
|
|
<member>
|
|
|
|
<InstanceId>{{ instance_id }}</InstanceId>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</Instances>
|
|
|
|
</DeregisterInstancesFromLoadBalancerResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>f9880f01-7852-629d-a6c3-3ae2-666a409287e6dc0c</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DeregisterInstancesFromLoadBalancerResponse>"""
|
2014-07-15 00:54:45 +00:00
|
|
|
|
|
|
|
SET_LOAD_BALANCER_SSL_CERTIFICATE = """<SetLoadBalancerListenerSSLCertificateResponse xmlns="http://elasticloadbalan cing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<SetLoadBalancerListenerSSLCertificateResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</SetLoadBalancerListenerSSLCertificateResponse>"""
|
|
|
|
|
|
|
|
|
|
|
|
DELETE_LOAD_BALANCER_LISTENERS = """<DeleteLoadBalancerListenersResponse xmlns="http://elasticloadbalan cing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DeleteLoadBalancerListenersResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DeleteLoadBalancerListenersResponse>"""
|
2015-03-22 14:35:27 +00:00
|
|
|
|
|
|
|
DESCRIBE_ATTRIBUTES_TEMPLATE = """<DescribeLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DescribeLoadBalancerAttributesResult>
|
|
|
|
<LoadBalancerAttributes>
|
|
|
|
<AccessLog>
|
|
|
|
<Enabled>{{ attributes.access_log.enabled }}</Enabled>
|
|
|
|
{% if attributes.access_log.enabled %}
|
|
|
|
<S3BucketName>{{ attributes.access_log.s3_bucket_name }}</S3BucketName>
|
|
|
|
<S3BucketPrefix>{{ attributes.access_log.s3_bucket_prefix }}</S3BucketPrefix>
|
|
|
|
<EmitInterval>{{ attributes.access_log.emit_interval }}</EmitInterval>
|
|
|
|
{% endif %}
|
|
|
|
</AccessLog>
|
|
|
|
<ConnectionSettings>
|
|
|
|
<IdleTimeout>{{ attributes.connecting_settings.idle_timeout }}</IdleTimeout>
|
|
|
|
</ConnectionSettings>
|
|
|
|
<CrossZoneLoadBalancing>
|
|
|
|
<Enabled>{{ attributes.cross_zone_load_balancing.enabled }}</Enabled>
|
|
|
|
</CrossZoneLoadBalancing>
|
|
|
|
<ConnectionDraining>
|
|
|
|
{% if attributes.connection_draining.enabled %}
|
2017-05-31 22:53:31 +00:00
|
|
|
<Enabled>true</Enabled>
|
2015-03-22 14:35:27 +00:00
|
|
|
<Timeout>{{ attributes.connection_draining.timeout }}</Timeout>
|
2017-05-31 22:53:31 +00:00
|
|
|
{% else %}
|
|
|
|
<Enabled>false</Enabled>
|
2015-03-22 14:35:27 +00:00
|
|
|
{% endif %}
|
|
|
|
</ConnectionDraining>
|
|
|
|
</LoadBalancerAttributes>
|
|
|
|
</DescribeLoadBalancerAttributesResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DescribeLoadBalancerAttributesResponse>
|
|
|
|
"""
|
|
|
|
|
|
|
|
MODIFY_ATTRIBUTES_TEMPLATE = """<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<ModifyLoadBalancerAttributesResult>
|
2017-05-31 22:53:31 +00:00
|
|
|
<LoadBalancerName>{{ load_balancer.name }}</LoadBalancerName>
|
2015-03-22 14:35:27 +00:00
|
|
|
<LoadBalancerAttributes>
|
|
|
|
<AccessLog>
|
|
|
|
<Enabled>{{ attributes.access_log.enabled }}</Enabled>
|
|
|
|
{% if attributes.access_log.enabled %}
|
|
|
|
<S3BucketName>{{ attributes.access_log.s3_bucket_name }}</S3BucketName>
|
|
|
|
<S3BucketPrefix>{{ attributes.access_log.s3_bucket_prefix }}</S3BucketPrefix>
|
|
|
|
<EmitInterval>{{ attributes.access_log.emit_interval }}</EmitInterval>
|
|
|
|
{% endif %}
|
|
|
|
</AccessLog>
|
|
|
|
<ConnectionSettings>
|
|
|
|
<IdleTimeout>{{ attributes.connecting_settings.idle_timeout }}</IdleTimeout>
|
|
|
|
</ConnectionSettings>
|
|
|
|
<CrossZoneLoadBalancing>
|
|
|
|
<Enabled>{{ attributes.cross_zone_load_balancing.enabled }}</Enabled>
|
|
|
|
</CrossZoneLoadBalancing>
|
|
|
|
<ConnectionDraining>
|
|
|
|
{% if attributes.connection_draining.enabled %}
|
2017-05-31 22:53:31 +00:00
|
|
|
<Enabled>true</Enabled>
|
2015-03-22 14:35:27 +00:00
|
|
|
<Timeout>{{ attributes.connection_draining.timeout }}</Timeout>
|
2017-05-31 22:53:31 +00:00
|
|
|
{% else %}
|
|
|
|
<Enabled>false</Enabled>
|
2015-03-22 14:35:27 +00:00
|
|
|
{% endif %}
|
2015-03-22 20:00:16 +00:00
|
|
|
</ConnectionDraining>
|
2015-03-22 14:35:27 +00:00
|
|
|
</LoadBalancerAttributes>
|
|
|
|
</ModifyLoadBalancerAttributesResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</ModifyLoadBalancerAttributesResponse>
|
|
|
|
"""
|
|
|
|
|
2015-07-14 23:54:58 +00:00
|
|
|
CREATE_LOAD_BALANCER_POLICY_TEMPLATE = """<CreateLoadBalancerPolicyResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<CreateLoadBalancerPolicyResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</CreateLoadBalancerPolicyResponse>
|
|
|
|
"""
|
|
|
|
|
|
|
|
SET_LOAD_BALANCER_POLICIES_OF_LISTENER_TEMPLATE = """<SetLoadBalancerPoliciesOfListenerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<SetLoadBalancerPoliciesOfListenerResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>07b1ecbc-1100-11e3-acaf-dd7edEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</SetLoadBalancerPoliciesOfListenerResponse>
|
|
|
|
"""
|
|
|
|
|
|
|
|
SET_LOAD_BALANCER_POLICIES_FOR_BACKEND_SERVER_TEMPLATE = """<SetLoadBalancerPoliciesForBackendServerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<SetLoadBalancerPoliciesForBackendServerResult/>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>0eb9b381-dde0-11e2-8d78-6ddbaEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</SetLoadBalancerPoliciesForBackendServerResponse>
|
|
|
|
"""
|
|
|
|
|
2015-03-22 20:00:16 +00:00
|
|
|
DESCRIBE_INSTANCE_HEALTH_TEMPLATE = """<DescribeInstanceHealthResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
|
|
<DescribeInstanceHealthResult>
|
|
|
|
<InstanceStates>
|
2018-08-06 08:47:00 +00:00
|
|
|
{% for instance in instances %}
|
2015-03-22 20:00:16 +00:00
|
|
|
<member>
|
|
|
|
<Description>N/A</Description>
|
2018-08-06 08:47:00 +00:00
|
|
|
<InstanceId>{{ instance['InstanceId'] }}</InstanceId>
|
|
|
|
<State>{{ instance['State'] }}</State>
|
2015-03-22 20:00:16 +00:00
|
|
|
<ReasonCode>N/A</ReasonCode>
|
|
|
|
</member>
|
|
|
|
{% endfor %}
|
|
|
|
</InstanceStates>
|
|
|
|
</DescribeInstanceHealthResult>
|
|
|
|
<ResponseMetadata>
|
|
|
|
<RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId>
|
|
|
|
</ResponseMetadata>
|
|
|
|
</DescribeInstanceHealthResponse>"""
|