publishFunction method
Publishes a CloudFront function by copying the function code from the
DEVELOPMENT stage to LIVE. This automatically
updates all cache behaviors that are using this function to use the newly
published copy in the LIVE stage.
When a function is published to the LIVE stage, you can
attach the function to a distribution's cache behavior, using the
function's Amazon Resource Name (ARN).
To publish 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 InvalidArgument.
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
publishing, which you can get using DescribeFunction.
Parameter name :
The name of the function that you are publishing.
Implementation
Future<PublishFunctionResult> publishFunction({
required String ifMatch,
required String name,
}) async {
final headers = <String, String>{
'If-Match': ifMatch.toString(),
};
final $result = await _protocol.sendRaw(
method: 'POST',
requestUri: '/2020-05-31/function/${Uri.encodeComponent(name)}/publish',
headers: headers,
exceptionFnMap: _exceptionFns,
);
final $elem = await _s.xmlFromResponse($result);
return PublishFunctionResult(
functionSummary: FunctionSummary.fromXml($elem),
);
}