in src/lakeformation_permissions/central/lambda_function.py [0:0]
def revoke_lf_permissions(principal_json, table_json, tableWithColumns_json, perm_json, perm_grant_json):
"""
Revokes the specified permissions to the Pricncipal on the Respective resources
Arguments:
principal_json {dict} -- Principal which requries grant
table_json {dict} -- Resource to grant permissions
tableWithColumns_json {dict} -- Resource to grant permissions
perm_json {dict} -- permissions that are applied to the resource
perm_grant_json {dict} -- grantable permission on the resource
Returns:
response {dict} -- Response from Lakeformation API call
"""
logger.info('Revoking Lakeformation Permissions ...')
try:
resource = {}
if table_json:
resource['Table'] = table_json
elif tableWithColumns_json:
resource['TableWithColumns'] = tableWithColumns_json
client = boto3.client('lakeformation', config=Config(connect_timeout=5, read_timeout=60, retries={'max_attempts': 20}))
response= client.revoke_permissions(Principal=principal_json,
Resource=resource,
Permissions=perm_json['Permissions'])
logger.info('Revoke permissions API response: {}'.format(response))
return response
except Exception as e:
logger.info("Revoke permissions Method failed with exception {}".format(e))
raise e