updateFunctionConfiguration method

Future<FunctionConfiguration> updateFunctionConfiguration({
  1. required String functionName,
  2. String? description,
  3. String? handler,
  4. int? memorySize,
  5. String? role,
  6. int? timeout,
})

Updates the configuration parameters for the specified Lambda function by using the values provided in the request. You provide only the parameters you want to change. This operation must only be used on an existing Lambda function and cannot be used to update the function's code.

This operation requires permission for the lambda:UpdateFunctionConfiguration action.

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

Parameter functionName : The name of the Lambda function.

Parameter description : A short user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.

Parameter handler : The function that Lambda calls to begin executing your function. For Node.js, it is the module-name.export value in your function.

Parameter memorySize : The amount of memory, in MB, your Lambda function is given. Lambda uses this memory size to infer the amount of CPU allocated to your function. Your function use-case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.

Parameter role : The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when it executes your function.

Parameter timeout : The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

Implementation

Future<FunctionConfiguration> updateFunctionConfiguration({
  required String functionName,
  String? description,
  String? handler,
  int? memorySize,
  String? role,
  int? timeout,
}) async {
  ArgumentError.checkNotNull(functionName, 'functionName');
  _s.validateStringLength(
    'functionName',
    functionName,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    256,
  );
  _s.validateNumRange(
    'memorySize',
    memorySize,
    128,
    1024,
  );
  _s.validateNumRange(
    'timeout',
    timeout,
    1,
    60,
  );
  final $query = <String, List<String>>{
    if (description != null) 'Description': [description],
    if (handler != null) 'Handler': [handler],
    if (memorySize != null) 'MemorySize': [memorySize.toString()],
    if (role != null) 'Role': [role],
    if (timeout != null) 'Timeout': [timeout.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'PUT',
    requestUri:
        '/2014-11-13/functions/${Uri.encodeComponent(functionName)}/configuration',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return FunctionConfiguration.fromJson(response);
}