Struct aws_sdk_lambda::Client

source ·
pub struct Client { /* private fields */ }
Expand description

Client for AWS Lambda

Client for invoking operations on AWS Lambda. Each operation on AWS Lambda is a method on this this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.

§Constructing a Client

A Config is required to construct a client. For most use cases, the aws-config crate should be used to automatically resolve this config using aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared across multiple different AWS SDK clients. This config resolution process can be customized by calling aws_config::from_env() instead, which returns a ConfigLoader that uses the builder pattern to customize the default config.

In the simplest case, creating a client looks as follows:

let config = aws_config::load_from_env().await;
let client = aws_sdk_lambda::Client::new(&config);

Occasionally, SDKs may have additional service-specific values that can be set on the Config that is absent from SdkConfig, or slightly different settings for a specific client may be desired. The Config struct implements From<&SdkConfig>, so setting these specific settings can be done as follows:

let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_lambda::config::Builder::from(&sdk_config)
    .some_service_specific_setting("value")
    .build();

See the aws-config docs and Config for more information on customizing configuration.

Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.

§Using the Client

A client has a function for every operation that can be performed by the service. For example, the AddLayerVersionPermission operation has a Client::add_layer_version_permission, function which returns a builder for that operation. The fluent builder ultimately has a send() function that returns an async future that returns a result, as illustrated below:

let result = client.add_layer_version_permission()
    .layer_name("example")
    .send()
    .await;

The underlying HTTP requests that get made by this can be modified with the customize_operation function on the fluent builder. See the customize module for more information.

Implementations§

source§

impl Client

source

pub fn add_layer_version_permission( &self ) -> AddLayerVersionPermissionFluentBuilder

Constructs a fluent builder for the AddLayerVersionPermission operation.

source§

impl Client

source

pub fn add_permission(&self) -> AddPermissionFluentBuilder

Constructs a fluent builder for the AddPermission operation.

source§

impl Client

source

pub fn create_alias(&self) -> CreateAliasFluentBuilder

Constructs a fluent builder for the CreateAlias operation.

source§

impl Client

source

pub fn create_code_signing_config(&self) -> CreateCodeSigningConfigFluentBuilder

Constructs a fluent builder for the CreateCodeSigningConfig operation.

source§

impl Client

source

pub fn create_event_source_mapping( &self ) -> CreateEventSourceMappingFluentBuilder

Constructs a fluent builder for the CreateEventSourceMapping operation.

source§

impl Client

source

pub fn create_function(&self) -> CreateFunctionFluentBuilder

Constructs a fluent builder for the CreateFunction operation.

source§

impl Client

source

pub fn create_function_url_config(&self) -> CreateFunctionUrlConfigFluentBuilder

Constructs a fluent builder for the CreateFunctionUrlConfig operation.

source§

impl Client

source

pub fn delete_alias(&self) -> DeleteAliasFluentBuilder

Constructs a fluent builder for the DeleteAlias operation.

source§

impl Client

source

pub fn delete_code_signing_config(&self) -> DeleteCodeSigningConfigFluentBuilder

Constructs a fluent builder for the DeleteCodeSigningConfig operation.

source§

impl Client

source

pub fn delete_event_source_mapping( &self ) -> DeleteEventSourceMappingFluentBuilder

Constructs a fluent builder for the DeleteEventSourceMapping operation.

source§

impl Client

source

pub fn delete_function(&self) -> DeleteFunctionFluentBuilder

Constructs a fluent builder for the DeleteFunction operation.

source§

impl Client

source

pub fn delete_function_code_signing_config( &self ) -> DeleteFunctionCodeSigningConfigFluentBuilder

Constructs a fluent builder for the DeleteFunctionCodeSigningConfig operation.

source§

impl Client

source

pub fn delete_function_concurrency( &self ) -> DeleteFunctionConcurrencyFluentBuilder

Constructs a fluent builder for the DeleteFunctionConcurrency operation.

source§

impl Client

source

pub fn delete_function_event_invoke_config( &self ) -> DeleteFunctionEventInvokeConfigFluentBuilder

Constructs a fluent builder for the DeleteFunctionEventInvokeConfig operation.

source§

impl Client

source

pub fn delete_function_url_config(&self) -> DeleteFunctionUrlConfigFluentBuilder

Constructs a fluent builder for the DeleteFunctionUrlConfig operation.

source§

impl Client

source

pub fn delete_layer_version(&self) -> DeleteLayerVersionFluentBuilder

Constructs a fluent builder for the DeleteLayerVersion operation.

source§

impl Client

source

pub fn delete_provisioned_concurrency_config( &self ) -> DeleteProvisionedConcurrencyConfigFluentBuilder

