Skip to content

Commit

Permalink
Lakeformation: remove ResourceProperty naming conflict (#2088)
Browse files Browse the repository at this point in the history
Use PrincipalResource for the PrincipalPermissions.Resource Property
to remove a naming conflict with Permissions.Resource.
  • Loading branch information
markpeek authored Nov 14, 2022
1 parent 1642f13 commit 6499cd5
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 67 deletions.
11 changes: 11 additions & 0 deletions scripts/patches/lakeformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
"op": "remove",
"path": "/PropertyTypes/AWS::LakeFormation::PrincipalPermissions.Resource/Properties/Catalog/Type",
},
# Rename AWS::LakeFormation::PrincipalPermissions.Resource to AWS::LakeFormation::PrincipalPermissions.PrincipalResource
{
"op": "move",
"from": "/PropertyTypes/AWS::LakeFormation::PrincipalPermissions.Resource",
"path": "/PropertyTypes/AWS::LakeFormation::PrincipalPermissions.PrincipalResource",
},
{
"op": "replace",
"path": "/ResourceTypes/AWS::LakeFormation::PrincipalPermissions/Properties/Resource/Type",
"value": "PrincipalResource",
},
{
"op": "add",
"path": "/PropertyTypes/AWS::LakeFormation::TagAssociation.Resource/Properties/Catalog/PrimitiveType",
Expand Down
147 changes: 80 additions & 67 deletions troposphere/lakeformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,114 +72,153 @@ class DataLakeSettings(AWSObject):
}


class DataCellsFilterResource(AWSProperty):
class DatabaseResource(AWSProperty):
"""
`DataCellsFilterResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-datacellsfilterresource.html>`__
`DatabaseResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-tagassociation-databaseresource.html>`__
"""

props: PropsDictType = {
"DatabaseName": (str, True),
"CatalogId": (str, True),
"Name": (str, True),
"TableCatalogId": (str, True),
"TableName": (str, True),
}


class DataLocationResource(AWSProperty):
class PermissionsDataLocationResource(AWSProperty):
"""
`DataLocationResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-datalocationresource.html>`__
`PermissionsDataLocationResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-datalocationresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, False),
"S3Resource": (str, False),
}


class TableWildcard(AWSProperty):
"""
`TableWildcard <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-tablewildcard.html>`__
"""

props: PropsDictType = {}


class TableResource(AWSProperty):
"""
`TableResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-tagassociation-tableresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"ResourceArn": (str, True),
"DatabaseName": (str, True),
"Name": (str, False),
"TableWildcard": (TableWildcard, False),
}


class DatabaseResource(AWSProperty):
class TableWithColumnsResource(AWSProperty):
"""
`DatabaseResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-tagassociation-databaseresource.html>`__
`TableWithColumnsResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-tablewithcolumnsresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"ColumnNames": ([str], False),
"ColumnWildcard": (ColumnWildcard, False),
"DatabaseName": (str, True),
"Name": (str, True),
}


class LFTagKeyResource(AWSProperty):
class ResourceProperty(AWSProperty):
"""
`LFTagKeyResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftagkeyresource.html>`__
`ResourceProperty <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-resource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"TagKey": (str, True),
"TagValues": ([str], True),
"DataLocationResource": (PermissionsDataLocationResource, False),
"DatabaseResource": (DatabaseResource, False),
"TableResource": (TableResource, False),
"TableWithColumnsResource": (TableWithColumnsResource, False),
}


class LFTag(AWSProperty):
class Permissions(AWSObject):
"""
`LFTag <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftag.html>`__
`Permissions <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-permissions.html>`__
"""

resource_type = "AWS::LakeFormation::Permissions"

props: PropsDictType = {
"TagKey": (str, False),
"TagValues": ([str], False),
"DataLakePrincipal": (DataLakePrincipal, True),
"Permissions": ([str], False),
"PermissionsWithGrantOption": ([str], False),
"Resource": (ResourceProperty, True),
}


class LFTagPolicyResource(AWSProperty):
class DataCellsFilterResource(AWSProperty):
"""
`LFTagPolicyResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftagpolicyresource.html>`__
`DataCellsFilterResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-datacellsfilterresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"Expression": ([LFTag], True),
"ResourceType": (str, True),
"DatabaseName": (str, True),
"Name": (str, True),
"TableCatalogId": (str, True),
"TableName": (str, True),
}


class TableWildcard(AWSProperty):
class DataLocationResource(AWSProperty):
"""
`TableWildcard <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-tablewildcard.html>`__
`DataLocationResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-datalocationresource.html>`__
"""

props: PropsDictType = {}
props: PropsDictType = {
"CatalogId": (str, True),
"ResourceArn": (str, True),
}


class TableResource(AWSProperty):
class LFTagKeyResource(AWSProperty):
"""
`TableResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-tagassociation-tableresource.html>`__
`LFTagKeyResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftagkeyresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"DatabaseName": (str, True),
"Name": (str, False),
"TableWildcard": (TableWildcard, False),
"TagKey": (str, True),
"TagValues": ([str], True),
}


class TableWithColumnsResource(AWSProperty):
class LFTag(AWSProperty):
"""
`TableWithColumnsResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-tablewithcolumnsresource.html>`__
`LFTag <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftag.html>`__
"""

props: PropsDictType = {
"TagKey": (str, False),
"TagValues": ([str], False),
}


class LFTagPolicyResource(AWSProperty):
"""
`LFTagPolicyResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-lftagpolicyresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, True),
"ColumnNames": ([str], False),
"ColumnWildcard": (ColumnWildcard, False),
"DatabaseName": (str, True),
"Name": (str, True),
"Expression": ([LFTag], True),
"ResourceType": (str, True),
}


class ResourceProperty(AWSProperty):
class PrincipalResource(AWSProperty):
"""
`ResourceProperty <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-resource.html>`__
`PrincipalResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-principalpermissions-resource.html>`__
"""

props: PropsDictType = {
Expand All @@ -194,21 +233,6 @@ class ResourceProperty(AWSProperty):
}


class Permissions(AWSObject):
"""
`Permissions <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-permissions.html>`__
"""

resource_type = "AWS::LakeFormation::Permissions"

props: PropsDictType = {
"DataLakePrincipal": (DataLakePrincipal, True),
"Permissions": ([str], False),
"PermissionsWithGrantOption": ([str], False),
"Resource": (ResourceProperty, True),
}


class PrincipalPermissions(AWSObject):
"""
`PrincipalPermissions <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-principalpermissions.html>`__
Expand All @@ -221,7 +245,7 @@ class PrincipalPermissions(AWSObject):
"Permissions": ([str], True),
"PermissionsWithGrantOption": ([str], True),
"Principal": (DataLakePrincipal, True),
"Resource": (ResourceProperty, True),
"Resource": (PrincipalResource, True),
}


Expand Down Expand Up @@ -302,14 +326,3 @@ class TagAssociation(AWSObject):
"LFTags": ([LFTagPair], True),
"Resource": (TagAssociationResource, True),
}


class PermissionsDataLocationResource(AWSProperty):
"""
`PermissionsDataLocationResource <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-datalocationresource.html>`__
"""

props: PropsDictType = {
"CatalogId": (str, False),
"S3Resource": (str, False),
}

0 comments on commit 6499cd5

Please sign in to comment.