MCPcopy Create free account
hub / github.com/s3tools/s3cmd / CreateDistribution

Method CreateDistribution

S3/CloudFront.py:359–378  ·  view source on GitHub ↗
(self, uri, cnames_add = [], comment = None, logging = None, default_root_object = None)

Source from the content-addressed store, hash-verified

357 return response
358
359 def CreateDistribution(self, uri, cnames_add = [], comment = None, logging = None, default_root_object = None):
360 dist_config = DistributionConfig()
361 dist_config.info['Enabled'] = True
362 dist_config.info['S3Origin']['DNSName'] = uri.host_name()
363 dist_config.info['CallerReference'] = str(uri)
364 dist_config.info['DefaultRootObject'] = default_root_object
365 if comment == None:
366 dist_config.info['Comment'] = uri.public_url()
367 else:
368 dist_config.info['Comment'] = comment
369 for cname in cnames_add:
370 if dist_config.info['CNAME'].count(cname) == 0:
371 dist_config.info['CNAME'].append(cname)
372 if logging:
373 dist_config.info['Logging'] = S3UriS3(logging)
374 request_body = str(dist_config)
375 debug("CreateDistribution(): request_body: %s" % request_body)
376 response = self.send_request("CreateDist", body = request_body)
377 response['distribution'] = Distribution(response['data'])
378 return response
379
380 def ModifyDistribution(self, cfuri, cnames_add = [], cnames_remove = [],
381 comment = None, enabled = None, logging = None,

Callers 1

createMethod · 0.95

Calls 6

send_requestMethod · 0.95
S3UriS3Class · 0.90
DistributionConfigClass · 0.85
DistributionClass · 0.85
host_nameMethod · 0.80
public_urlMethod · 0.45

Tested by

no test coverage detected