def to_xml(self): resources = self.resources x = XMLBuilder('CloudService', xmlns="http://schemas.microsoft.com/windowsazure") x['xml_header'] = True x.GeoRegion(self.geo_region) with x.Resources: for resource in self.resources: with x.Resource: x.ETag(resource.incarnation_id) x.Name(resource.name) with x.OperationStatus: x.Result("Succeeded") x.Plan(resource.plan) x.State("Started") x.SubState("Ready to go") x.Type(resource.resource_type) with x.UsageMeters: for usage_meter in resource.usage_meters: with x.UsageMeter: x.Included(usage_meter["Included"]) x.Name(usage_meter["Name"]) x.Unit(usage_meter["Unit"]) x.Used(usage_meter["Used"]) return str(x)
def to_xml(self): x = XMLBuilder('Resource', xmlns="http://schemas.microsoft.com/windowsazure") x.CloudServiceSettings() x.ETag(self.incarnation_id) x.IntrinsicSettings() x.Name(self.name) with x.OperationStatus: x.Result("Succeeded") with x.OutputItems: for key in self.output_items.keys(): with x.OutputItem: x.Key(key) x.Value(self.output_items[key]) x.Plan(self.plan) x.State(self.state) x.SubState(self.sub_state) with x.UsageMeters: for usage_meter in self.usage_meters: with x.UsageMeter: x.Included(usage_meter["Included"]) x.Name(usage_meter["Name"]) x.Unit(usage_meter["Unit"]) x.Used(usage_meter["Used"]) x.Type(self.resource_type) return str(x)