Generates the distribution configuration XML used with create_distribution() and
set_distribution_config().
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The source to use for the Amazon CloudFront distribution. Use an Amazon S3 bucket name, or a fully-qualified non-S3 domain name prefixed with |
|
|
|
Required |
A unique identifier for the request. A timestamp-appended string is recommended. |
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
|---|---|
|
An XML document to be used as the distribution configuration. |
Examples
Generate the configuration XML document.
// Generate configuration XML
$cdn = new AmazonCloudFront();
$response = $cdn->generate_config_xml('my-bucket', 'CFdemo3');
// Success?
var_dump($response);
Generate the configuration XML document, enabling logging and using a fully-qualified domain name for Amazon S3.
// Generate configuration XML
$cdn = new AmazonCloudFront();
$response = $cdn->generate_config_xml('my-bucket.s3.amazonaws.com', 'CFdemo3', array(
'Logging' => array(
'Bucket' => 'my-bucket-logs',
'Prefix' => 'log_'
)
));
// Success?
var_dump($response);
Generate the configuration XML document, enabling streaming and multiple CNAMEs, and using a fully-qualified domain name for Amazon S3.
// Generate configuration XML
$cdn = new AmazonCloudFront();
$response = $cdn->generate_config_xml('my-bucket.s3.amazonaws.com', 'CFdemo3', array(
'Enabled' => true,
'Comment' => 'This is my sample comment',
'CNAME' => array(
'cname.example.com',
'cname2.example.com',
'cname3.example.com'
),
'Streaming' => true,
'DefaultRootObject' => 'text/sample.txt',
'CachingBehavior' => array(
'MinTTL' => '30 minutes',
),
));
// Success?
var_dump($response);
Related Methods
Source
Method defined in services/cloudfront.class.php | Toggle source view (145 lines) | View on GitHub

