Amazon CloudFront

2023/11/21 - Amazon CloudFront - 5 new 6 updated api methods

Changes  This release adds support for CloudFront KeyValueStore, a globally managed key value datastore associated with CloudFront Functions.

ListKeyValueStores (new) Link ¶

Specifies the Key Value Stores to list.

See also: AWS API Documentation

Request Syntax

client.list_key_value_stores(
    Marker='string',
    MaxItems='string',
    Status='string'
)
type Marker

string

param Marker

The marker associated with the Key Value Stores list.

type MaxItems

string

param MaxItems

The maximum number of items in the Key Value Stores list.

type Status

string

param Status

The status of the request for the Key Value Stores list.

rtype

dict

returns

Response Syntax

{
    'KeyValueStoreList': {
        'NextMarker': 'string',
        'MaxItems': 123,
        'Quantity': 123,
        'Items': [
            {
                'Name': 'string',
                'Id': 'string',
                'Comment': 'string',
                'ARN': 'string',
                'Status': 'string',
                'LastModifiedTime': datetime(2015, 1, 1)
            },
        ]
    }
}

Response Structure

  • (dict) --

    • KeyValueStoreList (dict) --

      The resulting Key Value Stores list.

      • NextMarker (string) --

        The next marker associated with the Key Value Store list.

      • MaxItems (integer) --

        The maximum number of items in the Key Value Store list.

      • Quantity (integer) --

        The quantity of the Key Value Store list.

      • Items (list) --

        The items of the Key Value Store list.

        • (dict) --

          The Key Value Store. Use this to separate data from function code, allowing you to update data without having to publish a new version of a function. The Key Value Store holds keys and their corresponding values.

          • Name (string) --

            The name of the Key Value Store.

          • Id (string) --

            The unique Id for the Key Value Store.

          • Comment (string) --

            A comment for the Key Value Store.

          • ARN (string) --

            The Amazon Resource Name (ARN) of the Key Value Store.

          • Status (string) --

            The status of the Key Value Store.

          • LastModifiedTime (datetime) --

            The last-modified time of the Key Value Store.

DescribeKeyValueStore (new) Link ¶

Specifies the Key Value Store and its configuration.

See also: AWS API Documentation

Request Syntax

