delete_distribution ( $distribution_id, $etag, $opt )

Deletes a disabled distribution. If distribution hasn’t been disabled, Amazon CloudFront returns a DistributionNotDisabled error. Use set_distribution_config() to disable a distribution before attempting to delete.

For an Adobe Real-Time Messaging Protocol (RTMP) streaming distribution, set the Streaming option to be true.

Access

public

Parameters

Parameter

Type

Required

Description

$distribution_id

string

Required

The distribution ID returned from create_distribution() or list_distributions().

$etag

string

Required

The ETag header value retrieved from get_distribution_config().

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • Streaming - boolean - Optional - Whether or not this should be for a streaming distribution. A value of true will create a streaming distribution. A value of false will create a standard distribution. The default value is false.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Delete a distribution.

$cdn = new AmazonCloudFront();

// Fetch an updated ETag value
$etag = $cdn->get_distribution_config('E2L6A3OZHQT5W4')->header['etag'];

// Set the updated config XML to the distribution.
$response = $cdn->delete_distribution('E2L6A3OZHQT5W4', $etag);

// 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

public function delete_distribution($distribution_id, $etag, $opt = null)
{
    if (!$opt) $opt = array();

    $path = '/' . ((isset($opt['Streaming']) && $opt['Streaming'] == (bool) true) ? 'streaming-distribution' : 'distribution');
    $path .= '/' . $distribution_id;

    $opt = array_merge($opt, array('path' => $path, 'etag' => $etag));

    return $this->authenticate('DELETE', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback