set_oai_config ( $identity_id, $xml, $etag, $opt )

Sets the configuration for an Amazon CloudFront origin access identity (OAI). Use this when updating the configuration. Currently, only comments may be updated. Follow the same process as when updating an identity’s configuration as you do when updating a distribution’s configuration. For more information, go to Updating a Distribution’s Configuration in the Amazon CloudFront Developer Guide.

When attempting to change configuration items that are not allowed to be updated, Amazon CloudFront returns an IllegalUpdate error.

Access

public

Parameters

Parameter

Type

Required

Description

$identity_id

string

Required

An Identity ID for an existing OAI.

$xml

string

Required

The configuration XML generated by generate_oai_xml().

$etag

string

Required

The ETag header value retrieved from a call to get_distribution_config().

$opt

array

Optional

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

  • 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

Update the OAI configuration.

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

// Get the existing OAI configuration
$config = $cdn->get_oai_config('E3HV63EQPFPPOA');

// Was the request successful?
if ($config->isOK())
{
	// Grab the ETag header
	$etag = $config->header['etag'];

	// Update the configuration. (Returns XML.)
	$updated_xml = $cdn->update_oai_xml($config, array(
		'Comment' => 'This is my updated comment.'
	));

	// Update the OAI configuration.
	$response = $cdn->set_oai_config('E3HV63EQPFPPOA', $updated_xml, $etag);

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

Related Methods

See Also

Source

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

public function set_oai_config($identity_id, $xml, $etag, $opt = null)
{
    if (!$opt) $opt = array();

    $path = '/origin-access-identity/cloudfront/' . $identity_id . '/config';

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

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback