Adding account id to ManagedPolicy ARN
This commit is contained in:
parent
ba1ceee95f
commit
ff80ecb56d
2 changed files with 30 additions and 17 deletions
|
|
@ -50,10 +50,6 @@ class Policy(BaseModel):
|
|||
self.create_datetime = datetime.now(pytz.utc)
|
||||
self.update_datetime = datetime.now(pytz.utc)
|
||||
|
||||
@property
|
||||
def arn(self):
|
||||
return 'arn:aws:iam::aws:policy{0}{1}'.format(self.path, self.name)
|
||||
|
||||
|
||||
class PolicyVersion(object):
|
||||
|
||||
|
|
@ -82,6 +78,10 @@ class ManagedPolicy(Policy):
|
|||
self.attachment_count -= 1
|
||||
del obj.managed_policies[self.name]
|
||||
|
||||
@property
|
||||
def arn(self):
|
||||
return "arn:aws:iam::{0}:policy{1}{2}".format(ACCOUNT_ID, self.path, self.name)
|
||||
|
||||
|
||||
class AWSManagedPolicy(ManagedPolicy):
|
||||
"""AWS-managed policy."""
|
||||
|
|
@ -93,6 +93,10 @@ class AWSManagedPolicy(ManagedPolicy):
|
|||
path=data.get('Path'),
|
||||
document=data.get('Document'))
|
||||
|
||||
@property
|
||||
def arn(self):
|
||||
return 'arn:aws:iam::aws:policy{0}{1}'.format(self.path, self.name)
|
||||
|
||||
|
||||
# AWS defines some of its own managed policies and we periodically
|
||||
# import them via `make aws_managed_policies`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue