create_oai ( $caller_reference, $opt )

Creates a new Amazon CloudFront origin access identity (OAI). You can create up to 100 OAIs per AWS account. For more information, see the Amazon CloudFront Developer Guide.

Access

public

Parameters

Parameter

Type

Required

Description

$caller_reference

string

Required

A unique identifier for the request. A timestamp-appended string is recommended.

$opt

array

Optional

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

  • Comment - string - Optional - A comment about the OAI.
  • 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

Create a new Origin Access Identity.

// Create a new CloudFront distribution from an S3 bucket.
$cdn = new AmazonCloudFront();

$response = $cdn->create_oai('my-identity-' . time(), array(
	'Comment' => 'This is a test distribution.'
));

// 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 create_oai($caller_reference, $opt = null)
{
    if (!$opt) $opt = array();

    $path = '/origin-access-identity/cloudfront';
    $xml = $this->generate_oai_xml($caller_reference, $opt);

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

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback