コード例 #1
0
 def __init__(self, connection=None, origin='', enabled=False,
              caller_reference='', cnames=None, comment='',
              trusted_signers=None):
     DistributionConfig.__init__(self, connection=connection,
                                 origin=origin, enabled=enabled,
                                 caller_reference=caller_reference,
                                 cnames=cnames, comment=comment,
                                 trusted_signers=trusted_signers)
コード例 #2
0
ファイル: __init__.py プロジェクト: GunioRobot/fileconveyor
 def get_distribution_config(self, distribution_id):
     response = self.make_request('GET', '/%s/distribution/%s/config' % (self.Version, distribution_id))
     body = response.read()
     if response.status >= 300:
         raise CloudFrontServerError(response.status, response.reason, body)
     d = DistributionConfig(connection=self)
     d.etag = self.get_etag(response)
     h = handler.XmlHandler(d, self)
     xml.sax.parseString(body, h)
     return d
コード例 #3
0
 def get_distribution_config(self, distribution_id):
     response = self.make_request(
         'GET',
         '/%s/distribution/%s/config' % (self.Version, distribution_id))
     body = response.read()
     if response.status >= 300:
         raise CloudFrontServerError(response.status, response.reason, body)
     d = DistributionConfig(connection=self)
     d.etag = self.get_etag(response)
     h = handler.XmlHandler(d, self)
     xml.sax.parseString(body, h)
     return d
コード例 #4
0
ファイル: __init__.py プロジェクト: GunioRobot/fileconveyor
 def create_distribution(self, origin, enabled, caller_reference='', cnames=None, comment=''):
     config = DistributionConfig(origin=origin, enabled=enabled,
                                 caller_reference=caller_reference,
                                 cnames=cnames, comment=comment)
     response = self.make_request('POST', '/%s/distribution' % self.Version,
                                  {'Content-Type' : 'text/xml'}, data=config.to_xml())
     body = response.read()
     if response.status == 201:
         d = Distribution(connection=self)
         h = handler.XmlHandler(d, self)
         xml.sax.parseString(body, h)
         return d
     else:
         raise CloudFrontServerError(response.status, response.reason, body)
コード例 #5
0
ファイル: __init__.py プロジェクト: bopopescu/Boto-4
 def create_distribution(self, origin, enabled, caller_reference='',
                         cnames=None, comment='', trusted_signers=None):
     config = DistributionConfig(origin=origin, enabled=enabled,
                                 caller_reference=caller_reference,
                                 cnames=cnames, comment=comment,
                                 trusted_signers=trusted_signers)
     return self._create_object(config, 'distribution', Distribution)
コード例 #6
0
    def test_logging(self):
        # Default.
        self.assertEqual(self.dist.logging, None)

        # Override.
        lo = LoggingInfo(bucket='whatever', prefix='override_')
        dist = DistributionConfig(logging=lo)
        self.assertEqual(dist.logging.bucket, 'whatever')
        self.assertEqual(dist.logging.prefix, 'override_')
コード例 #7
0
 def create_distribution(self,
                         origin,
                         enabled,
                         caller_reference='',
                         cnames=None,
                         comment=''):
     config = DistributionConfig(origin=origin,
                                 enabled=enabled,
                                 caller_reference=caller_reference,
                                 cnames=cnames,
                                 comment=comment)
     response = self.make_request('POST',
                                  '/%s/distribution' % self.Version,
                                  {'Content-Type': 'text/xml'},
                                  data=config.to_xml())
     body = response.read()
     if response.status == 201:
         d = Distribution(connection=self)
         h = handler.XmlHandler(d, self)
         xml.sax.parseString(body, h)
         return d
     else:
         raise CloudFrontServerError(response.status, response.reason, body)
コード例 #8
0
 def setUp(self):
     self.dist = DistributionConfig()