<s> import uuid <EOL> class OriginAccessIdentity : <EOL> def __init__ ( self , connection = None , config = None , id = '<STR_LIT>' , <EOL> s3_user_id = '<STR_LIT>' , comment = '<STR_LIT>' ) : <EOL> self . connection = connection <EOL> self . config = config <EOL> self . id = id <EOL> self . s3_user_id = s3_user_id <EOL> self . comment = comment <EOL> self . etag = None <EOL> def startElement ( self , name , attrs , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . config = OriginAccessIdentityConfig ( ) <EOL> return self . config <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 . s3_user_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . comment = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> def update ( self , comment = None ) : <EOL> new_config = OriginAccessIdentityConfig ( self . connection , <EOL> self . config . caller_reference , <EOL> self . config . comment ) <EOL> if comment != None : <EOL> new_config . comment = comment <EOL> self . etag = self . connection . set_origin_identity_config ( self . id , self . etag , new_config ) <EOL> self . config = new_config <EOL> def delete ( self ) : <EOL> return self . connection . delete_origin_access_identity ( self . id , self . etag ) <EOL> def uri ( self ) : <EOL> return '<STR_LIT>' % self . id <EOL> class OriginAccessIdentityConfig : <EOL> def __init__ ( self , connection = None , caller_reference = '<STR_LIT>' , comment = '<STR_LIT>' ) : <EOL> self . connection = connection <EOL> if caller_reference : <EOL> self . caller_reference = caller_reference <EOL> else : <EOL> self . caller_reference = str ( uuid . uuid4 ( ) ) <EOL> self . comment = comment <EOL> def to_xml ( self ) : <EOL> s = '<STR_LIT>' <EOL> s += '<STR_LIT>' <EOL> s += '<STR_LIT>' % self . caller_reference <EOL> if self . comment : <EOL> s += '<STR_LIT>' % self . comment <EOL> s += '<STR_LIT>' <EOL> return s <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . comment = value <EOL> elif name == '<STR_LIT>' : <EOL> self . caller_reference = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> class OriginAccessIdentitySummary : <EOL> def __init__ ( self , connection = None , id = '<STR_LIT>' , <EOL> s3_user_id = '<STR_LIT>' , comment = '<STR_LIT>' ) : <EOL> self . connection = connection <EOL> self . id = id <EOL> self . s3_user_id = s3_user_id <EOL> self . comment = comment <EOL> self . etag = None <EOL> def startElement ( self , name , attrs , connection ) : <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 . s3_user_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . comment = value <EOL> else : <EOL> setattr ( self , name , value ) <EOL> def get_origin_access_identity ( self ) : <EOL> return self . connection . get_origin_access_identity_info ( self . id ) </s>
