public class

AuditService

extends AppsPropertyService
java.lang.Object
   ↳ com.google.gdata.client.Service
     ↳ com.google.gdata.client.GoogleService
       ↳ com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
         ↳ com.google.gdata.client.appsforyourdomain.AppsPropertyService
           ↳ com.google.gdata.client.appsforyourdomain.audit.AuditService

Class Overview

AuditService allows Google Apps administrators to audit user's emails, email drafts, and archived chats.

Summary

Constants
String BASE_URL
[Expand]
Inherited Constants
From class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
Fields
private static final DateFormat DATE_FORMAT
private static Logger LOGGER
private String domain
[Expand]
Inherited Fields
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
Public Constructors
AuditService(String adminEmail, String adminPassword, String domain, String applicationName)
Parameterized constructor for AuditService.
AuditService(String domain, String applicationName)
Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token.
Public Methods
GenericEntry createAccountInfoRequest(String user)
Creates a new Account Information request.
GenericEntry createMailMonitor(String sourceUser, MailMonitor mailMonitor)
Creates a new monitoring task to begin an audit.
GenericEntry createMailboxDumpRequest(MailBoxDumpRequest mailBoxDumpRequest)
Creates a new request for obtaining a user mailbox dump.
void deleteAccountInfoRequest(String user, String requestId)
Deletes the account info request for the given user
boolean deleteMailboxDumpRequest(String user, String id)
Deletes the mailbox dump request for the given ID and user.
void deleteMonitor(String sourceUser, String destUser)
Removes the monitor configured for the given source and destination user.
GenericEntry retrieveAccountInfoRequest(String user, String requestId)
Retrieves a previously created account/services related information request for the given user.
List<GenericEntry> retrieveAllAccountInfoRequests(Date fromDate)
Retrieve all the Account info requests from the given start date.
List<GenericEntry> retrieveAllMailboxDumpRequests(Date fromDate)
Retrieves all mailbox dump requests from the given start date.
GenericEntry retrieveMailboxDumpRequest(String user, String id)
Retrieves the mailbox dump request for the given ID and user.
GenericFeed retrieveMonitors(String sourceUser)
Retrieves all the monitors of a given user.
GenericFeed retrieveNextPageOfAccountInfoRequests(Link next)
Retrieves the next page of account info requests by following the atom next link.
GenericFeed retrieveNextPageOfMailboxDumpRequests(Link next)
Retrieves the next page of mailbox dump requests by following the atom next link.
GenericFeed retrievePageOfAccountInfoRequests(Date fromDate)
Retrieves a page of account info requests from the given optional start date.
GenericFeed retrievePageOfMailboxDumpRequests(Date fromDate)
Retrieves a page of mailbox dump requests from the given start date.
GenericEntry uploadPublicKey(String base64encodedKey)
Upload a public key for signing mailbox dump archives.
[Expand]
Inherited Methods
From class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
From class java.lang.Object
From interface com.google.gdata.client.AuthTokenFactory.TokenListener

Constants

public static final String BASE_URL

Constant Value: "https://apps-apis.google.com/a/feeds/compliance/audit/"

Fields

private static final DateFormat DATE_FORMAT

private static Logger LOGGER

private String domain

Public Constructors

public AuditService (String adminEmail, String adminPassword, String domain, String applicationName)

Parameterized constructor for AuditService.

Parameters
adminEmail Email id of the administrator
adminPassword Password for the administrator account
domain The domain to be monitored
applicationName Application name for e.g audit-mycompany
Throws
AuthenticationException if an authentication related error occurs.

public AuditService (String domain, String applicationName)

Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token. The user should explicitly authorize the service by calling either setUserCredentials or setUserToken when using this constructor.

Parameters
domain Domain being configured
applicationName Application name consuming the API
Throws
AuthenticationException If an authentication error occurs

Public Methods

public GenericEntry createAccountInfoRequest (String user)

Creates a new Account Information request. When completed, the account info is available for download.

Parameters
user The domain user whose account information is to be audited
Returns
  • GenericEntry with request details.
