libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.CloudFront.UpdateDistribution

Description

Updates the configuration for a web distribution.

When you update a distribution, there are more required fields than when you create a distribution. When you update your distribution by using this API action, follow the steps here to get the current configuration and then make your updates, to make sure that you include all of the required fields. To view a summary, see Required Fields for Create Distribution and Update Distribution in the Amazon CloudFront Developer Guide.

The update process includes getting the current distribution configuration, updating the XML document that is returned to make your changes, and then submitting an UpdateDistribution request to make the updates.

For information about updating a distribution using the CloudFront console instead, see Creating a Distribution in the Amazon CloudFront Developer Guide.

To update a web distribution using the CloudFront API

  1. Submit a GetDistributionConfig request to get the current configuration and an Etag header for the distribution.

    If you update the distribution again, you must get a new Etag header.

  2. Update the XML document that was returned in the response to your GetDistributionConfig request to include your changes.

    When you edit the XML file, be aware of the following:

    • You must strip out the ETag parameter that is returned.
    • Additional fields are required when you update a distribution. There may be fields included in the XML file for features that you haven't configured for your distribution. This is expected and required to successfully update the distribution.
    • You can't change the value of CallerReference. If you try to change this value, CloudFront returns an IllegalUpdate error.
    • The new configuration replaces the existing configuration; the values that you specify in an UpdateDistribution request are not merged into your existing configuration. When you add, delete, or replace values in an element that allows multiple values (for example, CNAME), you must specify all of the values that you want to appear in the updated distribution. In addition, you must update the corresponding Quantity element.
  3. Submit an UpdateDistribution request to update the configuration for your distribution:

    • In the request body, include the XML document that you updated in Step 2. The request body must include an XML document with a DistributionConfig element.
    • Set the value of the HTTP If-Match header to the value of the ETag header that CloudFront returned when you submitted the GetDistributionConfig request in Step 1.
  4. Review the response to the UpdateDistribution request to confirm that the configuration was successfully updated.
  5. Optional: Submit a GetDistribution request to confirm that your changes have propagated. When propagation is complete, the value of Status is Deployed.
Synopsis

Creating a Request

data UpdateDistribution Source #

The request to update a distribution.

See: newUpdateDistribution smart constructor.

Constructors

UpdateDistribution' 

Fields

Instances

Instances details
Eq UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Show UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Generic UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Associated Types

type Rep UpdateDistribution :: Type -> Type #

NFData UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Methods

rnf :: UpdateDistribution -> () #

Hashable UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

AWSRequest UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Associated Types

type AWSResponse UpdateDistribution #

ToHeaders UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

ToPath UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

ToQuery UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

ToElement UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

type Rep UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

type Rep UpdateDistribution = D1 ('MetaData "UpdateDistribution" "Amazonka.CloudFront.UpdateDistribution" "libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront" 'False) (C1 ('MetaCons "UpdateDistribution'" 'PrefixI 'True) (S1 ('MetaSel ('Just "ifMatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "distributionConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DistributionConfig) :*: S1 ('MetaSel ('Just "id") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))
type AWSResponse UpdateDistribution Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

newUpdateDistribution Source #

Create a value of UpdateDistribution with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:ifMatch:UpdateDistribution', updateDistribution_ifMatch - The value of the ETag header that you received when retrieving the distribution's configuration. For example: E2QWRUHAPOMQZL.

$sel:distributionConfig:UpdateDistribution', updateDistribution_distributionConfig - The distribution's configuration information.

$sel:id:UpdateDistribution', updateDistribution_id - The distribution's id.

Request Lenses

updateDistribution_ifMatch :: Lens' UpdateDistribution (Maybe Text) Source #

The value of the ETag header that you received when retrieving the distribution's configuration. For example: E2QWRUHAPOMQZL.

Destructuring the Response

data UpdateDistributionResponse Source #

The returned result of the corresponding request.

See: newUpdateDistributionResponse smart constructor.

Constructors

UpdateDistributionResponse' 

Fields

Instances

Instances details
Eq UpdateDistributionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Show UpdateDistributionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Generic UpdateDistributionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

Associated Types

type Rep UpdateDistributionResponse :: Type -> Type #

NFData UpdateDistributionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

type Rep UpdateDistributionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.UpdateDistribution

type Rep UpdateDistributionResponse = D1 ('MetaData "UpdateDistributionResponse" "Amazonka.CloudFront.UpdateDistribution" "libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront" 'False) (C1 ('MetaCons "UpdateDistributionResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "eTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "distribution") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Distribution)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newUpdateDistributionResponse Source #

Create a value of UpdateDistributionResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:eTag:UpdateDistributionResponse', updateDistributionResponse_eTag - The current version of the configuration. For example: E2QWRUHAPOMQZL.

$sel:distribution:UpdateDistributionResponse', updateDistributionResponse_distribution - The distribution's information.

$sel:httpStatus:UpdateDistributionResponse', updateDistributionResponse_httpStatus - The response's http status code.

Response Lenses

updateDistributionResponse_eTag :: Lens' UpdateDistributionResponse (Maybe Text) Source #

The current version of the configuration. For example: E2QWRUHAPOMQZL.