Invoking FunctionGraph Event Function from Go

Following pages demonstrate how to call a FunctionGraph implemented in python using Go:

Prerequisites

Environment Variables

Needed environment variables set

Environment Variables

Name

Description

OTC_SDK_PROJECTID

Project ID

OTC_SDK_REGION

Region, e.g. “eu-de”

OTC_SDK_AK

Access Key

OTC_SDK_SK

Secret Key

OTC_USER_NAME

User name

OTC_USER_PASSWORD

User password

OTC_DOMAIN_NAME

Domain name

OTC_IAM_ENDPOINT

IAM Endpoint, e.g. https://iam.eu-de.otc.t-systems.com/v3

Deployed FunctionGraph Event Function

Example FunctionGraph written in python

Example FunctionGraph: functionGraph.py
# -*- coding:utf-8 -*-
import json
def handler (event, context):
  return {
    "statusCode": 200,
    "isBase64Encoded": False,
    "body": json.dumps(event),
    "headers": {
    "Content-Type": "application/json"
    }
  }

Deploy this FunctionGraph as follows:

  • Type: “Event Function”:

  • Name: “DefaultPython3_10_From_Go_SDK”

  • Agency: “Use no agency”

  • Runtime: “python 3.10”

  • Application: “default”

  • Handler: “index.handler”