Invoking FunctionGraph Functions¶
Following pages demonstrate how to call a FunctionGraph implemented in PHP:
For details on function invocation, see
in FunctionGraph API reference.
Prerequisites¶
Environment Variables¶
Following environment variables need to be set:
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 |
(* User needs to have permission to invoke FunctionGraph)
Deployed FunctionGraph Event Function¶
Use following settings to create the FunctionGraph event function using the FunctionGraph console:
Project : as specified in the environment variable
OTC_SDK_PROJECTIDRegion: as specified in the environment variable
OTC_SDK_REGIONName:
php-sample-invoke-functionRuntime:
PHP 8.3Version:
latestApplication:
defaultFunction code: Use the following sample code for the function code.
<?php function handler($event, $context) { $logger = $context->getLogger(); $logger->info("Function name: " . $context->getFunctionName()); return [ "statusCode" => 200, "isBase64Encoded" => false, "body" => json_encode($event), "headers" => [ "Content-Type" => "application/json" ] ]; }
Handler name:
index.handler
Permissions¶
Make sure that your user has the necessary permissions to invoke the function.