Throws
AppsForYourDomainException If an Audit API error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry createMailMonitor (String sourceUser, MailMonitor mailMonitor)

Creates a new monitoring task to begin an audit. Note: The number of daily requests are limited per domain, and can include requests from several administrators during the day

Parameters
sourceUser Is the user who receives or sends messages that are being audited.
mailMonitor A POJO with details of the monitoring task
Returns
  • a GenericEntry with details of the task created
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry createMailboxDumpRequest (MailBoxDumpRequest mailBoxDumpRequest)

Creates a new request for obtaining a user mailbox dump. The mailbox files are encrypted using the key uploaded uploadPublicKey and are available in mbox format

Parameters
mailBoxDumpRequest A POJO with request details.
Returns
  • the inserted entry
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public void deleteAccountInfoRequest (String user, String requestId)

Deletes the account info request for the given user

Parameters
user The user whose request is to be deleted
requestId The unique id of the request
Throws
AppsForYourDomainException If an Audit API error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public boolean deleteMailboxDumpRequest (String user, String id)

Deletes the mailbox dump request for the given ID and user.

Parameters
user The user whose dump requests need to be deleted.
id The requestId of the mailbox dump request.
Returns
  • true, if delete succeeds.
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public void deleteMonitor (String sourceUser, String destUser)

Removes the monitor configured for the given source and destination user. Note: The number of daily requests are limited per domain, and can include requests from several administrators during the day

Parameters
sourceUser The user who is being monitored
destUser This user is the auditor who receives the audited email messages as blind carbon copies (Bcc).
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry retrieveAccountInfoRequest (String user, String requestId)

Retrieves a previously created account/services related information request for the given user.

Parameters
user The user whose account info is being retrieved
requestId The unique requestId identifying the request
Returns
  • a GenericEntry instance with request details
Throws
AppsForYourDomainException If an Audit API error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public List<GenericEntry> retrieveAllAccountInfoRequests (Date fromDate)

Retrieve all the Account info requests from the given start date.

Parameters
fromDate Optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter.
Returns
  • Entries created starting the requested date
Throws
AppsForYourDomainException If an Audit API error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public List<GenericEntry> retrieveAllMailboxDumpRequests (Date fromDate)

Retrieves all mailbox dump requests from the given start date.

Parameters
fromDate Optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter.
Returns
  • a List of all mailbox dump request entries for the domain
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry retrieveMailboxDumpRequest (String user, String id)

Retrieves the mailbox dump request for the given ID and user.

Parameters
user The user whose dump requests need to be retrieved
id The requestId of the mailbox dump request
Returns
  • a GenericEntry instance of the requested dump request
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveMonitors (String sourceUser)

Retrieves all the monitors of a given user.

Parameters
sourceUser User whose monitors are to be retrieved
Returns
  • a GenericFeed object with details of monitors created.
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveNextPageOfAccountInfoRequests (Link next)

Retrieves the next page of account info requests by following the atom next link.

Parameters
next The feed link for next page
Returns
  • a page of account info request entries for the domain
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveNextPageOfMailboxDumpRequests (Link next)

Retrieves the next page of mailbox dump requests by following the atom next link.

Parameters
next The feed link for next page
Returns
  • a page of mailbox dump request entries for the domain
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrievePageOfAccountInfoRequests (Date fromDate)

Retrieves a page of account info requests from the given optional start date. Pass null for date to retrieve requests without date filter.

Parameters
fromDate Optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter
Returns
  • a page of account info request entries for the domain
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrievePageOfMailboxDumpRequests (Date fromDate)

Retrieves a page of mailbox dump requests from the given start date.

Parameters
fromDate Optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter
Returns
  • a page of mailbox dump request entries for the domain
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry uploadPublicKey (String base64encodedKey)

Upload a public key for signing mailbox dump archives. This public encryption key should be a PGP format ascii-encoded RSA key. Before uploading the public key, convert the key to a base64 encoded string

Parameters
base64encodedKey A Base64 encoded, PGP format ASCII read RSA key
Returns
  • a GenericEntry instance with the inserted entry.
Throws
AppsForYourDomainException If an Audit API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails