Add organizations.tag_resource
This commit is contained in:
parent
d242a31c92
commit
febec75364
4 changed files with 49 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ class FakeAccount(BaseModel):
|
|||
self.joined_method = "CREATED"
|
||||
self.parent_id = organization.root_id
|
||||
self.attached_policies = []
|
||||
self.tags = {}
|
||||
|
||||
@property
|
||||
def arn(self):
|
||||
|
|
@ -442,5 +443,17 @@ class OrganizationsBackend(BaseBackend):
|
|||
]
|
||||
return dict(Targets=objects)
|
||||
|
||||
def tag_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.",
|
||||
)
|
||||
|
||||
new_tags = {tag["Key"]: tag["Value"] for tag in kwargs["Tags"]}
|
||||
account.tags.update(new_tags)
|
||||
|
||||
|
||||
organizations_backend = OrganizationsBackend()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue