Implemented autoscale method create_or_update_tags

This commit is contained in:
Jesse Chahal 2016-06-16 17:24:50 -07:00
parent 4372c346d9
commit 0efea0af2b
2 changed files with 12 additions and 0 deletions

View File

@ -440,6 +440,13 @@ class AutoScalingBackend(BaseBackend):
self.elb_backend.register_instances(elb.name, group_instance_ids - elb_instace_ids)
self.elb_backend.deregister_instances(elb.name, elb_instace_ids - group_instance_ids)
def create_or_update_tags(self, tags):
for tag in tags:
group_name = tag["ResourceId"]
group = self.autoscaling_groups[group_name]
updated_tags = group.tags.copy()
updated_tags.update(tag)
group.tags = updated_tags
autoscaling_backends = {}
for region, ec2_backend in ec2_backends.items():

View File

@ -105,6 +105,11 @@ class AutoScalingResponse(BaseResponse):
template = self.response_template(SET_DESIRED_CAPACITY_TEMPLATE)
return template.render()
def create_or_update_tags(self):
tags = self._get_param('Tags')
self.autoscaling_backend.create_or_update_tags(tags)
return None
def describe_auto_scaling_instances(self):
instance_states = self.autoscaling_backend.describe_autoscaling_instances()
template = self.response_template(DESCRIBE_AUTOSCALING_INSTANCES_TEMPLATE)