def get_resource_id()

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


def get_resource_id(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='ScalerApi'
        )

        ApiId = response['StackResourceDetail']['PhysicalResourceId']

        ApiResourceId = "https://" + ApiId + ".execute-api." + os.environ['AWS_REGION'] + ".amazonaws.com/prod/scalableTargetDimensions/" + os.environ['KDAAppName']

        return ApiResourceId
    except Exception as e:
        print("Exception in get_resource_id: " + str(e))
        return None