-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcloudfront.class.php
707 lines (632 loc) · 22.8 KB
/
cloudfront.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
<?php
/**
* File: CloudFront
* Amazon CloudFront CDN Service (http://aws.amazon.com/cloudfront)
*
* Version:
* 2009.10.11
*
* Copyright:
* 2006-2009 Foleeo, Inc., and contributors.
*
* License:
* Simplified BSD License - http://opensource.org/licenses/bsd-license.php
*
* See Also:
* CloudFusion - http://getcloudfusion.com
* Amazon CloudFront - http://aws.amazon.com/cloudfront
*/
/*%******************************************************************************************%*/
// CONSTANTS
/**
* Constant: CDN_DEFAULT_URL
* Specify the default queue URL.
*/
define('CDN_DEFAULT_URL', 'cloudfront.amazonaws.com');
/*%******************************************************************************************%*/
// EXCEPTIONS
/**
* Exception: CloudFront_Exception
* Default CloudFront Exception.
*/
class CloudFront_Exception extends Exception {}
/*%******************************************************************************************%*/
// MAIN CLASS
/**
* Class: AmazonCloudFront
* Container for all Amazon CloudFront-related methods. Inherits additional methods from CloudFusion.
*
* Extends:
* CloudFusion
*/
class AmazonCloudFront extends CloudFusion
{
/**
* Property: base_xml
* The base content to use for generating the DistributionConfig XML.
*/
var $base_xml;
/*%******************************************************************************************%*/
// CONSTRUCTOR
/**
* Method: __construct()
* The constructor
*
* Access:
* public
*
* Parameters:
* key - _string_ (Optional) Your Amazon API Key. If blank, it will look for the <AWS_KEY> constant.
* secret_key - _string_ (Optional) Your Amazon API Secret Key. If blank, it will look for the <AWS_SECRET_KEY> constant.
*
* Returns:
* _boolean_ false if no valid values are set, otherwise true.
*/
public function __construct($key = null, $secret_key = null)
{
$this->api_version = '2009-04-02';
$this->hostname = CDN_DEFAULT_URL;
$this->base_xml = '<?xml version="1.0" encoding="UTF-8"?><DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/' . $this->api_version . '/"></DistributionConfig>';
if (!$key && !defined('AWS_KEY'))
{
throw new CloudFront_Exception('No account key was passed into the constructor, nor was it set in the AWS_KEY constant.');
}
if (!$secret_key && !defined('AWS_SECRET_KEY'))
{
throw new CloudFront_Exception('No account secret was passed into the constructor, nor was it set in the AWS_SECRET_KEY constant.');
}
return parent::__construct($key, $secret_key);
}
/*%******************************************************************************************%*/
// AUTHENTICATION
/**
* Method: authenticate()
* Authenticates a connection to CloudFront. This should not be used directly unless you're writing custom methods for this class.
*
* Access:
* public
*
* Parameters:
* method - _string_ (Required) The HTTP method to use to connect. Accepts <HTTP_GET>, <HTTP_POST>, <HTTP_PUT>, <HTTP_DELETE>, and <HTTP_HEAD>.
* path - _string_ (Optional) The endpoint path to make requests to.
* opt - _array_ (Optional) Associative array of parameters for authenticating. See the individual methods for allowed keys.
* xml - _string_ (Optional) The XML body content to send along in the request.
* etag - _string_ (Optional) The ETag value to pass along with the If-Match HTTP header.
*
* Returns:
* <ResponseCore> object
*
* See Also:
* http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/RESTAuthentication.html
*/
public function authenticate($method = HTTP_GET, $path = null, $opt = null, $xml = null, $etag = null)
{
$querystring = null;
if (!$opt) $opt = array();
// Generate the querystring from $opt, removing a reference to returnCurlHandle.
if ($opt)
{
$query = $opt;
if (isset($query['returnCurlHandle']))
{
unset($query['returnCurlHandle']);
}
$querystring = '?' . $this->util->to_query_string($query);
}
// Gather information to pass along to other classes.
$helpers = array(
'utilities' => $this->utilities_class,
'request' => $this->request_class,
'response' => $this->response_class,
);
// Compose the request.
$request_url = 'https://' . $this->hostname . '/' . $this->api_version . '/distribution';
$request_url .= ($path) ? $path : '';
$request_url .= ($querystring) ? $querystring : '';
$request = new $this->request_class($request_url, $this->set_proxy, $helpers);
// Generate required headers.
$request->set_method($method);
$canonical_date = gmdate(DATE_FORMAT_RFC2616);
$request->add_header('x-amz-date', $canonical_date);
$signature = $this->util->hex_to_base64(hash_hmac('sha1', $canonical_date, $this->secret_key));
$request->add_header('Authorization', 'AWS ' . $this->key . ':' . $signature);
// Add configuration XML if we have it.
if ($xml)
{
$request->add_header('Content-Length', strlen($xml));
$request->add_header('Content-Type', 'text/plain');
$request->set_body($xml);
}
// Set If-Match: ETag header if we have one.
if ($etag)
{
$request->add_header('If-Match', $etag);
}
// If we have a "true" value for returnCurlHandle, do that instead of completing the request.
if (isset($opt['returnCurlHandle']))
{
return $request->prep_request();
}
// Send!
$request->send_request();
// Prepare the response.
$headers = $request->get_response_header();
$headers['x-cloudfusion-requesturl'] = $request_url;
if ($xml) $headers['x-cloudfusion-body'] = $xml;
$data = new $this->response_class($headers, new SimpleXMLElement($request->get_response_body()), $request->get_response_code());
// Return!
return $data;
}
/*%******************************************************************************************%*/
// SET CUSTOM SETTINGS
/**
* Method: disable_ssl()
* Throws an error because SSL is required for the CloudFront service.
*
* Access:
* public
*
* Returns:
* void
*/
public function disable_ssl()
{
throw new CloudFront_Exception('SSL/HTTPS is REQUIRED for CloudFront and cannot be disabled.');
}
/*%******************************************************************************************%*/
// GENERATE DISTRIBUTION CONFIG XML
/**
* Method: generate_config_xml()
* Used to generate the Distribution Config XML used in <create_distribution()> and <set_distribution_config()>.
*
* Access:
* public
*
* Parameters:
* origin - _string_ (Required) The source S3 bucket to use for the CloudFront distribution.
* caller_reference - _string_ (Required) A unique identifier for the request. Must be generated on your own. A time stamp or hash is a good example.
* opt - _array_ (Optional) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* CNAME - _string_|_array_ (Optional) A DNS CNAME to use to map to the CloudFront distribution. If setting more than one, use an indexed array. Supports 1-10 CNAMEs.
* Comment - _integer_ (Optional) A comment to apply to the distribution. Cannot exceed 128 characters.
* Enabled - _string_ (Optional) Defaults to true. Use this to set Enabled to false.
*
* Returns:
* String DistributionConfig XML document.
*
* Examples:
* example::cloudfront/generate_config_xml3.phpt:
* example::cloudfront/generate_config_xml4.phpt:
* example::cloudfront/generate_config_xml5.phpt:
*
* See Also:
* Related - <generate_config_xml()>, <update_config_xml()>, <remove_cname()>
*/
public function generate_config_xml($origin, $caller_reference, $opt = null)
{
// Default, empty XML
$xml = simplexml_load_string($this->base_xml);
// Origin
if (stripos($origin, '.s3.amazonaws.com') !== false)
{
$xml->addChild('Origin', $origin);
}
else
{
$xml->addChild('Origin', $origin . '.s3.amazonaws.com');
}
// CallerReference
$xml->addChild('CallerReference', $caller_reference);
// CNAME
if (isset($opt['CNAME']))
{
if (is_array($opt['CNAME']))
{
foreach ($opt['CNAME'] as $cname)
{
$xml->addChild('CNAME', $cname);
}
}
else
{
$xml->addChild('CNAME', $opt['CNAME']);
}
}
// Comment
if (isset($opt['Comment']))
{
$xml->addChild('Comment', $opt['Comment']);
}
// Enabled
if (isset($opt['Enabled']))
{
$xml->addChild('Enabled', $opt['Enabled'] ? 'true' : 'false');
}
else
{
$xml->addChild('Enabled', 'true');
}
// Logging
if (isset($opt['Logging']))
{
if (is_array($opt['Logging']))
{
$logging = $xml->addChild('Logging');
$bucket_name = $opt['Logging']['Bucket'];
// Origin
if (stripos($bucket_name, '.s3.amazonaws.com') !== false)
{
$logging->addChild('Bucket', $bucket_name);
}
else
{
$logging->addChild('Bucket', $bucket_name . '.s3.amazonaws.com');
}
$logging->addChild('Prefix', $opt['Logging']['Prefix']);
}
}
return $xml->asXML();
}
/**
* Method: update_config_xml()
* Used to update an existing DistributionConfig XML document.
*
* Access:
* public
*
* Parameters:
* xml - _SimpleXMLElement_|_ResponseCore_|_string_ (Required) The source DistributionConfig XML to make updates to. Can be the SimpleXMLElement body of a <get_distribution_config()> response, the entire <ResponseCore> of a <get_distribution_config()> response, or a string of XML generated by <generate_config_xml()> or <update_config_xml()>.
* opt - _array_ (Optional) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* CNAME - _string_|_array_ (Optional) This (these) value(s) will be ADDED to the existing list of CNAME values. To remove a CNAME value, see <remove_cname()>.
* Comment - _integer_ (Optional) This value will replace the existing value for 'Comment'. Cannot exceed 128 characters.
* Enabled - _string_ (Optional) This value will replace the existing value for 'Enabled'.
*
* Returns:
* String DistributionConfig XML document.
*
* Examples:
* example::cloudfront/update_config_xml4.phpt:
*
* See Also:
* Related - <generate_config_xml()>, <update_config_xml()>, <remove_cname()>
*/
public function update_config_xml($xml, $opt = null)
{
// If we receive a full ResponseCore object, only use the body.
if ($xml instanceof ResponseCore)
{
$xml = $xml->body;
}
// If we received a string of XML, convert it into a SimpleXMLElement object.
if (is_string($xml))
{
$xml = simplexml_load_string($xml);
}
// Default, empty XML
$update = simplexml_load_string($this->base_xml);
// These can't change.
$update->addChild('Origin', $xml->Origin);
$update->addChild('CallerReference', $xml->CallerReference);
// Add existing CNAME values
if ($xml->CNAME)
{
$update->addChild('CNAME', $xml->CNAME);
}
// Add new CNAME values
if (isset($opt['CNAME']))
{
if (is_array($opt['CNAME']))
{
foreach ($opt['CNAME'] as $cname)
{
$update->addChild('CNAME', $cname);
}
}
else
{
$update->addChild('CNAME', $opt['CNAME']);
}
}
// Comment
if (isset($opt['Comment']))
{
$update->addChild('Comment', $opt['Comment']);
}
elseif (isset($xml->Comment))
{
$update->addChild('Comment', $xml->Comment);
}
// Enabled
if (isset($opt['Enabled']))
{
$update->addChild('Enabled', $opt['Enabled'] ? 'true' : 'false');
}
elseif (isset($xml->Enabled))
{
$update->addChild('Enabled', $xml->Enabled);
}
// Logging
if (isset($opt['Logging']))
{
if (is_array($opt['Logging']))
{
$logging = $update->addChild('Logging');
$bucket_name = $opt['Logging']['Bucket'];
// Origin
if (stripos($bucket_name, '.s3.amazonaws.com') !== false)
{
$logging->addChild('Bucket', $bucket_name);
}
else
{
$logging->addChild('Bucket', $bucket_name . '.s3.amazonaws.com');
}
$logging->addChild('Prefix', $opt['Logging']['Prefix']);
}
}
elseif (isset($xml->Logging))
{
$logging = $update->addChild('Logging');
$logging->addChild('Bucket',$xml->Logging->Bucket);
$logging->addChild('Prefix', $xml->Logging->Prefix);
}
// Output
return $update->asXML();
}
/**
* Method: remove_cname()
* Used to remove one or more CNAMEs from a DistributionConfig XML document.
*
* Access:
* public
*
* Parameters:
* xml - _SimpleXMLElement_|_ResponseCore_|_string_ (Required) The source DistributionConfig XML to make updates to. Can be the SimpleXMLElement body of a <get_distribution_config()> response, the entire <ResponseCore> of a <get_distribution_config()> response, or a string of XML generated by <generate_config_xml()> or <update_config_xml()>.
* cname - _string_|_array_ (Optional) This (these) value(s) will be REMOVED from the existing list of CNAME values. To add a CNAME value, see <update_config_xml()>.
*
* Returns:
* String DistributionConfig XML document.
*
* Examples:
* example::cloudfront/remove_cname2.phpt:
*
* See Also:
* Related - <generate_config_xml()>, <update_config_xml()>, <remove_cname()>
*/
public function remove_cname($xml, $cname)
{
// If we receive a full ResponseCore object, only use the body.
if ($xml instanceof ResponseCore)
{
$xml = $xml->body;
}
// If we received a string of XML, convert it into a SimpleXMLElement object.
if (is_string($xml))
{
$xml = simplexml_load_string($xml);
}
// Let's make sure that we have CNAMEs to remove in the first place.
if (isset($xml->CNAME))
{
// If we have an array of CNAME values...
if (is_array($cname))
{
foreach ($cname as $cn)
{
for ($i = 0, $length = sizeof($xml->CNAME); $i < $length; $i++)
{
if ((string) $xml->CNAME[$i] == $cn)
{
unset($xml->CNAME[$i]);
break;
}
}
}
}
// If we only have one CNAME value...
else
{
for ($i = 0, $length = sizeof($xml->CNAME); $i < $length; $i++)
{
if ((string) $xml->CNAME[$i] == $cname)
{
unset($xml->CNAME[$i]);
break;
}
}
}
}
return $xml->asXML();
}
/*%******************************************************************************************%*/
// DISTRIBUTIONS
/**
* Method: create_distribution()
* The response echoes the DistributionConfig element and returns other metadata about the distribution. For more information, see Parts of a Basic Distribution. It takes a short time for CloudFront to propagate your new distribution's information throughout the CloudFront system. For more information, see Eventual Consistency. You can have up to 100 distributions in the Amazon CloudFront system.
*
* Access:
* public
*
* Parameters:
* origin - _string_ (Required) The source S3 bucket to use for the CloudFront distribution.
* caller_reference - _integer_ (Required) A unique identifier for the request. Must be generated on your own. A timestamp could be good.
* opt - _array_ (Optional) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* CNAME - _string_|_array_ (Optional) A DNS CNAME to use to map to the CloudFront distribution. If setting more than one, use an indexed array. Supports 1-10 CNAMEs.
* Comment - _integer_ (Optional) A comment to apply to the distribution. Cannot exceed 128 characters.
* Enabled - _string_ (Optional) Defaults to true. Use this to set Enabled to false.
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/create_distribution.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/CreateDistribution.html
* Related - <create_distribution()>, <list_distributions()>, <get_distribution_info()>, <delete_distribution()>
*/
public function create_distribution($origin, $caller_reference, $opt = null)
{
$auth = array();
if (isset($opt['returnCurlHandle']))
{
$auth['returnCurlHandle'] = $opt['returnCurlHandle'];
unset($opt['returnCurlHandle']);
}
$xml = $this->generate_config_xml($origin, $caller_reference, $opt);
return $this->authenticate(HTTP_POST, null, $auth, $xml, null);
}
/**
* Method: list_distributions()
* Gets a list of your distributions. By default, your entire list of distributions is returned in one single page. If the list is long, you can paginate it using the MaxItems and Marker parameters.
*
* Access:
* public
*
* Parameters:
* opt - _array_ (Required) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* Marker - _string_ (Optional) Use this 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.
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/list_distributions.phpt:
* example::cloudfront/list_distributions2.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/ListDistributions.html
* Related - <create_distribution()>, <list_distributions()>, <get_distribution_info()>, <delete_distribution()>
*/
public function list_distributions($opt = null)
{
return $this->authenticate(HTTP_GET, null, $opt, null, null);
}
/**
* Method: get_distribution_info()
* Gets information about a given distribution.
*
* Access:
* public
*
* Parameters:
* distribution_id - _string_ (Required) The distribution ID returned from <create_distribution()> or <list_distributions()>.
* opt - _array_ (Required) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/get_distribution_info.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/GetDistribution.html
* Related - <create_distribution()>, <list_distributions()>, <get_distribution_info()>, <delete_distribution()>
*/
public function get_distribution_info($distribution_id, $opt = null)
{
return $this->authenticate(HTTP_GET, '/' . $distribution_id, $opt, null, null);
}
/**
* Method: delete_distribution()
* Deletes a disabled distribution. If you haven't disabled the distribution, Amazon CloudFront returns a DistributionNotDisabled error. Use <set_distribution_config()> to disable a distribution before attempting to delete.
*
* Access:
* public
*
* Parameters:
* distribution_id - _string_ (Required) The distribution ID returned from <create_distribution()> or <list_distributions()>.
* etag - _string_ (Required) The ETag header value retrieved from a call to <get_distribution_config()>.
* opt - _array_ (Optional) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/z_delete_distribution.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/DeleteDistribution.html
* Related - <create_distribution()>, <list_distributions()>, <get_distribution_info()>, <delete_distribution()>
*/
public function delete_distribution($distribution_id, $etag = null, $opt = null)
{
return $this->authenticate(HTTP_DELETE, '/' . $distribution_id, $opt, null, $etag);
}
/*%******************************************************************************************%*/
// DISTRIBUTION CONFIG
/**
* Method: get_distribution_config()
* Gets the current distribution config information for a given distribution ID.
*
* Access:
* public
*
* Parameters:
* distribution_id - _string_ (Required) The distribution ID returned from <create_distribution()> or <list_distributions()>.
* opt - _array_ (Required) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/get_distribution_config.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/GetConfig.html
* Related - <get_distribution_config()>, <set_distribution_config()>
*/
public function get_distribution_config($distribution_id, $opt = null)
{
return $this->authenticate(HTTP_GET, '/' . $distribution_id . '/config', $opt, null, null);
}
/**
* Method: set_distribution_config()
* Sets a new distribution config for a given distribution ID.
*
* Access:
* public
*
* Parameters:
* distribution_id - _string_ (Required) The distribution ID returned from <create_distribution()> or <list_distributions()>.
* xml - _string_ (Required) The DistributionConfig XML generated by <generate_config_xml()> or <update_config_xml()>.
* etag - _string_ (Required) The ETag header value retrieved from a call to <get_distribution_config()>.
* opt - _array_ (Required) Associative array of parameters which can have the following keys:
*
* Keys for the $opt parameter:
* returnCurlHandle - _boolean_ (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests.
*
* Returns:
* <ResponseCore> object
*
* Examples:
* example::cloudfront/set_distribution_config.phpt:
*
* See Also:
* AWS Method - http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PutConfig.html
* Related - <get_distribution_config()>, <set_distribution_config()>
*/
public function set_distribution_config($distribution_id, $xml, $etag, $opt = null)
{
return $this->authenticate(HTTP_PUT, '/' . $distribution_id . '/config', $opt, $xml, $etag);
}
}