<s> """<STR_LIT>""" <EOL> from boto . ec2 . ec2object import TaggedEC2Object <EOL> class VpcInfo ( object ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> self . vpc_id = None <EOL> self . owner_id = None <EOL> self . cidr_block = None <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . vpc_id <EOL> def startElement ( self , name , attrs , connection ) : <EOL> pass <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . vpc_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . owner_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . cidr_block = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> class VpcPeeringConnectionStatus ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , code = <NUM_LIT:0> , 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> pass <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> else : <EOL> setattr ( self , name , value ) <EOL> class VpcPeeringConnection ( TaggedEC2Object ) : <EOL> def __init__ ( self , connection = None ) : <EOL> """<STR_LIT>""" <EOL> super ( VpcPeeringConnection , self ) . __init__ ( connection ) <EOL> self . id = None <EOL> self . accepter_vpc_info = VpcInfo ( ) <EOL> self . requester_vpc_info = VpcInfo ( ) <EOL> self . expiration_time = None <EOL> self . _status = VpcPeeringConnectionStatus ( ) <EOL> @ property <EOL> def status_code ( self ) : <EOL> return self . _status . code <EOL> @ property <EOL> def status_message ( self ) : <EOL> return self . _status . message <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . id <EOL> def startElement ( self , name , attrs , connection ) : <EOL> retval = super ( VpcPeeringConnection , self ) . startElement ( name , attrs , connection ) <EOL> if retval is not None : <EOL> return retval <EOL> if name == '<STR_LIT>' : <EOL> return self . requester_vpc_info <EOL> elif name == '<STR_LIT>' : <EOL> return self . accepter_vpc_info <EOL> elif name == '<STR_LIT:status>' : <EOL> return self . _status <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 . expiration_time = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> def delete ( self ) : <EOL> return self . connection . delete_vpc_peering_connection ( self . id ) <EOL> def _update ( self , updated ) : <EOL> self . __dict__ . update ( updated . __dict__ ) <EOL> def update ( self , validate = False , dry_run = False ) : <EOL> vpc_peering_connection_list = self . connection . get_all_vpc_peering_connections ( <EOL> [ self . id ] , <EOL> dry_run = dry_run <EOL> ) <EOL> if len ( vpc_peering_connection_list ) : <EOL> updated_vpc_peering_connection = vpc_peering_connection_list [ <NUM_LIT:0> ] <EOL> self . _update ( updated_vpc_peering_connection ) <EOL> elif validate : <EOL> raise ValueError ( '<STR_LIT>' % ( self . id , ) ) <EOL> return self . status_code </s>
