list_distributions ( $opt )

Gets a list of distributions. By default, the list is returned as one result. If needed, paginate the list by specifying values for the MaxItems and Marker parameters.

Standard distributions are listed separately from streaming distributions. For streaming distributions, set the Streaming option to true.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

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

  • Marker - string - Optional - Use this setting when paginating results to indicate where in your list of distributions to begin. The results include distributions in the list that occur after the marker. To get the next page of results, set the Marker to the value of the NextMarker from the current page’s response (which is also the ID of the last distribution on that page).
  • MaxItems - integer - Optional - The maximum number of distributions you want in the response body. Maximum of 100.
  • 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

List standard distributions.

// Update the XML content
$cdn = new AmazonCloudFront();
$response = $cdn->list_distributions();

// Success?
var_dump($response->isOK());
Result:
bool(true)

List a single streaming distribution.

// Update the XML content
$cdn = new AmazonCloudFront();
$response = $cdn->list_distributions(array(
	'MaxItems' => 1,
	'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 (20 lines) | View on GitHub

public function list_distributions($opt = null)
{
    if (!$opt) $opt = array();
    $opt['query_string'] = array();

    // Pass these to the query string
    foreach (array('Marker', 'MaxItems') as $option)
    {
        if (isset($opt[$option]))
        {
            $opt['query_string'][$option] = $opt[$option];
        }
    }

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

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

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback