in Lambda/TagOnRestore/src/TagOnRestore.py [0:0]
def __init__(self, event, context):
"""
Initialization function. Sets all the environment variables and default values
"""
self.session_id = boto3.session.Session().client('sts').get_caller_identity()
self.account_id = boto3.client('sts').get_caller_identity()['Account']
self.deployment_region = boto3.session.Session().region_name
self.function_arn = context.invoked_function_arn
# Extract the Uid from the ARN
self.tag_replicator_stack_id = os.environ.get('TagOnRestoreStackId').split('/')[2]
self.tags_to_exclude_when_copying = os.environ.get('TagOnRestoreTagsToExclude')
if not self.tags_to_exclude_when_copying:
self.tags_to_exclude_when_copying = 'aws:backup:source-resource'
self.tags_to_exclude_when_copying = self.tags_to_exclude_when_copying.split(',')