Constructs a fluent builder for the DeleteProvisionedConcurrencyConfig operation.

source§

impl Client

source

pub fn get_account_settings(&self) -> GetAccountSettingsFluentBuilder

Constructs a fluent builder for the GetAccountSettings operation.

source§

impl Client

source

pub fn get_alias(&self) -> GetAliasFluentBuilder

Constructs a fluent builder for the GetAlias operation.

source§

impl Client

source

pub fn get_code_signing_config(&self) -> GetCodeSigningConfigFluentBuilder

Constructs a fluent builder for the GetCodeSigningConfig operation.

source§

impl Client

source

pub fn get_event_source_mapping(&self) -> GetEventSourceMappingFluentBuilder

Constructs a fluent builder for the GetEventSourceMapping operation.

source§

impl Client

source

pub fn get_function(&self) -> GetFunctionFluentBuilder

Constructs a fluent builder for the GetFunction operation.

source§

impl Client

source

pub fn get_function_code_signing_config( &self ) -> GetFunctionCodeSigningConfigFluentBuilder

Constructs a fluent builder for the GetFunctionCodeSigningConfig operation.

  • The fluent builder is configurable:
    • function_name(impl Into<String>) / set_function_name(Option<String>):
      required: true

      The name or ARN of the Lambda function.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.


  • On success, responds with GetFunctionCodeSigningConfigOutput with field(s):
    • code_signing_config_arn(String):

      The The Amazon Resource Name (ARN) of the code signing configuration.

    • function_name(String):

      The name or ARN of the Lambda function.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • On failure, responds with SdkError<GetFunctionCodeSigningConfigError>
source§

impl Client

source

pub fn get_function_concurrency(&self) -> GetFunctionConcurrencyFluentBuilder

Constructs a fluent builder for the GetFunctionConcurrency operation.

source§

impl Client

source

pub fn get_function_configuration( &self ) -> GetFunctionConfigurationFluentBuilder

Constructs a fluent builder for the GetFunctionConfiguration operation.

source§

impl Client

source

pub fn get_function_event_invoke_config( &self ) -> GetFunctionEventInvokeConfigFluentBuilder

Constructs a fluent builder for the GetFunctionEventInvokeConfig operation.

source§

impl Client

source

pub fn get_function_url_config(&self) -> GetFunctionUrlConfigFluentBuilder

Constructs a fluent builder for the GetFunctionUrlConfig operation.

source§

impl Client

source

pub fn get_layer_version(&self) -> GetLayerVersionFluentBuilder

Constructs a fluent builder for the GetLayerVersion operation.

source§

impl Client

source

pub fn get_layer_version_by_arn(&self) -> GetLayerVersionByArnFluentBuilder

Constructs a fluent builder for the GetLayerVersionByArn operation.

source§

impl Client

source

pub fn get_layer_version_policy(&self) -> GetLayerVersionPolicyFluentBuilder

Constructs a fluent builder for the GetLayerVersionPolicy operation.

source§

impl Client

source

pub fn get_policy(&self) -> GetPolicyFluentBuilder

Constructs a fluent builder for the GetPolicy operation.

source§

impl Client

source

pub fn get_provisioned_concurrency_config( &self ) -> GetProvisionedConcurrencyConfigFluentBuilder

Constructs a fluent builder for the GetProvisionedConcurrencyConfig operation.

source§

impl Client

source

pub fn get_runtime_management_config( &self ) -> GetRuntimeManagementConfigFluentBuilder

Constructs a fluent builder for the GetRuntimeManagementConfig operation.

source§

impl Client

source

pub fn invoke(&self) -> InvokeFluentBuilder

Constructs a fluent builder for the Invoke operation.

  • The fluent builder is configurable:
    • function_name(impl Into<String>) / set_function_name(Option<String>):
      required: true

      The name or ARN of the Lambda function, version, or alias.

      Name formats

      • Function namemy-function (name-only), my-function:v1 (with alias).

      • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN123456789012:function:my-function.

      You can append a version number or alias to any of the formats. 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(InvocationType) / set_invocation_type(Option<InvocationType>):
      required: false

      Choose from the following options.

      • RequestResponse (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.

      • Event – Invoke the function asynchronously. Send events that fail multiple times to the function’s dead-letter queue (if one is configured). The API response only includes a status code.

      • DryRun – Validate parameter values and verify that the user or role has permission to invoke the function.


    • log_type(LogType) / set_log_type(Option<LogType>):
      required: false

      Set to Tail to include the execution log in the response. Applies to synchronously invoked functions only.


    • client_context(impl Into<String>) / set_client_context(Option<String>):
      required: false

      Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the ClientContext object to your function for synchronous invocations only.


    • payload(Blob) / set_payload(Option<Blob>):
      required: false

      The JSON that you want to provide to your Lambda function as input.

      You can enter the JSON directly. For example, –payload ‘{ “key”: “value” }’. You can also specify a file path. For example, –payload file://payload.json.


    • qualifier(impl Into<String>) / set_qualifier(Option<String>):
      required: false

      Specify a version or alias to invoke a published version of the function.


  • On success, responds with InvokeOutput with field(s):
    • status_code(i32):

      The HTTP status code is in the 200 range for a successful request. For the RequestResponse invocation type, this status code is 200. For the Event invocation type, this status code is 202. For the DryRun invocation type, the status code is 204.

    • function_error(Option<String>):

      If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.

    • log_result(Option<String>):

      The last 4 KB of the execution log, which is base64-encoded.

    • payload(Option<Blob>):

      The response from the function, or an error object.

    • executed_version(Option<String>):

      The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.

  • On failure, responds with SdkError<InvokeError>
source§

impl Client

source

pub fn invoke_async(&self) -> InvokeAsyncFluentBuilder

👎Deprecated

Constructs a fluent builder for the InvokeAsync operation.

source§

impl Client

source

pub fn invoke_with_response_stream( &self ) -> InvokeWithResponseStreamFluentBuilder

Constructs a fluent builder for the InvokeWithResponseStream operation.

source§

impl Client

source

pub fn list_aliases(&self) -> ListAliasesFluentBuilder

Constructs a fluent builder for the ListAliases operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_code_signing_configs(&self) -> ListCodeSigningConfigsFluentBuilder

Constructs a fluent builder for the ListCodeSigningConfigs operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_event_source_mappings(&self) -> ListEventSourceMappingsFluentBuilder

Constructs a fluent builder for the ListEventSourceMappings operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_function_event_invoke_configs( &self ) -> ListFunctionEventInvokeConfigsFluentBuilder

Constructs a fluent builder for the ListFunctionEventInvokeConfigs operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_function_url_configs(&self) -> ListFunctionUrlConfigsFluentBuilder

Constructs a fluent builder for the ListFunctionUrlConfigs operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_functions(&self) -> ListFunctionsFluentBuilder

Constructs a fluent builder for the ListFunctions operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_functions_by_code_signing_config( &self ) -> ListFunctionsByCodeSigningConfigFluentBuilder

Constructs a fluent builder for the ListFunctionsByCodeSigningConfig operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_layer_versions(&self) -> ListLayerVersionsFluentBuilder

Constructs a fluent builder for the ListLayerVersions operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_layers(&self) -> ListLayersFluentBuilder

Constructs a fluent builder for the ListLayers operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_provisioned_concurrency_configs( &self ) -> ListProvisionedConcurrencyConfigsFluentBuilder

Constructs a fluent builder for the ListProvisionedConcurrencyConfigs operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_tags(&self) -> ListTagsFluentBuilder

Constructs a fluent builder for the ListTags operation.

source§

impl Client

source

pub fn list_versions_by_function(&self) -> ListVersionsByFunctionFluentBuilder

Constructs a fluent builder for the ListVersionsByFunction operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn publish_layer_version(&self) -> PublishLayerVersionFluentBuilder

Constructs a fluent builder for the PublishLayerVersion operation.

source§

impl Client

source

pub fn publish_version(&self) -> PublishVersionFluentBuilder

Constructs a fluent builder for the PublishVersion operation.

source§

impl Client

source

pub fn put_function_code_signing_config( &self ) -> PutFunctionCodeSigningConfigFluentBuilder

Constructs a fluent builder for the PutFunctionCodeSigningConfig operation.

source§

impl Client

source

pub fn put_function_concurrency(&self) -> PutFunctionConcurrencyFluentBuilder

Constructs a fluent builder for the PutFunctionConcurrency operation.

source§

impl Client

source

pub fn put_function_event_invoke_config( &self ) -> PutFunctionEventInvokeConfigFluentBuilder

Constructs a fluent builder for the PutFunctionEventInvokeConfig operation.

source§

impl Client

source

pub fn put_provisioned_concurrency_config( &self ) -> PutProvisionedConcurrencyConfigFluentBuilder

Constructs a fluent builder for the PutProvisionedConcurrencyConfig operation.

source§

impl Client

source

pub fn put_runtime_management_config( &self ) -> PutRuntimeManagementConfigFluentBuilder

Constructs a fluent builder for the PutRuntimeManagementConfig operation.

  • The fluent builder is configurable:
    • function_name(impl Into<String>) / set_function_name(Option<String>):
      required: true

      The name or ARN of the Lambda function.

      Name formats

      • Function namemy-function.

      • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN123456789012: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.


    • qualifier(impl Into<String>) / set_qualifier(Option<String>):
      required: false

      Specify a version of the function. This can be $LATEST or a published version number. If no value is specified, the configuration for the $LATEST version is returned.


    • update_runtime_on(UpdateRuntimeOn) / set_update_runtime_on(Option<UpdateRuntimeOn>):
      required: true

      Specify the runtime update mode.

      • Auto (default) - Automatically update to the most recent and secure runtime version using a Two-phase runtime version rollout. This is the best choice for most customers to ensure they always benefit from runtime updates.

      • Function update - Lambda updates the runtime of your function to the most recent and secure runtime version when you update your function. This approach synchronizes runtime updates with function deployments, giving you control over when runtime updates are applied and allowing you to detect and mitigate rare runtime update incompatibilities early. When using this setting, you need to regularly update your functions to keep their runtime up-to-date.

      • Manual - You specify a runtime version in your function configuration. The function will use this runtime version indefinitely. In the rare case where a new runtime version is incompatible with an existing function, this allows you to roll back your function to an earlier runtime version. For more information, see Roll back a runtime version.


    • runtime_version_arn(impl Into<String>) / set_runtime_version_arn(Option<String>):
      required: false

      The ARN of the runtime version you want the function to use.

      This is only required if you’re using the Manual runtime update mode.


  • On success, responds with PutRuntimeManagementConfigOutput with field(s):
  • On failure, responds with SdkError<PutRuntimeManagementConfigError>
source§

impl Client

source

pub fn remove_layer_version_permission( &self ) -> RemoveLayerVersionPermissionFluentBuilder

Constructs a fluent builder for the RemoveLayerVersionPermission operation.

source§

impl Client

source

pub fn remove_permission(&self) -> RemovePermissionFluentBuilder

Constructs a fluent builder for the RemovePermission operation.

source§

impl Client

source

pub fn tag_resource(&self) -> TagResourceFluentBuilder

Constructs a fluent builder for the TagResource operation.

source§

impl Client

source

pub fn untag_resource(&self) -> UntagResourceFluentBuilder

Constructs a fluent builder for the UntagResource operation.

source§

impl Client

source

pub fn update_alias(&self) -> UpdateAliasFluentBuilder

Constructs a fluent builder for the UpdateAlias operation.

source§

impl Client

source

pub fn update_code_signing_config(&self) -> UpdateCodeSigningConfigFluentBuilder

Constructs a fluent builder for the UpdateCodeSigningConfig operation.

source§

impl Client

source

pub fn update_event_source_mapping( &self ) -> UpdateEventSourceMappingFluentBuilder

Constructs a fluent builder for the UpdateEventSourceMapping operation.

source§

impl Client

source

pub fn update_function_code(&self) -> UpdateFunctionCodeFluentBuilder

Constructs a fluent builder for the UpdateFunctionCode operation.

source§

impl Client

source

pub fn update_function_configuration( &self ) -> UpdateFunctionConfigurationFluentBuilder

Constructs a fluent builder for the UpdateFunctionConfiguration operation.

source§

impl Client

source

pub fn update_function_event_invoke_config( &self ) -> UpdateFunctionEventInvokeConfigFluentBuilder

Constructs a fluent builder for the UpdateFunctionEventInvokeConfig operation.

source§

impl Client

source

pub fn update_function_url_config(&self) -> UpdateFunctionUrlConfigFluentBuilder

Constructs a fluent builder for the UpdateFunctionUrlConfig operation.

source§

impl Client

source

pub fn from_conf(conf: Config) -> Self

Creates a new client from the service Config.

§Panics

This method will panic in the following cases:

  • Retries or timeouts are enabled without a sleep_impl configured.
  • Identity caching is enabled without a sleep_impl and time_source configured.
  • No behavior_version is provided.

The panic message for each of these will have instructions on how to resolve them.

source

pub fn config(&self) -> &Config

Returns the client’s configuration.

source§

impl Client

source

pub fn new(sdk_config: &SdkConfig) -> Self

Creates a new client from an SDK Config.

§Panics
  • This method will panic if the sdk_config is missing an async sleep implementation. If you experience this panic, set the sleep_impl on the Config passed into this function to fix it.
  • This method will panic if the sdk_config is missing an HTTP connector. If you experience this panic, set the http_connector on the Config passed into this function to fix it.
  • This method will panic if no BehaviorVersion is provided. If you experience this panic, set behavior_version on the Config or enable the behavior-version-latest Cargo feature.

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more