Add organizations.untag_resource

This commit is contained in:
gruebel 2019-11-17 15:28:38 +01:00
commit d0ef72725c
4 changed files with 55 additions and 1 deletions

View file

@ -467,5 +467,17 @@ class OrganizationsBackend(BaseBackend):
tags = [{"Key": key, "Value": value} for key, value in account.tags.items()]
return dict(Tags=tags)
def untag_resource(self, **kwargs):
account = next((a for a in self.accounts if a.id == kwargs["ResourceId"]), None)
if account is None:
raise RESTError(
"InvalidInputException",
"You provided a value that does not match the required pattern.",
)
for key in kwargs["TagKeys"]:
account.tags.pop(key, None)
organizations_backend = OrganizationsBackend()