generate_oai_xml ( $caller_reference, $opt )

Used to generate the origin access identity (OAI) Config XML used in create_oai().

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 - Replaces the existing value for “Comment”. Cannot exceed 128 characters.

Returns

Type

Description

string

An XML document to be used as the OAI configuration.

Examples

Generate the OAI XML document.

$cdn = new AmazonCloudFront();

// Generate Origin Access Identity XML
$response = $cdn->generate_oai_xml('demo-' . time());

// Success?
var_dump($response);

Related Methods

Source

Method defined in services/cloudfront.class.php | Toggle source view (16 lines) | View on GitHub

public function generate_oai_xml($caller_reference, $opt = null)
{
    // Default, empty XML
    $xml = simplexml_load_string(sprintf($this->base_xml, 'CloudFrontOriginAccessIdentityConfig'));

    // CallerReference
    $xml->addChild('CallerReference', $caller_reference);

    // Comment
    if (isset($opt['Comment']))
    {
        $xml->addChild('Comment', $opt['Comment']);
    }

    return $xml->asXML();
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback