HuaweiContext
@h4ad/serverless-adapter > HuaweiContext
(interface) HuaweiContext
The interface that represents methods sent by huawei to get information about the function graph. See more in Context Methods
Signature:
export interface HuaweiContext
(method) getAccessKey
Obtains the AK (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
Signature:
getAccessKey(): GetAccessKeyReturn;
Returns:
(method) getCPUNumber
Number of CPU millicores used by the function (1 core = 1000 millicores).
The value of this field is proportional to that of MemorySize. By default, 100 CPU millicores are required for 128 MB memory. The number of CPU millicores is calculated as follows: Memory/128 x 100 + 200 (basic CPU millicores).
Signature:
getCPUNumber(): GetCPUNumberReturn;
Returns:
(method) getFunctionName
Obtains the name of a function.
Signature:
getFunctionName(): GetFunctionNameReturn;
Returns:
(method) getLogger
Obtains the logger method provided by the context and returns a log output class. Logs are output in the format of Time-Request ID-Content by using the info method.
For example, use the info method to output logs:
Signature:
getLogger(): GetLoggerReturn;
Returns:
Example
logg = context.getLogger()
logg.info("hello")
(method) getMemorySize
Obtains the allocated memory.
Signature:
getMemorySize(): GetMemorySizeReturn;
Returns:
(method) getPackage
Obtains a function group, that is, an app.
Signature:
getPackage(): GetPackageReturn;
Returns:
(method) getProjectID
Obtains a project ID.
Signature:
getProjectID(): GetProjectIdReturn;
Returns:
(method) getRemainingTimeInMilliSeconds
Obtains the remaining running time of a function.
Signature:
getRemainingTimeInMilliSeconds(): GetRemainingTimeInMilliSecondsReturn;
Returns:
GetRemainingTimeInMilliSecondsReturn
(method) getRequestID
Obtains a request ID.
Signature:
getRequestID(): GetRequestIDSecondsReturn;
Returns:
(method) getRunningTimeInSeconds
Obtains the timeout of a function.
Signature:
getRunningTimeInSeconds(): GetRunningTimeInSecondsReturn;
Returns:
(method) getSecretKey
Obtains the SK (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
Signature:
getSecretKey(): GetSecretKeyReturn;
Returns:
(method) getToken
Obtains the token (valid for 24 hours) of an agency. If you use this method, you need to configure an agency for the function.
Signature:
getToken(): GetTokenReturn;
Returns:
(method) getUserData
Uses keys to obtain the values passed by environment variables.
Signature:
getUserData(key: GetUserDataKeyParameter): GetUserDataReturn;
Parameters
Parameter | Type | Description |
---|---|---|
key | The key to get environment variables values |
Returns:
(method) getVersion
Obtains the version of a function.
Signature:
getVersion(): GetVersionReturn;
Returns: