pub struct Extension<'a, E, L, T> { /* private fields */ }
Expand description
An Extension that runs event, log and telemetry processors
Implementations§
Source§impl Extension<'_, Identity<LambdaEvent>, MakeIdentity<Vec<LambdaLog>>, MakeIdentity<Vec<LambdaTelemetry>>>
impl Extension<'_, Identity<LambdaEvent>, MakeIdentity<Vec<LambdaLog>>, MakeIdentity<Vec<LambdaTelemetry>>>
Source§impl<'a, E, L, T> Extension<'a, E, L, T>where
E: Service<LambdaEvent>,
E::Future: Future<Output = Result<(), E::Error>>,
E::Error: Into<Error> + Display + Debug,
L: MakeService<(), Vec<LambdaLog>, Response = ()> + Send + Sync + 'static,
L::Service: Service<Vec<LambdaLog>, Response = ()> + Send + Sync,
<L::Service as Service<Vec<LambdaLog>>>::Future: Send + 'a,
L::Error: Into<Error> + Debug,
L::MakeError: Into<Error> + Debug,
L::Future: Send,
T: MakeService<(), Vec<LambdaTelemetry>, Response = ()> + Send + Sync + 'static,
T::Service: Service<Vec<LambdaTelemetry>, Response = ()> + Send + Sync,
<T::Service as Service<Vec<LambdaTelemetry>>>::Future: Send + 'a,
T::Error: Into<Error> + Debug,
T::MakeError: Into<Error> + Debug,
T::Future: Send,
impl<'a, E, L, T> Extension<'a, E, L, T>where
E: Service<LambdaEvent>,
E::Future: Future<Output = Result<(), E::Error>>,
E::Error: Into<Error> + Display + Debug,
L: MakeService<(), Vec<LambdaLog>, Response = ()> + Send + Sync + 'static,
L::Service: Service<Vec<LambdaLog>, Response = ()> + Send + Sync,
<L::Service as Service<Vec<LambdaLog>>>::Future: Send + 'a,
L::Error: Into<Error> + Debug,
L::MakeError: Into<Error> + Debug,
L::Future: Send,
T: MakeService<(), Vec<LambdaTelemetry>, Response = ()> + Send + Sync + 'static,
T::Service: Service<Vec<LambdaTelemetry>, Response = ()> + Send + Sync,
<T::Service as Service<Vec<LambdaTelemetry>>>::Future: Send + 'a,
T::Error: Into<Error> + Debug,
T::MakeError: Into<Error> + Debug,
T::Future: Send,
Sourcepub fn with_extension_name(self, extension_name: &'a str) -> Self
pub fn with_extension_name(self, extension_name: &'a str) -> Self
Create a new Extension
with a given extension name
Sourcepub fn with_events(self, events: &'a [&'a str]) -> Self
pub fn with_events(self, events: &'a [&'a str]) -> Self
Create a new Extension
with a list of given events.
The only accepted events are INVOKE
and SHUTDOWN
.
Sourcepub fn with_events_processor<N>(self, ep: N) -> Extension<'a, N, L, T>
pub fn with_events_processor<N>(self, ep: N) -> Extension<'a, N, L, T>
Create a new Extension
with a service that receives Lambda events.
Sourcepub fn with_logs_processor<N, NS>(self, lp: N) -> Extension<'a, E, N, T>
pub fn with_logs_processor<N, NS>(self, lp: N) -> Extension<'a, E, N, T>
Create a new Extension
with a service that receives Lambda logs.
Sourcepub fn with_log_types(self, log_types: &'a [&'a str]) -> Self
pub fn with_log_types(self, log_types: &'a [&'a str]) -> Self
Create a new Extension
with a list of logs types to subscribe.
The only accepted log types are function
, platform
, and extension
.
Sourcepub fn with_log_buffering(self, lb: LogBuffering) -> Self
pub fn with_log_buffering(self, lb: LogBuffering) -> Self
Create a new Extension
with specific configuration to buffer logs.
Sourcepub fn with_log_port_number(self, port_number: u16) -> Self
pub fn with_log_port_number(self, port_number: u16) -> Self
Create a new Extension
with a different port number to listen to logs.
Sourcepub fn with_telemetry_processor<N, NS>(self, lp: N) -> Extension<'a, E, L, N>
pub fn with_telemetry_processor<N, NS>(self, lp: N) -> Extension<'a, E, L, N>
Create a new Extension
with a service that receives Lambda telemetry data.
Sourcepub fn with_telemetry_types(self, telemetry_types: &'a [&'a str]) -> Self
pub fn with_telemetry_types(self, telemetry_types: &'a [&'a str]) -> Self
Create a new Extension
with a list of telemetry types to subscribe.
The only accepted telemetry types are function
, platform
, and extension
.
Sourcepub fn with_telemetry_buffering(self, lb: LogBuffering) -> Self
pub fn with_telemetry_buffering(self, lb: LogBuffering) -> Self
Create a new Extension
with specific configuration to buffer telemetry.
Sourcepub fn with_telemetry_port_number(self, port_number: u16) -> Self
pub fn with_telemetry_port_number(self, port_number: u16) -> Self
Create a new Extension
with a different port number to listen to telemetry.
Sourcepub async fn register(self) -> Result<RegisteredExtension<E>, Error>
pub async fn register(self) -> Result<RegisteredExtension<E>, Error>
Register the extension.
Performs the
init phase
Lambda lifecycle operations to register the extension. When implementing an internal Lambda
extension, it is safe to call lambda_runtime::run
once the future returned by this
function resolves.