<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from base64 import b64encode <EOL> import gdata . apps <EOL> import gdata . apps . service <EOL> import gdata . service <EOL> class AuditService ( gdata . apps . service . PropertyService ) : <EOL> """<STR_LIT>""" <EOL> def _serviceUrl ( self , setting_id , domain = None , user = None ) : <EOL> if domain is None : <EOL> domain = self . domain <EOL> if user is None : <EOL> return '<STR_LIT>' % ( setting_id , domain ) <EOL> else : <EOL> return '<STR_LIT>' % ( setting_id , domain , user ) <EOL> def updatePGPKey ( self , pgpkey ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' ) <EOL> b64pgpkey = b64encode ( pgpkey ) <EOL> properties = { } <EOL> properties [ '<STR_LIT>' ] = b64pgpkey <EOL> return self . _PostProperties ( uri , properties ) <EOL> def createEmailMonitor ( self , source_user , destination_user , end_date , <EOL> begin_date = None , incoming_headers_only = False , <EOL> outgoing_headers_only = False , drafts = False , <EOL> drafts_headers_only = False , chats = False , <EOL> chats_headers_only = False ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = source_user ) <EOL> properties = { } <EOL> properties [ '<STR_LIT>' ] = destination_user <EOL> if begin_date is not None : <EOL> properties [ '<STR_LIT>' ] = begin_date <EOL> properties [ '<STR_LIT>' ] = end_date <EOL> if incoming_headers_only : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if outgoing_headers_only : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if drafts : <EOL> if drafts_headers_only : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if chats : <EOL> if chats_headers_only : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return self . _PostProperties ( uri , properties ) <EOL> def getEmailMonitors ( self , user ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user ) <EOL> return self . _GetPropertiesList ( uri ) <EOL> def deleteEmailMonitor ( self , source_user , destination_user ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = source_user + '<STR_LIT:/>' + destination_user ) <EOL> try : <EOL> return self . _DeleteProperties ( uri ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) <EOL> def createAccountInformationRequest ( self , user ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user ) <EOL> properties = { } <EOL> try : <EOL> return self . _PostProperties ( uri , properties ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) <EOL> def getAccountInformationRequestStatus ( self , user , request_id ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user + '<STR_LIT:/>' + request_id ) <EOL> try : <EOL> return self . _GetProperties ( uri ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) <EOL> def getAllAccountInformationRequestsStatus ( self ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' ) <EOL> return self . _GetPropertiesList ( uri ) <EOL> def deleteAccountInformationRequest ( self , user , request_id ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user + '<STR_LIT:/>' + request_id ) <EOL> try : <EOL> return self . _DeleteProperties ( uri ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) <EOL> def createMailboxExportRequest ( self , user , begin_date = None , end_date = None , include_deleted = False , search_query = None , headers_only = False ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user ) <EOL> properties = { } <EOL> if begin_date is not None : <EOL> properties [ '<STR_LIT>' ] = begin_date <EOL> if end_date is not None : <EOL> properties [ '<STR_LIT>' ] = end_date <EOL> if include_deleted is not None : <EOL> properties [ '<STR_LIT>' ] = gdata . apps . service . _bool2str ( include_deleted ) <EOL> if search_query is not None : <EOL> properties [ '<STR_LIT>' ] = search_query <EOL> if headers_only is True : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> properties [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return self . _PostProperties ( uri , properties ) <EOL> def getMailboxExportRequestStatus ( self , user , request_id ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user + '<STR_LIT:/>' + request_id ) <EOL> try : <EOL> return self . _GetProperties ( uri ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) <EOL> def getAllMailboxExportRequestsStatus ( self ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' ) <EOL> return self . _GetPropertiesList ( uri ) <EOL> def deleteMailboxExportRequest ( self , user , request_id ) : <EOL> """<STR_LIT>""" <EOL> uri = self . _serviceUrl ( '<STR_LIT>' , user = user + '<STR_LIT:/>' + request_id ) <EOL> try : <EOL> return self . _DeleteProperties ( uri ) <EOL> except gdata . service . RequestError , e : <EOL> raise AppsForYourDomainException ( e . args [ <NUM_LIT:0> ] ) </s>
