<s> """<STR_LIT>""" <EOL> from boto . ec2 . ec2object import TaggedEC2Object <EOL> from boto . ec2 . launchspecification import LaunchSpecification <EOL> class SpotInstanceStateFault ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , code = None , message = None ) : <EOL> self . code = code <EOL> self . message = message <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( self . code , self . message ) <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT:code>' : <EOL> self . code = value <EOL> elif name == '<STR_LIT:message>' : <EOL> self . message = value <EOL> setattr ( self , name , value ) <EOL> class SpotInstanceStatus ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , code = None , update_time = None , message = None ) : <EOL> self . code = code <EOL> self . update_time = update_time <EOL> self . message = message <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . code <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT:code>' : <EOL> self . code = value <EOL> elif name == '<STR_LIT:message>' : <EOL> self . message = value <EOL> elif name == '<STR_LIT>' : <EOL> self . update_time = value <EOL> class SpotInstanceRequest ( TaggedEC2Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , connection = None ) : <EOL> super ( SpotInstanceRequest , self ) . __init__ ( connection ) <EOL> self . id = None <EOL> self . price = None <EOL> self . type = None <EOL> self . state = None <EOL> self . fault = None <EOL> self . valid_from = None <EOL> self . valid_until = None <EOL> self . launch_group = None <EOL> self . launched_availability_zone = None <EOL> self . product_description = None <EOL> self . availability_zone_group = None <EOL> self . create_time = None <EOL> self . launch_specification = None <EOL> self . instance_id = None <EOL> self . status = None <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . id <EOL> def startElement ( self , name , attrs , connection ) : <EOL> retval = super ( SpotInstanceRequest , self ) . startElement ( name , attrs , <EOL> connection ) <EOL> if retval is not None : <EOL> return retval <EOL> if name == '<STR_LIT>' : <EOL> self . launch_specification = LaunchSpecification ( connection ) <EOL> return self . launch_specification <EOL> elif name == '<STR_LIT>' : <EOL> self . fault = SpotInstanceStateFault ( ) <EOL> return self . fault <EOL> elif name == '<STR_LIT:status>' : <EOL> self . status = SpotInstanceStatus ( ) <EOL> return self . status <EOL> else : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . price = float ( value ) <EOL> elif name == '<STR_LIT:type>' : <EOL> self . type = value <EOL> elif name == '<STR_LIT:state>' : <EOL> self . state = value <EOL> elif name == '<STR_LIT>' : <EOL> self . valid_from = value <EOL> elif name == '<STR_LIT>' : <EOL> self . valid_until = value <EOL> elif name == '<STR_LIT>' : <EOL> self . launch_group = value <EOL> elif name == '<STR_LIT>' : <EOL> self . availability_zone_group = value <EOL> elif name == '<STR_LIT>' : <EOL> self . launched_availability_zone = value <EOL> elif name == '<STR_LIT>' : <EOL> self . instance_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . create_time = value <EOL> elif name == '<STR_LIT>' : <EOL> self . product_description = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> def cancel ( self , dry_run = False ) : <EOL> self . connection . cancel_spot_instance_requests ( <EOL> [ self . id ] , <EOL> dry_run = dry_run <EOL> ) </s>
