| Copyright | (c) 2013-2021 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
| Stability | auto-generated |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
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
Submit a GetDistributionConfig request to get the current configuration and an
Etagheader for the distribution.If you update the distribution again, you must get a new
Etagheader.Update the XML document that was returned in the response to your
GetDistributionConfigrequest 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 anIllegalUpdateerror. - The new configuration replaces the existing configuration; the
values that you specify in an
UpdateDistributionrequest 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 correspondingQuantityelement.
Submit an
UpdateDistributionrequest 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
DistributionConfigelement. - Set the value of the HTTP
If-Matchheader to the value of theETagheader that CloudFront returned when you submitted theGetDistributionConfigrequest in Step 1.
- In the request body, include the XML document that you updated
in Step 2. The request body must include an XML document with a
- Review the response to the
UpdateDistributionrequest to confirm that the configuration was successfully updated. - Optional: Submit a
GetDistribution
request to confirm that your changes have propagated. When
propagation is complete, the value of
StatusisDeployed.
Synopsis
- data UpdateDistribution = UpdateDistribution' {}
- newUpdateDistribution :: DistributionConfig -> Text -> UpdateDistribution
- updateDistribution_ifMatch :: Lens' UpdateDistribution (Maybe Text)
- updateDistribution_distributionConfig :: Lens' UpdateDistribution DistributionConfig
- updateDistribution_id :: Lens' UpdateDistribution Text
- data UpdateDistributionResponse = UpdateDistributionResponse' {
- eTag :: Maybe Text
- distribution :: Maybe Distribution
- httpStatus :: Int
- newUpdateDistributionResponse :: Int -> UpdateDistributionResponse
- updateDistributionResponse_eTag :: Lens' UpdateDistributionResponse (Maybe Text)
- updateDistributionResponse_distribution :: Lens' UpdateDistributionResponse (Maybe Distribution)
- updateDistributionResponse_httpStatus :: Lens' UpdateDistributionResponse Int
Creating a Request
data UpdateDistribution Source #
The request to update a distribution.
See: newUpdateDistribution smart constructor.
Constructors
| UpdateDistribution' | |
Fields
| |
Instances
newUpdateDistribution Source #
Arguments
| :: DistributionConfig | |
| -> Text | |
| -> UpdateDistribution |
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.
updateDistribution_distributionConfig :: Lens' UpdateDistribution DistributionConfig Source #
The distribution's configuration information.
updateDistribution_id :: Lens' UpdateDistribution Text Source #
The distribution's id.
Destructuring the Response
data UpdateDistributionResponse Source #
The returned result of the corresponding request.
See: newUpdateDistributionResponse smart constructor.
Constructors
| UpdateDistributionResponse' | |
Fields
| |
Instances
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.
updateDistributionResponse_distribution :: Lens' UpdateDistributionResponse (Maybe Distribution) Source #
The distribution's information.
updateDistributionResponse_httpStatus :: Lens' UpdateDistributionResponse Int Source #
The response's http status code.