~ubuntu-branches/ubuntu/oneiric/python-boto/oneiric

« back to all changes in this revision

Viewing changes to docs/source/ref/cloudfront.rst

  • Committer: Bazaar Package Importer
  • Author(s): Scott Moser
  • Date: 2010-01-05 15:12:37 UTC
  • mfrom: (4.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100105151237-skgxjkyogir1vl0k
Tags: 1.9b-1ubuntu1
* merge Loic's changes made in 1.8d-1ubuntu2
* Rename Vcs-* to XS-Debian-Vcs-*.
* Run testsuite during build but ignore failures since it currently doesn't
  pass.
* Add ${misc:Depends}.
* Add XB-Python-Version: ${python:Versions}.

Show diffs side-by-side

added added

removed removed

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