client.describe_key_value_store(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of the Key Value Store.

rtype

dict

returns

Response Syntax

{
    'KeyValueStore': {
        'Name': 'string',
        'Id': 'string',
        'Comment': 'string',
        'ARN': 'string',
        'Status': 'string',
        'LastModifiedTime': datetime(2015, 1, 1)
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • KeyValueStore (dict) --

      The resulting Key Value Store.

      • Name (string) --

        The name of the Key Value Store.

      • Id (string) --

        The unique Id for the Key Value Store.

      • Comment (string) --

        A comment for the Key Value Store.

      • ARN (string) --

        The Amazon Resource Name (ARN) of the Key Value Store.

      • Status (string) --

        The status of the Key Value Store.

      • LastModifiedTime (datetime) --

        The last-modified time of the Key Value Store.

    • ETag (string) --

      The ETag of the resulting Key Value Store.

DeleteKeyValueStore (new) Link ¶

Specifies the Key Value Store to delete.

See also: AWS API Documentation

Request Syntax

client.delete_key_value_store(
    Name='string',
    IfMatch='string'
)
type Name

string

param Name

[REQUIRED]

The name of the Key Value Store.

type IfMatch

string

param IfMatch

[REQUIRED]

The Key Value Store to delete, if a match occurs.

returns

None

UpdateKeyValueStore (new) Link ¶

Specifies the Key Value Store to update.

See also: AWS API Documentation

Request Syntax

client.update_key_value_store(
    Name='string',
    Comment='string',
    IfMatch='string'
)
type Name

string

param Name

[REQUIRED]

The name of the Key Value Store to update.

type Comment

string

param Comment

[REQUIRED]

The comment of the Key Value Store to update.

type IfMatch

string

param IfMatch

[REQUIRED]

The Key Value Store to update, if a match occurs.

rtype

dict

returns

Response Syntax

{
    'KeyValueStore': {
        'Name': 'string',
        'Id': 'string',
        'Comment': 'string',
        'ARN': 'string',
        'Status': 'string',
        'LastModifiedTime': datetime(2015, 1, 1)
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • KeyValueStore (dict) --

      The resulting Key Value Store to update.

      • Name (string) --

        The name of the Key Value Store.

      • Id (string) --

        The unique Id for the Key Value Store.

      • Comment (string) --

        A comment for the Key Value Store.

      • ARN (string) --

        The Amazon Resource Name (ARN) of the Key Value Store.

      • Status (string) --

        The status of the Key Value Store.

      • LastModifiedTime (datetime) --

        The last-modified time of the Key Value Store.

    • ETag (string) --

      The ETag of the resulting Key Value Store.

CreateKeyValueStore (new) Link ¶

Specifies the Key Value Store resource to add to your account. In your account, the Key Value Store names must be unique. You can also import Key Value Store data in JSON format from an S3 bucket by providing a valid ImportSource that you own.

See also: AWS API Documentation

Request Syntax

client.create_key_value_store(
    Name='string',
    Comment='string',
    ImportSource={
        'SourceType': 'S3',
        'SourceARN': 'string'
    }
)
type Name

string

param Name

[REQUIRED]

The name of the Key Value Store. The maximum length of the name is 32 characters.

type Comment

string

param Comment

The comment of the Key Value Store.

type ImportSource

dict

param ImportSource

The S3 bucket that provides the source for the import. The source must be in a valid JSON format.

  • SourceType (string) -- [REQUIRED]

    The source type of the import source for the Key Value Store.

  • SourceARN (string) -- [REQUIRED]

    The Amazon Resource Name (ARN) of the import source for the Key Value Store.

rtype

dict

returns

Response Syntax

{
    'KeyValueStore': {
        'Name': 'string',
        'Id': 'string',
        'Comment': 'string',
        'ARN': 'string',
        'Status': 'string',
        'LastModifiedTime': datetime(2015, 1, 1)
    },
    'ETag': 'string',
    'Location': 'string'
}

Response Structure

  • (dict) --

    • KeyValueStore (dict) --

      The resulting Key Value Store.

      • Name (string) --

        The name of the Key Value Store.

      • Id (string) --

        The unique Id for the Key Value Store.

      • Comment (string) --

        A comment for the Key Value Store.

      • ARN (string) --

        The Amazon Resource Name (ARN) of the Key Value Store.

      • Status (string) --

        The status of the Key Value Store.

      • LastModifiedTime (datetime) --

        The last-modified time of the Key Value Store.

    • ETag (string) --

      The ETag in the resulting Key Value Store.

    • Location (string) --

      The location of the resulting Key Value Store.

CreateFunction (updated) Link ¶
Changes (request, response)
Request
{'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                  'Quantity': 'integer'}}}
Response
{'FunctionSummary': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                      'Quantity': 'integer'}}}}

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.

See also: AWS API Documentation

Request Syntax

client.create_function(
    Name='string',
    FunctionConfig={
        'Comment': 'string',
        'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
        'KeyValueStoreAssociations': {
            'Quantity': 123,
            'Items': [
                {
                    'KeyValueStoreARN': 'string'
                },
            ]
        }
    },
    FunctionCode=b'bytes'
)
type Name

string

param Name

[REQUIRED]

A name to identify the function.

type FunctionConfig

dict

param FunctionConfig

[REQUIRED]

Configuration information about the function, including an optional comment and the function's runtime.

  • Comment (string) -- [REQUIRED]

    A comment to describe the function.

  • Runtime (string) -- [REQUIRED]

    The function's runtime environment version.

  • KeyValueStoreAssociations (dict) --

    The configuration for the Key Value Store associations.

    • Quantity (integer) -- [REQUIRED]

      The quantity of Key Value Store associations.

    • Items (list) --

      The items of the Key Value Store association.

      • (dict) --

        The Key Value Store association.

        • KeyValueStoreARN (string) -- [REQUIRED]

          The Amazon Resource Name (ARN) of the Key Value Store association.

type FunctionCode

bytes

param FunctionCode

[REQUIRED]

The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .

rtype

dict

returns

Response Syntax

{
    'FunctionSummary': {
        'Name': 'string',
        'Status': 'string',
        'FunctionConfig': {
            'Comment': 'string',
            'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
            'KeyValueStoreAssociations': {
                'Quantity': 123,
                'Items': [
                    {
                        'KeyValueStoreARN': 'string'
                    },
                ]
            }
        },
        'FunctionMetadata': {
            'FunctionARN': 'string',
            'Stage': 'DEVELOPMENT'|'LIVE',
            'CreatedTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        }
    },
    'Location': 'string',
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • FunctionSummary (dict) --

      Contains configuration information and metadata about a CloudFront function.

      • Name (string) --

        The name of the CloudFront function.

      • Status (string) --

        The status of the CloudFront function.

      • FunctionConfig (dict) --

        Contains configuration information about a CloudFront function.

        • Comment (string) --

          A comment to describe the function.

        • Runtime (string) --

          The function's runtime environment version.

        • KeyValueStoreAssociations (dict) --

          The configuration for the Key Value Store associations.

          • Quantity (integer) --

            The quantity of Key Value Store associations.

          • Items (list) --

            The items of the Key Value Store association.

            • (dict) --

              The Key Value Store association.

              • KeyValueStoreARN (string) --

                The Amazon Resource Name (ARN) of the Key Value Store association.

      • FunctionMetadata (dict) --

        Contains metadata about a CloudFront function.

        • FunctionARN (string) --

          The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

        • Stage (string) --

          The stage that the function is in, either DEVELOPMENT or LIVE .

          When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

          When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

        • CreatedTime (datetime) --

          The date and time when the function was created.

        • LastModifiedTime (datetime) --

          The date and time when the function was most recently updated.

    • Location (string) --

      The URL of the CloudFront function. Use the URL to manage the function with the CloudFront API.

    • ETag (string) --

      The version identifier for the current version of the CloudFront function.

DescribeFunction (updated) Link ¶
Changes (response)
{'FunctionSummary': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                      'Quantity': 'integer'}}}}

Gets configuration information and metadata about a CloudFront function, but not the function's code. To get a function's code, use GetFunction .

To get configuration information and metadata about a function, you must provide the function's name and stage. To get these values, you can use ListFunctions .

See also: AWS API Documentation

Request Syntax

client.describe_function(
    Name='string',
    Stage='DEVELOPMENT'|'LIVE'
)
type Name

string

param Name

[REQUIRED]

The name of the function that you are getting information about.

type Stage

string

param Stage

The function's stage, either DEVELOPMENT or LIVE .

rtype

dict

returns

Response Syntax

{
    'FunctionSummary': {
        'Name': 'string',
        'Status': 'string',
        'FunctionConfig': {
            'Comment': 'string',
            'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
            'KeyValueStoreAssociations': {
                'Quantity': 123,
                'Items': [
                    {
                        'KeyValueStoreARN': 'string'
                    },
                ]
            }
        },
        'FunctionMetadata': {
            'FunctionARN': 'string',
            'Stage': 'DEVELOPMENT'|'LIVE',
            'CreatedTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        }
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • FunctionSummary (dict) --

      Contains configuration information and metadata about a CloudFront function.

      • Name (string) --

        The name of the CloudFront function.

      • Status (string) --

        The status of the CloudFront function.

      • FunctionConfig (dict) --

        Contains configuration information about a CloudFront function.

        • Comment (string) --

          A comment to describe the function.

        • Runtime (string) --

          The function's runtime environment version.

        • KeyValueStoreAssociations (dict) --

          The configuration for the Key Value Store associations.

          • Quantity (integer) --

            The quantity of Key Value Store associations.

          • Items (list) --

            The items of the Key Value Store association.

            • (dict) --

              The Key Value Store association.

              • KeyValueStoreARN (string) --

                The Amazon Resource Name (ARN) of the Key Value Store association.

      • FunctionMetadata (dict) --

        Contains metadata about a CloudFront function.

        • FunctionARN (string) --

          The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

        • Stage (string) --

          The stage that the function is in, either DEVELOPMENT or LIVE .

          When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

          When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

        • CreatedTime (datetime) --

          The date and time when the function was created.

        • LastModifiedTime (datetime) --

          The date and time when the function was most recently updated.

    • ETag (string) --

      The version identifier for the current version of the CloudFront function.

ListFunctions (updated) Link ¶
Changes (response)
{'FunctionList': {'Items': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                             'Quantity': 'integer'}}}}}

Gets a list of all CloudFront functions in your Amazon Web Services account.

You can optionally apply a filter to return only the functions that are in the specified stage, either DEVELOPMENT or LIVE .

You can optionally specify the maximum number of items to receive in the response. If the total number of items in the list exceeds the maximum that you specify, or the default maximum, the response is paginated. To get the next page of items, send a subsequent request that specifies the NextMarker value from the current response as the Marker value in the subsequent request.

See also: AWS API Documentation

Request Syntax

client.list_functions(
    Marker='string',
    MaxItems='string',
    Stage='DEVELOPMENT'|'LIVE'
)
type Marker

string

param Marker

Use this field when paginating results to indicate where to begin in your list of functions. The response includes functions in the list that occur after the marker. To get the next page of the list, set this field's value to the value of NextMarker from the current page's response.

type MaxItems

string

param MaxItems

The maximum number of functions that you want in the response.

type Stage

string

param Stage

An optional filter to return only the functions that are in the specified stage, either DEVELOPMENT or LIVE .

rtype

dict

returns

Response Syntax

{
    'FunctionList': {
        'NextMarker': 'string',
        'MaxItems': 123,
        'Quantity': 123,
        'Items': [
            {
                'Name': 'string',
                'Status': 'string',
                'FunctionConfig': {
                    'Comment': 'string',
                    'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
                    'KeyValueStoreAssociations': {
                        'Quantity': 123,
                        'Items': [
                            {
                                'KeyValueStoreARN': 'string'
                            },
                        ]
                    }
                },
                'FunctionMetadata': {
                    'FunctionARN': 'string',
                    'Stage': 'DEVELOPMENT'|'LIVE',
                    'CreatedTime': datetime(2015, 1, 1),
                    'LastModifiedTime': datetime(2015, 1, 1)
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • FunctionList (dict) --

      A list of CloudFront functions.

      • NextMarker (string) --

        If there are more items in the list than are in this response, this element is present. It contains the value that you should use in the Marker field of a subsequent request to continue listing functions where you left off.

      • MaxItems (integer) --

        The maximum number of functions requested.

      • Quantity (integer) --

        The number of functions returned in the response.

      • Items (list) --

        Contains the functions in the list.

        • (dict) --

          Contains configuration information and metadata about a CloudFront function.

          • Name (string) --

            The name of the CloudFront function.

          • Status (string) --

            The status of the CloudFront function.

          • FunctionConfig (dict) --

            Contains configuration information about a CloudFront function.

            • Comment (string) --

              A comment to describe the function.

            • Runtime (string) --

              The function's runtime environment version.

            • KeyValueStoreAssociations (dict) --

              The configuration for the Key Value Store associations.

              • Quantity (integer) --

                The quantity of Key Value Store associations.

              • Items (list) --

                The items of the Key Value Store association.

                • (dict) --

                  The Key Value Store association.

                  • KeyValueStoreARN (string) --

                    The Amazon Resource Name (ARN) of the Key Value Store association.

          • FunctionMetadata (dict) --

            Contains metadata about a CloudFront function.

            • FunctionARN (string) --

              The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

            • Stage (string) --

              The stage that the function is in, either DEVELOPMENT or LIVE .

              When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

              When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

            • CreatedTime (datetime) --

              The date and time when the function was created.

            • LastModifiedTime (datetime) --

              The date and time when the function was most recently updated.

PublishFunction (updated) Link ¶
Changes (response)
{'FunctionSummary': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                      'Quantity': 'integer'}}}}

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 .

See also: AWS API Documentation

Request Syntax

client.publish_function(
    Name='string',
    IfMatch='string'
)
type Name

string

param Name

[REQUIRED]

The name of the function that you are publishing.

type IfMatch

string

param IfMatch

[REQUIRED]

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

rtype

dict

returns

Response Syntax

{
    'FunctionSummary': {
        'Name': 'string',
        'Status': 'string',
        'FunctionConfig': {
            'Comment': 'string',
            'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
            'KeyValueStoreAssociations': {
                'Quantity': 123,
                'Items': [
                    {
                        'KeyValueStoreARN': 'string'
                    },
                ]
            }
        },
        'FunctionMetadata': {
            'FunctionARN': 'string',
            'Stage': 'DEVELOPMENT'|'LIVE',
            'CreatedTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        }
    }
}

Response Structure

  • (dict) --

    • FunctionSummary (dict) --

      Contains configuration information and metadata about a CloudFront function.

      • Name (string) --

        The name of the CloudFront function.

      • Status (string) --

        The status of the CloudFront function.

      • FunctionConfig (dict) --

        Contains configuration information about a CloudFront function.

        • Comment (string) --

          A comment to describe the function.

        • Runtime (string) --

          The function's runtime environment version.

        • KeyValueStoreAssociations (dict) --

          The configuration for the Key Value Store associations.

          • Quantity (integer) --

            The quantity of Key Value Store associations.

          • Items (list) --

            The items of the Key Value Store association.

            • (dict) --

              The Key Value Store association.

              • KeyValueStoreARN (string) --

                The Amazon Resource Name (ARN) of the Key Value Store association.

      • FunctionMetadata (dict) --

        Contains metadata about a CloudFront function.

        • FunctionARN (string) --

          The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

        • Stage (string) --

          The stage that the function is in, either DEVELOPMENT or LIVE .

          When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

          When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

        • CreatedTime (datetime) --

          The date and time when the function was created.

        • LastModifiedTime (datetime) --

          The date and time when the function was most recently updated.

TestFunction (updated) Link ¶
Changes (response)
{'TestResult': {'FunctionSummary': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                                     'Quantity': 'integer'}}}}}

Tests a CloudFront function.

To test a function, you provide an event object that represents an HTTP request or response that your CloudFront distribution could receive in production. CloudFront runs the function, passing it the event object that you provided, and returns the function's result (the modified event object) in the response. The response also contains function logs and error messages, if any exist. For more information about testing functions, see Testing functions in the Amazon CloudFront Developer Guide .

To test a function, you provide the function's name and version ( ETag value) along with the event object. To get the function's name and version, you can use ListFunctions and DescribeFunction .

See also: AWS API Documentation

Request Syntax

client.test_function(
    Name='string',
    IfMatch='string',
    Stage='DEVELOPMENT'|'LIVE',
    EventObject=b'bytes'
)
type Name

string

param Name

[REQUIRED]

The name of the function that you are testing.

type IfMatch

string

param IfMatch

[REQUIRED]

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

type Stage

string

param Stage

The stage of the function that you are testing, either DEVELOPMENT or LIVE .

type EventObject

bytes

param EventObject

[REQUIRED]

The event object to test the function with. For more information about the structure of the event object, see Testing functions in the Amazon CloudFront Developer Guide .

rtype

dict

returns

Response Syntax

{
    'TestResult': {
        'FunctionSummary': {
            'Name': 'string',
            'Status': 'string',
            'FunctionConfig': {
                'Comment': 'string',
                'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
                'KeyValueStoreAssociations': {
                    'Quantity': 123,
                    'Items': [
                        {
                            'KeyValueStoreARN': 'string'
                        },
                    ]
                }
            },
            'FunctionMetadata': {
                'FunctionARN': 'string',
                'Stage': 'DEVELOPMENT'|'LIVE',
                'CreatedTime': datetime(2015, 1, 1),
                'LastModifiedTime': datetime(2015, 1, 1)
            }
        },
        'ComputeUtilization': 'string',
        'FunctionExecutionLogs': [
            'string',
        ],
        'FunctionErrorMessage': 'string',
        'FunctionOutput': 'string'
    }
}

Response Structure

  • (dict) --

    • TestResult (dict) --

      An object that represents the result of running the function with the provided event object.

      • FunctionSummary (dict) --

        Contains configuration information and metadata about the CloudFront function that was tested.

        • Name (string) --

          The name of the CloudFront function.

        • Status (string) --

          The status of the CloudFront function.

        • FunctionConfig (dict) --

          Contains configuration information about a CloudFront function.

          • Comment (string) --

            A comment to describe the function.

          • Runtime (string) --

            The function's runtime environment version.

          • KeyValueStoreAssociations (dict) --

            The configuration for the Key Value Store associations.

            • Quantity (integer) --

              The quantity of Key Value Store associations.

            • Items (list) --

              The items of the Key Value Store association.

              • (dict) --

                The Key Value Store association.

                • KeyValueStoreARN (string) --

                  The Amazon Resource Name (ARN) of the Key Value Store association.

        • FunctionMetadata (dict) --

          Contains metadata about a CloudFront function.

          • FunctionARN (string) --

            The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

          • Stage (string) --

            The stage that the function is in, either DEVELOPMENT or LIVE .

            When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

            When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

          • CreatedTime (datetime) --

            The date and time when the function was created.

          • LastModifiedTime (datetime) --

            The date and time when the function was most recently updated.

      • ComputeUtilization (string) --

        The amount of time that the function took to run as a percentage of the maximum allowed time. For example, a compute utilization of 35 means that the function completed in 35% of the maximum allowed time.

      • FunctionExecutionLogs (list) --

        Contains the log lines that the function wrote (if any) when running the test.

        • (string) --

      • FunctionErrorMessage (string) --

        If the result of testing the function was an error, this field contains the error message.

      • FunctionOutput (string) --

        The event object returned by the function. For more information about the structure of the event object, see Event object structure in the Amazon CloudFront Developer Guide .

UpdateFunction (updated) Link ¶
Changes (request, response)
Request
{'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                  'Quantity': 'integer'}}}
Response
{'FunctionSummary': {'FunctionConfig': {'KeyValueStoreAssociations': {'Items': [{'KeyValueStoreARN': 'string'}],
                                                                      'Quantity': 'integer'}}}}

Updates a CloudFront function.

You can update a function's code or the comment that describes the function. You cannot update a function's name.

To update a function, you provide the function's name and version ( ETag value) along with the updated function code. To get the name and version, you can use ListFunctions and DescribeFunction .

See also: AWS API Documentation

Request Syntax

client.update_function(
    Name='string',
    IfMatch='string',
    FunctionConfig={
        'Comment': 'string',
        'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
        'KeyValueStoreAssociations': {
            'Quantity': 123,
            'Items': [
                {
                    'KeyValueStoreARN': 'string'
                },
            ]
        }
    },
    FunctionCode=b'bytes'
)
type Name

string

param Name

[REQUIRED]

The name of the function that you are updating.

type IfMatch

string

param IfMatch

[REQUIRED]

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

type FunctionConfig

dict

param FunctionConfig

[REQUIRED]

Configuration information about the function.

  • Comment (string) -- [REQUIRED]

    A comment to describe the function.

  • Runtime (string) -- [REQUIRED]

    The function's runtime environment version.

  • KeyValueStoreAssociations (dict) --

    The configuration for the Key Value Store associations.

    • Quantity (integer) -- [REQUIRED]

      The quantity of Key Value Store associations.

    • Items (list) --

      The items of the Key Value Store association.

      • (dict) --

        The Key Value Store association.

        • KeyValueStoreARN (string) -- [REQUIRED]

          The Amazon Resource Name (ARN) of the Key Value Store association.

type FunctionCode

bytes

param FunctionCode

[REQUIRED]

The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .

rtype

dict

returns

Response Syntax

{
    'FunctionSummary': {
        'Name': 'string',
        'Status': 'string',
        'FunctionConfig': {
            'Comment': 'string',
            'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
            'KeyValueStoreAssociations': {
                'Quantity': 123,
                'Items': [
                    {
                        'KeyValueStoreARN': 'string'
                    },
                ]
            }
        },
        'FunctionMetadata': {
            'FunctionARN': 'string',
            'Stage': 'DEVELOPMENT'|'LIVE',
            'CreatedTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        }
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • FunctionSummary (dict) --

      Contains configuration information and metadata about a CloudFront function.

      • Name (string) --

        The name of the CloudFront function.

      • Status (string) --

        The status of the CloudFront function.

      • FunctionConfig (dict) --

        Contains configuration information about a CloudFront function.

        • Comment (string) --

          A comment to describe the function.

        • Runtime (string) --

          The function's runtime environment version.

        • KeyValueStoreAssociations (dict) --

          The configuration for the Key Value Store associations.

          • Quantity (integer) --

            The quantity of Key Value Store associations.

          • Items (list) --

            The items of the Key Value Store association.

            • (dict) --

              The Key Value Store association.

              • KeyValueStoreARN (string) --

                The Amazon Resource Name (ARN) of the Key Value Store association.

      • FunctionMetadata (dict) --

        Contains metadata about a CloudFront function.

        • FunctionARN (string) --

          The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.

        • Stage (string) --

          The stage that the function is in, either DEVELOPMENT or LIVE .

          When a function is in the DEVELOPMENT stage, you can test the function with TestFunction , and update it with UpdateFunction .

          When a function is in the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's ARN.

        • CreatedTime (datetime) --

          The date and time when the function was created.

        • LastModifiedTime (datetime) --

          The date and time when the function was most recently updated.

    • ETag (string) --

      The version identifier for the current version of the CloudFront function.