deleteFunction method
Deletes a Lambda function. To delete a specific function version, use the
Qualifier
parameter. Otherwise, all versions and aliases are
deleted.
To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For AWS services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.
May throw ServiceException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw InvalidParameterValueException. May throw ResourceConflictException.
Parameter functionName
:
The name of the Lambda function or version.
Name formats
-
Function name -
my-function
(name-only),my-function:1
(with version). -
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
. -
Partial ARN -
123456789012:function:my-function
.
Parameter qualifier
:
Specify a version to delete. You can't delete a version that's referenced
by an alias.
Implementation
Future<void> deleteFunction({
required String functionName,
String? qualifier,
}) async {
ArgumentError.checkNotNull(functionName, 'functionName');
_s.validateStringLength(
'functionName',
functionName,
1,
140,
isRequired: true,
);
_s.validateStringLength(
'qualifier',
qualifier,
1,
128,
);
final $query = <String, List<String>>{
if (qualifier != null) 'Qualifier': [qualifier],
};
await _protocol.send(
payload: null,
method: 'DELETE',
requestUri: '/2015-03-31/functions/${Uri.encodeComponent(functionName)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
}