Skip to content

CloudFront  >  Operations  >  publish_function

publish_function

Operation

publish_function async

publish_function(input: PublishFunctionInput, plugins: list[Plugin] | None = None) -> PublishFunctionOutput

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.

Parameters:

Name Type Description Default
input PublishFunctionInput

An instance of PublishFunctionInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
PublishFunctionOutput

An instance of PublishFunctionOutput.

Input

PublishFunctionInput dataclass

Bases: _SerdeShape

Dataclass for PublishFunctionInput structure.

Attributes

if_match class-attribute instance-attribute
if_match: str | None = ...

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

name class-attribute instance-attribute
name: str | None = ...

The name of the function that you are publishing.

Output

PublishFunctionOutput dataclass

Bases: _SerdeShape

Dataclass for PublishFunctionOutput structure.

Attributes

function_summary class-attribute instance-attribute
function_summary: FunctionSummary | None = ...

Contains configuration information and metadata about a CloudFront function.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.