| 108 | self.dist_summs.append(DistributionSummary(dist_summ)) |
| 109 | |
| 110 | class Distribution(object): |
| 111 | ## Example: |
| 112 | ## |
| 113 | ## <Distribution xmlns="http://cloudfront.amazonaws.com/doc/2010-07-15/"> |
| 114 | ## <Id>1234567890ABC</Id> |
| 115 | ## <Status>InProgress</Status> |
| 116 | ## <LastModifiedTime>2009-01-16T13:07:11.319Z</LastModifiedTime> |
| 117 | ## <DomainName>blahblahblah.cloudfront.net</DomainName> |
| 118 | ## <DistributionConfig> |
| 119 | ## ... handled by DistributionConfig() class ... |
| 120 | ## </DistributionConfig> |
| 121 | ## </Distribution> |
| 122 | |
| 123 | def __init__(self, xml): |
| 124 | tree = getTreeFromXml(xml) |
| 125 | if tree.tag != "Distribution": |
| 126 | raise ValueError("Expected <Distribution /> xml, got: <%s />" % tree.tag) |
| 127 | self.parse(tree) |
| 128 | |
| 129 | def parse(self, tree): |
| 130 | self.info = getDictFromTree(tree) |
| 131 | ## Normalise some items |
| 132 | self.info['LastModifiedTime'] = dateS3toPython(self.info['LastModifiedTime']) |
| 133 | |
| 134 | self.info['DistributionConfig'] = DistributionConfig(tree = tree.find(".//DistributionConfig")) |
| 135 | |
| 136 | def uri(self): |
| 137 | return S3Uri(u"cf://%s" % self.info['Id']) |
| 138 | |
| 139 | class DistributionConfig(object): |
| 140 | ## Example: |
no outgoing calls
no test coverage detected
searching dependent graphs…