~ubuntu-branches/ubuntu/trusty/python-boto/trusty

« back to all changes in this revision

Viewing changes to boto/cloudfront/distribution.py

  • Committer: Package Import Robot
  • Author(s): Eric Evans
  • Date: 2013-08-13 13:56:47 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130813135647-o43z7y15uid87fzl
Tags: 2.10.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from boto.cloudfront.origin import S3Origin, CustomOrigin
31
31
from boto.s3.acl import ACL
32
32
 
33
 
class DistributionConfig:
 
33
class DistributionConfig(object):
34
34
 
35
35
    def __init__(self, connection=None, origin=None, enabled=False,
36
36
                 caller_reference='', cnames=None, comment='',
100
100
            self.cnames = cnames
101
101
        self.comment = comment
102
102
        self.trusted_signers = trusted_signers
103
 
        self.logging = None
 
103
        self.logging = logging
104
104
        self.default_root_object = default_root_object
105
105
 
106
106
    def to_xml(self):
214
214
        s += '</StreamingDistributionConfig>\n'
215
215
        return s
216
216
 
217
 
class DistributionSummary:
 
217
class DistributionSummary(object):
218
218
 
219
219
    def __init__(self, connection=None, domain_name='', id='',
220
220
                 last_modified_time=None, status='', origin=None,
279
279
    def get_distribution(self):
280
280
        return self.connection.get_streaming_distribution_info(self.id)
281
281
 
282
 
class Distribution:
 
282
class Distribution(object):
283
283
 
284
284
    def __init__(self, connection=None, config=None, domain_name='',
285
285
                 id='', last_modified_time=None, status=''):
362
362
 
363
363
    def enable(self):
364
364
        """
365
 
        Deactivate the Distribution.  A convenience wrapper around
 
365
        Activate the Distribution.  A convenience wrapper around
366
366
        the update method.
367
367
        """
368
368
        self.update(enabled=True)
369
369
 
370
370
    def disable(self):
371
371
        """
372
 
        Activate the Distribution.  A convenience wrapper around
 
372
        Deactivate the Distribution.  A convenience wrapper around
373
373
        the update method.
374
374
        """
375
375
        self.update(enabled=False)
654
654
            raise ValueError("Only specify the private_key_file or the private_key_string not both")
655
655
        if not private_key_file and not private_key_string:
656
656
            raise ValueError("You must specify one of private_key_file or private_key_string")
657
 
        # If private_key_file is a file, read its contents. Otherwise, open it and then read it
658
 
        if isinstance(private_key_file, file):
659
 
            private_key_string = private_key_file.read()
660
 
        elif private_key_file:
661
 
            with open(private_key_file, 'r') as file_handle:
662
 
                private_key_string = file_handle.read()
 
657
        # If private_key_file is a file name, open it and read it
 
658
        if private_key_string is None:
 
659
            if isinstance(private_key_file, basestring):
 
660
                with open(private_key_file, 'r') as file_handle:
 
661
                    private_key_string = file_handle.read()
 
662
            # Otherwise, treat it like a file
 
663
            else:
 
664
                private_key_string = private_key_file.read()
663
665
 
664
666
        # Sign it!
665
667
        private_key = rsa.PrivateKey.load_pkcs1(private_key_string)