<s> """<STR_LIT>""" <EOL> import json <EOL> import xml . etree . ElementTree as ET <EOL> from cafe . engine . models . base import AutoMarshallingModel <EOL> from cloudcafe . compute . common . constants import Constants <EOL> class UpdateQuotaRequest ( AutoMarshallingModel ) : <EOL> def __init__ ( self , cores = None , floating_ips = None , id = None , <EOL> injected_file_content_bytes = None , <EOL> injected_file_path_bytes = None , <EOL> injected_files = None , instances = None , <EOL> key_pairs = None , metadata_items = None , <EOL> ram = None , security_group_rules = None , <EOL> security_groups = None ) : <EOL> self . cores = cores <EOL> self . floating_ips = floating_ips <EOL> self . id = id <EOL> self . injected_file_content_bytes = injected_file_content_bytes <EOL> self . injected_file_path_bytes = injected_file_path_bytes <EOL> self . injected_files = injected_files <EOL> self . instances = instances <EOL> self . key_pairs = key_pairs <EOL> self . metadata_items = metadata_items <EOL> self . ram = ram <EOL> self . security_group_rules = security_group_rules <EOL> self . security_groups = security_groups <EOL> def _obj_to_json ( self ) : <EOL> """<STR_LIT>""" <EOL> body = { } <EOL> for key , value in self . __dict__ . iteritems ( ) : <EOL> if value is not None : <EOL> body [ key ] = value <EOL> return json . dumps ( { '<STR_LIT>' : body } ) <EOL> def _obj_to_xml ( self ) : <EOL> """<STR_LIT>""" <EOL> xml = Constants . XML_HEADER <EOL> element = ET . Element ( '<STR_LIT>' ) <EOL> element . set ( '<STR_LIT:id>' , self . id ) <EOL> for key , value in self . __dict__ . iteritems ( ) : <EOL> if value is not None and key != '<STR_LIT:id>' : <EOL> child = ET . Element ( key ) <EOL> child . text = str ( value ) <EOL> element . append ( child ) <EOL> xml += ET . tostring ( element ) <EOL> return xml </s>
