create_function¶
Operation¶
create_function
async
¶
create_function(request: CreateFunctionInput | CreateFunctionInputDict, /, *, plugins: list[Plugin] | None = None) -> CreateFunctionOutput
create_function(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateFunctionInputDict]) -> CreateFunctionOutput
Creates a CloudFront function.
To create a function, you provide the function code and some configuration information about the function. The response contains an Amazon Resource Name (ARN) that uniquely identifies the function.
When you create a function, it's in the DEVELOPMENT stage. In this
stage, you can test the function with TestFunction, and update it with
UpdateFunction.
When you're ready to use your function with a CloudFront distribution,
use PublishFunction to copy the function from the DEVELOPMENT stage
to LIVE. When it's live, you can attach the function to a
distribution's cache behavior, using the function's ARN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
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 |
|---|---|
CreateFunctionOutput
|
An instance of |
Input¶
Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.
Model¶
CreateFunctionInput
dataclass
¶
Bases: _SerdeShape
Dataclass for CreateFunctionInput structure.
Attributes¶
function_code
class-attribute
instance-attribute
¶
function_code: bytes | None = ...
The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
function_config
class-attribute
instance-attribute
¶
function_config: FunctionConfig | None = ...
Configuration information about the function, including an optional comment and the function's runtime.
Dictionaries¶
CreateFunctionInputDict
¶
Bases: TypedDict
Dictionary form of CreateFunctionInput.
Attributes¶
function_code
instance-attribute
¶
The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
function_config
instance-attribute
¶
function_config: Required[FunctionConfig | FunctionConfigDict]
Configuration information about the function, including an optional comment and the function's runtime.
Output¶
CreateFunctionOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for CreateFunctionOutput structure.
Attributes¶
e_tag
class-attribute
instance-attribute
¶
e_tag: str | None = ...
The version identifier for the current version of the CloudFront function.
function_summary
class-attribute
instance-attribute
¶
function_summary: FunctionSummary | None = ...
Contains configuration information and metadata about a CloudFront function.
location
class-attribute
instance-attribute
¶
location: str | None = ...
The URL of the CloudFront function. Use the URL to manage the function with the CloudFront API.
response_metadata
class-attribute
instance-attribute
¶
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.