implement target group tagging

This commit is contained in:
Jack Danger 2017-09-16 19:53:09 -07:00
commit 4b7a157560
3 changed files with 51 additions and 21 deletions

View file

@ -65,6 +65,7 @@ class FakeTargetGroup(BaseModel):
self.healthy_threshold_count = healthy_threshold_count
self.unhealthy_threshold_count = unhealthy_threshold_count
self.load_balancer_arns = []
self.tags = {}
self.attributes = {
'deregistration_delay.timeout_seconds': 300,
@ -86,6 +87,11 @@ class FakeTargetGroup(BaseModel):
if not t:
raise InvalidTargetError()
def add_tag(self, key, value):
if len(self.tags) >= 10 and key not in self.tags:
raise TooManyTagsError()
self.tags[key] = value
def health_for(self, target):
t = self.targets.get(target['id'])
if t is None: