| OLD | NEW |
| (Empty) | |
| 1 .. _cloudfront_tut: |
| 2 |
| 3 ========== |
| 4 CloudFront |
| 5 ========== |
| 6 |
| 7 This new boto module provides an interface to Amazon's Content Service, |
| 8 CloudFront. |
| 9 |
| 10 .. warning:: |
| 11 |
| 12 This module is not well tested. Paging of distributions is not yet |
| 13 supported. CNAME support is completely untested. Use with caution. |
| 14 Feedback and bug reports are greatly appreciated. |
| 15 |
| 16 Creating a CloudFront connection |
| 17 -------------------------------- |
| 18 |
| 19 >>> import boto |
| 20 >>> c = boto.connect_cloudfront() |
| 21 |
| 22 Create a new :class:`boto.cloudfront.distribution.Distribution`:: |
| 23 |
| 24 >>> distro = c.create_distribution(origin='mybucket.s3.amazonaws.com', enabl
ed=False, comment='My new Distribution') |
| 25 >>> d.domain_name |
| 26 u'd2oxf3980lnb8l.cloudfront.net' |
| 27 >>> d.id |
| 28 u'ECH69MOIW7613' |
| 29 >>> d.status |
| 30 u'InProgress' |
| 31 >>> d.config.comment |
| 32 u'My new distribution' |
| 33 >>> d.config.origin |
| 34 <S3Origin: mybucket.s3.amazonaws.com> |
| 35 >>> d.config.caller_reference |
| 36 u'31b8d9cf-a623-4a28-b062-a91856fac6d0' |
| 37 >>> d.config.enabled |
| 38 False |
| 39 |
| 40 Note that a new caller reference is created automatically, using |
| 41 uuid.uuid4(). The :class:`boto.cloudfront.distribution.Distribution`, |
| 42 :class:`boto.cloudfront.distribution.DistributionConfig` and |
| 43 :class:`boto.cloudfront.distribution.DistributionSummary` objects are defined |
| 44 in the :mod:`boto.cloudfront.distribution` module. |
| 45 |
| 46 To get a listing of all current distributions:: |
| 47 |
| 48 >>> rs = c.get_all_distributions() |
| 49 >>> rs |
| 50 [<boto.cloudfront.distribution.DistributionSummary instance at 0xe8d4e0>, |
| 51 <boto.cloudfront.distribution.DistributionSummary instance at 0xe8d788>] |
| 52 |
| 53 This returns a list of :class:`boto.cloudfront.distribution.DistributionSummary` |
| 54 objects. Note that paging is not yet supported! To get a |
| 55 :class:`boto.cloudfront.distribution.DistributionObject` from a |
| 56 :class:`boto.cloudfront.distribution.DistributionSummary` object:: |
| 57 |
| 58 >>> ds = rs[1] |
| 59 >>> distro = ds.get_distribution() |
| 60 >>> distro.domain_name |
| 61 u'd2oxf3980lnb8l.cloudfront.net' |
| 62 |
| 63 To change a property of a distribution object:: |
| 64 |
| 65 >>> distro.comment |
| 66 u'My new distribution' |
| 67 >>> distro.update(comment='This is a much better comment') |
| 68 >>> distro.comment |
| 69 'This is a much better comment' |
| 70 |
| 71 You can also enable/disable a distribution using the following |
| 72 convenience methods:: |
| 73 |
| 74 >>> distro.enable() # just calls distro.update(enabled=True) |
| 75 |
| 76 or |
| 77 |
| 78 >>> distro.disable() # just calls distro.update(enabled=False) |
| 79 |
| 80 The only attributes that can be updated for a Distribution are |
| 81 comment, enabled and cnames. |
| 82 |
| 83 To delete a :class:`boto.cloudfront.distribution.Distribution`:: |
| 84 |
| 85 >>> distro.delete() |
| OLD | NEW |