Sets a new distribution configuration for the specified distribution ID.
Standard distributions are handled separately from streaming distributions. For streaming
distributions, set the Streaming
option to true.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The distribution ID returned from |
|
|
Required |
The DistributionConfig XML generated by |
|
|
Required |
The ETag header value retrieved from |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Update a standard distribution configuration.
$cdn = new AmazonCloudFront(); // Pull existing config XML... $existing_xml = $cdn->get_distribution_config('E2L6A3OZHQT5W4'); // Was the request successful? if ($existing_xml->isOK()) { // Generate an updated XML config... $updated_xml = $cdn->update_config_xml($existing_xml, array( 'Enabled' => false )); // Fetch an updated ETag value $etag = $cdn->get_distribution_config('E2L6A3OZHQT5W4')->header['etag']; // Set the updated config XML to the distribution. $response = $cdn->set_distribution_config('E2L6A3OZHQT5W4', $updated_xml, $etag); // Success? var_dump($response->isOK()); }Result:
bool(true)
Update a streaming distribution configuration.
$cdn = new AmazonCloudFront(); // Pull existing config XML... $existing_xml = $cdn->get_distribution_config('E2L6A3OZHQT5W4', array( 'Streaming' => true )); // Was the request successful? if ($existing_xml->isOK()) { // Generate an updated XML config... $updated_xml = $cdn->update_config_xml($existing_xml, array( 'Enabled' => false, 'Streaming' => true, 'CachingBehavior' => array( 'MinTTL' => '30 minutes', ), )); // Fetch an updated ETag value $etag = $existing_xml->header['etag']; // Set the updated config XML to the distribution. $response = $cdn->set_distribution_config('E2L6A3OZHQT5W4', $updated_xml, $etag, array( 'Streaming' => true )); // Success? var_dump($response->isOK()); }Result:
bool(true)
Related Methods
See Also
Source
Method defined in services/cloudfront.class.php | Toggle source view (11 lines) | View on GitHub