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

Method ModifyDistribution

S3/CloudFront.py:380–407  ·  view source on GitHub ↗
(self, cfuri, cnames_add = [], cnames_remove = [],
                           comment = None, enabled = None, logging = None,
                           default_root_object = None)

Source from the content-addressed store, hash-verified

378 return response
379
380 def ModifyDistribution(self, cfuri, cnames_add = [], cnames_remove = [],
381 comment = None, enabled = None, logging = None,
382 default_root_object = None):
383 if cfuri.type != "cf":
384 raise ValueError("Expected CFUri instead of: %s" % cfuri)
385 # Get current dist status (enabled/disabled) and Etag
386 info("Checking current status of %s" % cfuri)
387 response = self.GetDistConfig(cfuri)
388 dc = response['dist_config']
389 if enabled != None:
390 dc.info['Enabled'] = enabled
391 if comment != None:
392 dc.info['Comment'] = comment
393 if default_root_object != None:
394 dc.info['DefaultRootObject'] = default_root_object
395 for cname in cnames_add:
396 if dc.info['CNAME'].count(cname) == 0:
397 dc.info['CNAME'].append(cname)
398 for cname in cnames_remove:
399 while dc.info['CNAME'].count(cname) > 0:
400 dc.info['CNAME'].remove(cname)
401 if logging != None:
402 if logging == False:
403 dc.info['Logging'] = False
404 else:
405 dc.info['Logging'] = S3UriS3(logging)
406 response = self.SetDistConfig(cfuri, dc, response['headers']['etag'])
407 return response
408
409 def DeleteDistribution(self, cfuri):
410 if cfuri.type != "cf":

Callers 1

modifyMethod · 0.95

Calls 3

GetDistConfigMethod · 0.95
SetDistConfigMethod · 0.95
S3UriS3Class · 0.90

Tested by

no test coverage detected