Class: FDK::Context
- Inherits:
-
Object
- Object
- FDK::Context
- Defined in:
- lib/fdk/context.rb
Overview
Represents the Fn context for a function execution
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
FN_APP_ID -the ID of the application that this function is a member of.
-
#response_headers ⇒ Object
readonly
FN_APP_ID -the ID of the application that this function is a member of.
Instance Method Summary collapse
- #app_id ⇒ Object
- #call_id ⇒ Object
- #content_type ⇒ Object
- #deadline ⇒ Object
- #fn_id ⇒ Object
- #http_context ⇒ Object
-
#initialize(headers_in, headers_out) ⇒ Context
constructor
A new instance of Context.
- #memory ⇒ Object
Constructor Details
Instance Attribute Details
#headers ⇒ Object (readonly)
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.
85 86 87 |
# File 'lib/fdk/context.rb', line 85 def headers @headers end |
#response_headers ⇒ Object (readonly)
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.
85 86 87 |
# File 'lib/fdk/context.rb', line 85 def response_headers @response_headers end |
Instance Method Details
#app_id ⇒ Object
97 98 99 |
# File 'lib/fdk/context.rb', line 97 def app_id @config["FN_APP_ID"] end |
#call_id ⇒ Object
93 94 95 |
# File 'lib/fdk/context.rb', line 93 def call_id @headers["fn-call-id"] end |
#content_type ⇒ Object
113 114 115 |
# File 'lib/fdk/context.rb', line 113 def content_type @headers["content-type"] end |
#deadline ⇒ Object
105 106 107 |
# File 'lib/fdk/context.rb', line 105 def deadline DateTime.iso8601(@headers["fn-deadline"]) end |
#fn_id ⇒ Object
101 102 103 |
# File 'lib/fdk/context.rb', line 101 def fn_id @config["FN_FN_ID"] end |
#http_context ⇒ Object
117 118 119 |
# File 'lib/fdk/context.rb', line 117 def http_context HTTPContext.new(self) end |
#memory ⇒ Object
109 110 111 |
# File 'lib/fdk/context.rb', line 109 def memory @config["FN_MEMORY"].to_i end |