OLD | NEW |
1 # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ |
2 # | 2 # |
3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
9 # lowing conditions: | 9 # lowing conditions: |
10 # | 10 # |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return self._get_info(distribution_id, 'distribution', Distribution) | 146 return self._get_info(distribution_id, 'distribution', Distribution) |
147 | 147 |
148 def get_distribution_config(self, distribution_id): | 148 def get_distribution_config(self, distribution_id): |
149 return self._get_config(distribution_id, 'distribution', | 149 return self._get_config(distribution_id, 'distribution', |
150 DistributionConfig) | 150 DistributionConfig) |
151 | 151 |
152 def set_distribution_config(self, distribution_id, etag, config): | 152 def set_distribution_config(self, distribution_id, etag, config): |
153 return self._set_config(distribution_id, etag, config) | 153 return self._set_config(distribution_id, etag, config) |
154 | 154 |
155 def create_distribution(self, origin, enabled, caller_reference='', | 155 def create_distribution(self, origin, enabled, caller_reference='', |
156 cnames=None, comment=''): | 156 cnames=None, comment='', trusted_signers=None): |
157 config = DistributionConfig(origin=origin, enabled=enabled, | 157 config = DistributionConfig(origin=origin, enabled=enabled, |
158 caller_reference=caller_reference, | 158 caller_reference=caller_reference, |
159 cnames=cnames, comment=comment) | 159 cnames=cnames, comment=comment, |
| 160 trusted_signers=trusted_signers) |
160 return self._create_object(config, 'distribution', Distribution) | 161 return self._create_object(config, 'distribution', Distribution) |
161 | 162 |
162 def delete_distribution(self, distribution_id, etag): | 163 def delete_distribution(self, distribution_id, etag): |
163 return self._delete_object(distribution_id, etag, 'distribution') | 164 return self._delete_object(distribution_id, etag, 'distribution') |
164 | 165 |
165 # Streaming Distributions | 166 # Streaming Distributions |
166 | 167 |
167 def get_all_streaming_distributions(self): | 168 def get_all_streaming_distributions(self): |
168 tags=[('StreamingDistributionSummary', StreamingDistributionSummary)] | 169 tags=[('StreamingDistributionSummary', StreamingDistributionSummary)] |
169 return self._get_all_objects('streaming-distribution', tags) | 170 return self._get_all_objects('streaming-distribution', tags) |
170 | 171 |
171 def get_streaming_distribution_info(self, distribution_id): | 172 def get_streaming_distribution_info(self, distribution_id): |
172 return self._get_info(distribution_id, 'streaming-distribution', | 173 return self._get_info(distribution_id, 'streaming-distribution', |
173 StreamingDistribution) | 174 StreamingDistribution) |
174 | 175 |
175 def get_streaming_distribution_config(self, distribution_id): | 176 def get_streaming_distribution_config(self, distribution_id): |
176 return self._get_config(distribution_id, 'streaming-distribution', | 177 return self._get_config(distribution_id, 'streaming-distribution', |
177 StreamingDistributionConfig) | 178 StreamingDistributionConfig) |
178 | 179 |
179 def set_streaming_distribution_config(self, distribution_id, etag, config): | 180 def set_streaming_distribution_config(self, distribution_id, etag, config): |
180 return self._set_config(distribution_id, etag, config) | 181 return self._set_config(distribution_id, etag, config) |
181 | 182 |
182 def create_streaming_distribution(self, origin, enabled, | 183 def create_streaming_distribution(self, origin, enabled, |
183 caller_reference='', | 184 caller_reference='', |
184 cnames=None, comment=''): | 185 cnames=None, comment='', |
| 186 trusted_signers=None): |
185 config = StreamingDistributionConfig(origin=origin, enabled=enabled, | 187 config = StreamingDistributionConfig(origin=origin, enabled=enabled, |
186 caller_reference=caller_reference, | 188 caller_reference=caller_reference, |
187 cnames=cnames, comment=comment) | 189 cnames=cnames, comment=comment, |
| 190 trusted_signers=trusted_signers) |
188 return self._create_object(config, 'streaming-distribution', | 191 return self._create_object(config, 'streaming-distribution', |
189 StreamingDistribution) | 192 StreamingDistribution) |
190 | 193 |
191 def delete_streaming_distribution(self, distribution_id, etag): | 194 def delete_streaming_distribution(self, distribution_id, etag): |
192 return self._delete_object(distribution_id, etag, 'streaming-distributio
n') | 195 return self._delete_object(distribution_id, etag, 'streaming-distributio
n') |
193 | 196 |
194 # Origin Access Identity | 197 # Origin Access Identity |
195 | 198 |
196 def get_all_origin_access_identity(self): | 199 def get_all_origin_access_identity(self): |
197 tags=[('CloudFrontOriginAccessIdentitySummary', | 200 tags=[('CloudFrontOriginAccessIdentitySummary', |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 {'Content-Type' : 'text/xml'}, | 242 {'Content-Type' : 'text/xml'}, |
240 data=paths.to_xml()) | 243 data=paths.to_xml()) |
241 body = response.read() | 244 body = response.read() |
242 if response.status == 201: | 245 if response.status == 201: |
243 h = handler.XmlHandler(paths, self) | 246 h = handler.XmlHandler(paths, self) |
244 xml.sax.parseString(body, h) | 247 xml.sax.parseString(body, h) |
245 return paths | 248 return paths |
246 else: | 249 else: |
247 raise CloudFrontServerError(response.status, response.reason, body) | 250 raise CloudFrontServerError(response.status, response.reason, body) |
248 | 251 |
| 252 def invalidation_request_status (self, distribution_id, request_id, caller_r
eference=None): |
| 253 uri = '/%s/distribution/%s/invalidation/%s' % (self.Version, distributio
n_id, request_id ) |
| 254 response = self.make_request('GET', uri, {'Content-Type' : 'text/xml'}) |
| 255 body = response.read() |
| 256 if response.status == 200: |
| 257 paths = InvalidationBatch([]) |
| 258 h = handler.XmlHandler(paths, self) |
| 259 xml.sax.parseString(body, h) |
| 260 return paths |
| 261 else: |
| 262 raise CloudFrontServerError(response.status, response.reason, body) |
| 263 |
| 264 |
OLD | NEW |