class FDK::Context

Represents the Fn context for a function execution

Attributes

headers[R]

FN_APP_ID -the ID of the application that this function is a member of. FN_APP_NAME - the name of the application. FN_CALL_ID - a unique ID for each function execution. FN_FN_ID - the ID of this function FN_MEMORY - a number representing the amount of memory available to the call, in MB $X - any configuration values you've set for the Application.

Replace X with the upper cased name of the config variable you set.
e.g. minio_secret=secret will be exposed via MINIO_SECRET env var.
response_headers[R]

Public Class Methods

new(headers_in, headers_out) click to toggle source
# File lib/fdk/context.rb, line 88
def initialize(headers_in, headers_out)
  @headers = headers_in
  @response_headers = headers_out
  @config ||= Config.new
end

Public Instance Methods

app_id() click to toggle source
# File lib/fdk/context.rb, line 98
def app_id
  @config["FN_APP_ID"]
end
call_id() click to toggle source
# File lib/fdk/context.rb, line 94
def call_id
  @headers["fn-call-id"]
end
content_type() click to toggle source
# File lib/fdk/context.rb, line 114
def content_type
  @headers["content-type"]
end
deadline() click to toggle source
# File lib/fdk/context.rb, line 106
def deadline
  DateTime.iso8601(@headers["fn-deadline"])
end
fn_id() click to toggle source
# File lib/fdk/context.rb, line 102
def fn_id
  @config["FN_FN_ID"]
end
http_context() click to toggle source
# File lib/fdk/context.rb, line 118
def http_context
  HTTPContext.new(self)
end
memory() click to toggle source
# File lib/fdk/context.rb, line 110
def memory
  @config["FN_MEMORY"].to_i
end