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)
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
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
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)
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)
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_')
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)
def setUp(self): self.dist = DistributionConfig()