Add organizations.untag_resource
This commit is contained in:
parent
c10afa3ab5
commit
d0ef72725c
4 changed files with 55 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -129,3 +129,8 @@ class OrganizationsResponse(BaseResponse):
|
|||
return json.dumps(
|
||||
self.organizations_backend.list_tags_for_resource(**self.request_params)
|
||||
)
|
||||
|
||||
def untag_resource(self):
|
||||
return json.dumps(
|
||||
self.organizations_backend.untag_resource(**self.request_params)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue