updateFunctionEventInvokeConfig method

Future<FunctionEventInvokeConfig> updateFunctionEventInvokeConfig({
  1. required String functionName,
  2. DestinationConfig? destinationConfig,
  3. int? maximumEventAgeInSeconds,
  4. int? maximumRetryAttempts,
  5. String? qualifier,
})

Updates the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

May throw ServiceException. May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw TooManyRequestsException.

Parameter functionName : The name of the Lambda function, version, or alias.

Name formats

  • Function name - my-function (name-only), my-function:v1 (with alias).
  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.
  • Partial ARN - 123456789012: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.

Parameter destinationConfig : A destination for events after they have been sent to a function for processing.

Destinations

  • Function - The Amazon Resource Name (ARN) of a Lambda function.
  • Queue - The ARN of an SQS queue.
  • Topic - The ARN of an SNS topic.
  • Event Bus - The ARN of an Amazon EventBridge event bus.

Parameter maximumEventAgeInSeconds : The maximum age of a request that Lambda sends to a function for processing.

Parameter maximumRetryAttempts : The maximum number of times to retry when the function returns an error.

Parameter qualifier : A version number or alias name.

Implementation

Future<FunctionEventInvokeConfig> updateFunctionEventInvokeConfig({
  required String functionName,
  DestinationConfig? destinationConfig,
  int? maximumEventAgeInSeconds,
  int? maximumRetryAttempts,
  String? qualifier,
}) async {
  ArgumentError.checkNotNull(functionName, 'functionName');
  _s.validateStringLength(
    'functionName',
    functionName,
    1,
    140,
    isRequired: true,
  );
  _s.validateNumRange(
    'maximumEventAgeInSeconds',
    maximumEventAgeInSeconds,
    60,
    21600,
  );
  _s.validateNumRange(
    'maximumRetryAttempts',
    maximumRetryAttempts,
    0,
    2,
  );
  _s.validateStringLength(
    'qualifier',
    qualifier,
    1,
    128,
  );
  final $query = <String, List<String>>{
    if (qualifier != null) 'Qualifier': [qualifier],
  };
  final $payload = <String, dynamic>{
    if (destinationConfig != null) 'DestinationConfig': destinationConfig,
    if (maximumEventAgeInSeconds != null)
      'MaximumEventAgeInSeconds': maximumEventAgeInSeconds,
    if (maximumRetryAttempts != null)
      'MaximumRetryAttempts': maximumRetryAttempts,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2019-09-25/functions/${Uri.encodeComponent(functionName)}/event-invoke-config',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return FunctionEventInvokeConfig.fromJson(response);
}