Skip to content

Commit

Permalink
Add AWS::Organizations support (#2102)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvcl authored Nov 26, 2022
1 parent 6db9eb0 commit ce2139b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
57 changes: 57 additions & 0 deletions troposphere/organizations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***


from . import AWSObject, PropsDictType, Tags
from .validators.organizations import validate_policy_type


class Account(AWSObject):
"""
`Account <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-organizations-account.html>`__
"""

resource_type = "AWS::Organizations::Account"

props: PropsDictType = {
"AccountName": (str, True),
"Email": (str, True),
"ParentIds": ([str], False),
"RoleName": (str, False),
"Tags": (Tags, False),
}


class OrganizationalUnit(AWSObject):
"""
`OrganizationalUnit <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-organizations-organizationalunit.html>`__
"""

resource_type = "AWS::Organizations::OrganizationalUnit"

props: PropsDictType = {
"Name": (str, True),
"ParentId": (str, True),
"Tags": (Tags, False),
}


class Policy(AWSObject):
"""
`Policy <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-organizations-policy.html>`__
"""

resource_type = "AWS::Organizations::Policy"

props: PropsDictType = {
"Content": (str, True),
"Description": (str, False),
"Name": (str, True),
"Tags": (Tags, False),
"TargetIds": ([str], False),
"Type": (validate_policy_type, True),
}
16 changes: 16 additions & 0 deletions troposphere/validators/organizations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.


def validate_policy_type(policy_type):
valid_types = [
"AISERVICES_OPT_OUT_POLICY",
"BACKUP_POLICY",
"SERVICE_CONTROL_POLICY",
"TAG_POLICY",
]
if policy_type not in valid_types:
raise ValueError("Type must be one of: %s" % ", ".join(valid_types))
return policy_type

0 comments on commit ce2139b

Please sign in to comment.