invoke_with_response_stream¶
Operation¶
Async only
This operation uses an event stream, so only the asynchronous client supports it.
invoke_with_response_stream
async
¶
invoke_with_response_stream(request: InvokeWithResponseStreamInput | InvokeWithResponseStreamInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[InvokeWithResponseStreamInputDict]) -> AsyncOutputEventStream[InvokeWithResponseStreamResponseEvent, InvokeWithResponseStreamOutput]
Configure your Lambda Event Functions to stream response payloads back to clients. For more information, see Configuring a Lambda function to stream responses.
This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
InvokeWithResponseStreamInput | InvokeWithResponseStreamInputDict | None
|
The input as a model or dictionary. Pass this or keyword arguments, not both. |
None
|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
**kwargs
|
Unpack[InvokeWithResponseStreamInputDict]
|
The input fields as keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
AsyncOutputEventStream[InvokeWithResponseStreamResponseEvent, InvokeWithResponseStreamOutput]
|
An |
Input¶
Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.
InvokeWithResponseStreamInputDict
¶
Bases: TypedDict
Dictionary form of InvokeWithResponseStreamInput.
Attributes¶
client_context
instance-attribute
¶
client_context: str | None
Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
function_name
instance-attribute
¶
The name or ARN of the Lambda function.
Name formats
-
Function name --
my-function. -
Function ARN --
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
Partial ARN --
123456789012:function:my-function.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
invocation_type
instance-attribute
¶
invocation_type: str | None
Use one of the following options:
-
RequestResponse(default) -- Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data. -
DryRun-- Validate parameter values and verify that the IAM user or role has permission to invoke the function.
log_type
instance-attribute
¶
log_type: str | None
Set to Tail to include the execution log in the response. Applies to
synchronously invoked functions only.
InvokeWithResponseStreamInput
dataclass
¶
Bases: _SerdeShape
Dataclass for InvokeWithResponseStreamInput structure.
Attributes¶
client_context
class-attribute
instance-attribute
¶
client_context: str | None = ...
Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
function_name
class-attribute
instance-attribute
¶
function_name: str | None = ...
The name or ARN of the Lambda function.
Name formats
-
Function name --
my-function. -
Function ARN --
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
Partial ARN --
123456789012:function:my-function.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
invocation_type
class-attribute
instance-attribute
¶
invocation_type: str | None = ...
Use one of the following options:
-
RequestResponse(default) -- Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data. -
DryRun-- Validate parameter values and verify that the IAM user or role has permission to invoke the function.
log_type
class-attribute
instance-attribute
¶
log_type: str | None = ...
Set to Tail to include the execution log in the response. Applies to
synchronously invoked functions only.
Output¶
This operation returns an AsyncOutputEventStream for server-to-client streaming.
Event Stream Structure¶
Output Event Type¶
InvokeWithResponseStreamResponseEvent
Initial Response Structure¶
InvokeWithResponseStreamOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for InvokeWithResponseStreamOutput structure.
Attributes¶
executed_version
class-attribute
instance-attribute
¶
executed_version: str | None = ...
The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.