enext-gdp 0.1.3
Jabil eNext GDP framework

# Overview

This is helper code developed to handle use cases

## Deployment

No deployment method currently, to utilize code please take the helpers you need.

Long term -> turning this into a package and adding into the Lambda Layers for GDL

## Helpers

### Config Helper

### Permission Helper

Main Methods:

- grantPermissions: This method grants/revokes permissions on the resource or tag level defined in resourceInfo
Helper Methods:
- findDif: Finds the difference between the current and desired set of permissions. This outputs a dictionary that defines what to add and remove at the permission and permission grant level
- listPermissions: Finds the current permissions on the resource or tag for that principal based on resource info passed in
- updateCol:This handles the edge cases of updating column level permissions. In particular this would remove any old column that are no longer listed and remove all permissions if no new column existed
- buildResource: This builds the resource block that most lakeformation API calls require

Example Resource Infos:
resourceInfo_DB = {
    'principal': IAM_ARN,
    'resourceType': "database",
    'resourceName': "zipcode",
    'permissions': ['DESCRIBE'],
    'permissionsGrant': ['DESCRIBE']
}
resourceInfo_Table = {
    'principal': IAM_ARN,
    'resourceType': "table",
    'resourceName': {
        'db': "zipcode",
        'table': "zipcode"
    },
    'permissions': ['DESCRIBE'],
    'permissionsGrant': []
}
resourceInfo_Col = {
    'principal': IAM_ARN,
    'resourceType': "catalog",
    'resourceName': {
        'db': "zipcode",
        'table': "zipcode",
        'columns': ['count_gender_total']
    },
    'permissions': ['SELECT'],
    'permissionsGrant': []
}
resourceInfo_tags = {
    'principal': IAM_ARN,
    'resourceType': "lf_tag",
    'resourceName': {
        'tagLevel': 'table', #database or table
        'tags': [
            {'segment': 'ent'},
            {'confidentiality': 'private'}
        ]
    },
    'permissions': ['DESCRIBE'],
    'permissionsGrant': []
}

### Tag Helper

Main Methods:

- tag: This method grants/revokes tags on the resource defined in resourceInfo
Helper Methods:
- findDif: Finds the difference between the current and desired set of tags. This outputs a dictionary that defines what to add and remove
- listTags: Finds the current tags on the resource
- buildTags: Builds the dictionary of TagKey and TagValues that are needed for the lakeformation API calls
- checkError: This checks if there were any failures based on the response from lakeformation API call add_lf_tags_to_resource/remove_lf_tags_from_resource
- buildResource: This builds the resource block that most lakeformation API calls require

Example Resource Infos:

resourceInfo_DB = {
    'resourceType': "database",
    'resourceName': "zipcode",
    'tags': [
        {'segment': 'ent'},
        {'confidentiality': 'public'},
    ]
}
resourceInfo_Table = {
    'resourceType': "table",
    'resourceName': {
        'db': "zipcode",
        'table': "zipcode",
    },
    'tags': [
        {'segment': 'eip'},
        {'confidentiality': 'public'},
    ]
}
resourceInfo_TableCol = {
    'resourceType': "columns",
    'resourceName': {
        'db': "zipcode",
        'table': "zipcode",
        'columns': ['count_gender_total']
    },
    'tags': [
        {'confidentiality': 'public'},
    ]
}