deleteFunction method

Future<void> deleteFunction({
  1. required String ifMatch,
  2. required String name,
})

Deletes a CloudFront function.

You cannot delete a function if it's associated with a cache behavior. First, update your distributions to remove the function association from all cache behaviors, then delete the function.

To delete a function, you must provide the function's name and version (ETag value). To get these values, you can use ListFunctions and DescribeFunction.

May throw FunctionInUse. May throw InvalidIfMatchVersion. May throw NoSuchFunctionExists. May throw PreconditionFailed. May throw UnsupportedOperation.

Parameter ifMatch : The current version (ETag value) of the function that you are deleting, which you can get using DescribeFunction.

Parameter name : The name of the function that you are deleting.

Implementation

Future<void> deleteFunction({
  required String ifMatch,
  required String name,
}) async {
  final headers = <String, String>{
    'If-Match': ifMatch.toString(),
  };
  await _protocol.send(
    method: 'DELETE',
    requestUri: '/2020-05-31/function/${Uri.encodeComponent(name)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}