[][src]Struct lambda_runtime::Context

pub struct Context {
    pub memory_limit_in_mb: i32,
    pub function_name: String,
    pub function_version: String,
    pub invoked_function_arn: String,
    pub aws_request_id: String,
    pub xray_trace_id: Option<String>,
    pub log_stream_name: String,
    pub log_group_name: String,
    pub client_context: Option<ClientContext>,
    pub identity: Option<CognitoIdentity>,
    pub deadline: i64,
}

The Lambda function execution context. The values in this struct are populated using the Lambda environment variables and the headers returned by the poll request to the Runtime APIs. A new instance of the Context object is passed to each handler invocation.

Fields

memory_limit_in_mb: i32

The amount of memory allocated to the Lambda function in Mb. This value is extracted from the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable set by the Lambda service.

function_name: String

The name of the Lambda function as registered with the Lambda service. The value is extracted from the AWS_LAMBDA_FUNCTION_NAME environment variable set by the Lambda service.

function_version: String

The version of the function being invoked. This value is extracted from the AWS_LAMBDA_FUNCTION_VERSION environment variable set by the Lambda service.

invoked_function_arn: String

The fully qualified ARN (Amazon Resource Name) for the function invocation event. This value is returned by the Lambda Runtime APIs as a header.

aws_request_id: String

The AWS request ID for the current invocation event. This value is returned by the Lambda Runtime APIs as a header.

xray_trace_id: Option<String>

The X-Ray trace ID for the current invocation. This value is returned by the Lambda Runtime APIs as a header. Developers can use this value with the AWS SDK to create new, custom sub-segments to the current invocation.

log_stream_name: String

The name of the CloudWatch log stream for the current execution environment. This value is extracted from the AWS_LAMBDA_LOG_STREAM_NAME environment variable set by the Lambda service.

log_group_name: String

The name of the CloudWatch log group for the current execution environment. This value is extracted from the AWS_LAMBDA_LOG_GROUP_NAME environment variable set by the Lambda service.

client_context: Option<ClientContext>

The client context sent by the AWS Mobile SDK with the invocation request. This value is returned by the Lambda Runtime APIs as a header. This value is populated only if the invocation request originated from an AWS Mobile SDK or an SDK that attached the client context information to the request.

identity: Option<CognitoIdentity>

The information of the Cognito identity that sent the invocation request to the Lambda service. This value is returned by the Lambda Runtime APIs in a header and it's only populated if the invocation request was performed with AWS credentials federated through the Cognito identity service.

deadline: i64

The deadline for the current handler execution in milliseconds, based on a unix MONOTONIC clock.

Methods

impl Context[src]

pub fn get_time_remaining_millis(&self) -> i64[src]

Returns the remaining time in the execution in milliseconds. This is based on the deadline header passed by Lambda's Runtime APIs.

Trait Implementations

impl Clone for Context[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Context[src]

Auto Trait Implementations

impl Send for Context

impl Sync for Context

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T