def get_custom_role_arn()

in resources/flink-on-kda/index.py [0:0]


def get_custom_role_arn(context):
    try:
        function_name = context.function_name
        stack_name = context.function_name.split('LambdaScaler')[0][:-1]

        response = client_cloudformation.describe_stack_resource(
            StackName=stack_name,
            LogicalResourceId='CustomApplicationAutoScalingServiceRole'
        )

        CustomRoleId = response['StackResourceDetail']['PhysicalResourceId']
        role = client_iam.Role(CustomRoleId)
        
        return role.arn
    except Exception as e:
        print("Exception in get_resource_id: " + str(e))
        return None