Vault API를 사용하면 Vault 내보내기를 관리할 수 있습니다. 다음과 같은 작업을 할 수 있습니다.
내보내기 생성: 쿼리와 일치하는 메시지 또는 파일을 찾아 Google Cloud로 내보내는 요청을 Vault에 보냅니다.
참고:
- 조직 전체에서 한 번에 최대 20개의 내보내기를 실행할 수 있습니다. 내보내기 속도를 높이려면 큰 내보내기를 작은 내보내기로 나누세요. 예를 들어 한 번에 모든 데이터를 내보내는 대신 월별로 데이터를 내보냅니다. 각 내보내기에 사용자, 그룹, 채팅 스페이스와 같은 항목을 더 적게 포함하는 방법도 있습니다.
- 내보내기는 생성 후 15일 동안 사용할 수 있으며 그 후에는 삭제되어 더 이상 액세스할 수 없습니다.
예:
내보내기 목록: 케이스와 연결된 모든 내보내기의 상태를 가져옵니다.
내보내기 가져오기: 내보내기에 관한 정보를 가져옵니다.
내보내기 다운로드: Google Cloud에서 내보내기를 다운로드합니다.
내보내기 삭제: 더 이상 필요하지 않은 케이스에서 내보내기를 삭제합니다.
시작하기 전에
필요한 라이브러리와 인증을 설정하려면 프로그래밍 언어에 맞는 빠른 시작을 진행하세요.
Vault 리소스를 사용하려면 계정에 필요한 Vault 권한이 있고 케이스에 액세스할 수 있어야 합니다. 법적 사안에 액세스하려면 계정에서 법적 사안을 만들었거나, 법적 사안이 공유되었거나, 모든 법적 사안 보기 권한이 있어야 합니다.
Gmail 내보내기 만들기
다음 예에서는 Gmail 내보내기를 만드는 방법을 보여줍니다. 이 요청은 다음 기준을 충족하는 모든 Gmail 및 기존 행아웃 메시지를 내보냅니다.
- 계정
email1및email2에서 소유한 메시지 - 임시보관 메일을 제외합니다.
ceo@solarmora.com로 전송된 메시지
도움말: 이 예에서는 기존 Gmail 내보내기 시스템을 사용합니다. 새 내보내기 시스템을 사용하여 내보내려면 MailExportOptions에서 useNewExport을 true로 설정합니다.
자바
public Export createMailAccountHeldDataExports(Vault client, String matterId) {
AccountInfo emailsToSearch = new AccountInfo().setEmails(ImmutableList.of("email1", "email2"));
MailOptions mailQueryOptions = new MailOptions().setExportFormat("PST");
String queryTerms = "to:ceo@solarmora.com";
Query mailQuery =
new Query()
.setCorpus("MAIL")
.setDataScope("HELD_DATA")
.setSearchMethod("ACCOUNT")
.setAccountInfo(emailsToSearch)
.setTerms(queryTerms)
.setMailOptions(mailQueryOptions);
MailExportOptions mailExportOptions =
new MailExportOptions()
.setExportFormat("MBOX")
.showConfidentialModeContent(true);
Export wantedExport =
new Export()
.setMatterId(matterId)
.setName("My first mail accounts export")
.setQuery(mailQuery)
.setExportOptions(new ExportOptions().setMailOptions(mailExportOptions));
return client.matters().exports().create(matter, wantedExport).execute();
}
Python
def create_mail_account_held_data_export(service, matter_id):
emails_to_search = ['email1', 'email2']
mail_query_options = {'excludeDrafts': True}
query_terms = 'to:ceo@solarmora.com'
mail_query = {
'corpus': 'MAIL',
'dataScope': 'HELD_DATA',
'searchMethod': 'ACCOUNT',
'accountInfo': {
'emails': emails_to_search
},
'terms': query_terms,
'mailOptions': mail_query_options,
}
mail_export_options = {
'exportFormat': 'MBOX',
'showConfidentialModeContent': True
}
wanted_export = {
'name': 'My first mail accounts export',
'query': mail_query,
'exportOptions': {
'mailOptions': mail_export_options
}
}
return service.matters().exports().create(
matterId=matter_id, body=wanted_export).execute()
Drive 내보내기 만들기
다음 예에서는 Drive 내보내기를 만드는 방법을 보여줍니다. 이 요청은 다음 기준을 충족하는 모든 파일(공유 드라이브의 파일 포함)을 내보냅니다.
- 지정된 조직 단위 (Admin SDK로 획득)에 속합니다.
지정된 시간 사이에 생성된 경우에만
자바
public Export createDriveOuAllDataExport(Vault client, String matterId) {
OrgUnitInfo ouToSearch = new OrgUnitInfo().setOrgUnitId("ou id retrieved from admin sdk");
DriveOptions driveQueryOptions = new DriveOptions().setIncludeSharedDrives(true);
Query driveQuery =
new Query()
.setCorpus("DRIVE")
.setDataScope("ALL_DATA")
.setSearchMethod("ORG_UNIT")
.setOrgUnitInfo(ouToSearch)
.setDriveOptions(driveQueryOptions)
.setStartTime("2017-03-16T00:00:00Z")
.setEndTime("2017-03-16T00:00:00Z")
.setTimeZone("Etc/GMT+2");
DriveExportOptions driveExportOptions = new DriveExportOptions().setIncludeAccessInfo(false);
Export wantedExport =
new Export()
.setName("My first drive ou export")
.setQuery(driveQuery)
.setExportOptions(new ExportOptions().setDriveOptions(driveExportOptions));
return client.matters().exports().create(matter, wantedExport).execute();
}
Python
def create_drive_ou_all_data_export(service, matter_id):
ou_to_search = 'ou id retrieved from admin sdk'
drive_query_options = {'includeSharedDrives': True}
drive_query = {
'corpus': 'DRIVE',
'dataScope': 'ALL_DATA',
'searchMethod': 'ORG_UNIT',
'orgUnitInfo': {
'org_unit_id': ou_to_search
},
'driveOptions': drive_query_options,
'startTime': '2017-03-16T00:00:00Z',
'endTime': '2017-09-23T00:00:00Z',
'timeZone': 'Etc/GMT+2'
}
drive_export_options = {'includeAccessInfo': False}
wanted_export = {
'name': 'My first drive ou export',
'query': drive_query,
'exportOptions': {
'driveOptions': drive_export_options
}
}
return service.matters().exports().create(
matterId=matter_id, body=wanted_export).execute()
Meet 내보내기 만들기
다음 예에서는 Meet 내보내기를 만드는 방법을 보여줍니다. 이 요청은 Meet 녹화 파일 이름 패턴을 따르는 파일 이름을 가진 지정된 조직 단위의 계정과 연결된 파일을 내보냅니다.
Python
def create_meet_export(service, matter_id, ou_to_search, export_name):
export = {
'name': export_name,
'query': {
'corpus': 'DRIVE',
'dataScope': 'ALL_DATA',
'searchMethod': 'ORG_UNIT',
'terms': 'title:"...-...-... \\(....-..-.. at ..:.. *\\)"',
'orgUnitInfo': {
'orgUnitId': 'id:'+ou_to_search
},
'driveOptions': {
'includeTeamDrives': True,
'includeSharedDrives': True
},
'timeZone': 'Etc/GMT',
'method': 'ORG_UNIT'
},
'exportOptions': {
'driveOptions': {},
'region': 'ANY'
},
}
return service.matters().exports().create(
matterId=matter_id, body=export).execute()
저장된 쿼리에서 내보내기
다음 예에서는 저장된 쿼리에서 내보내기를 만드는 방법을 보여줍니다.
Python
def create_mail_export_from_saved_query(service, matter_id, saved_query_id, export_name):
export = {
'name': export_name,
'exportOptions': {
'mailOptions': {
'exportFormat': 'PST',
'showConfidentialModeContent': True
},
'region': 'ANY'
}
}
export['query'] = service.matters().savedQueries().get(
savedQueryId=saved_query_id, matterId=matter_id).execute()['query']
return service.matters().exports().create(
matterId=matter_id, body=export).execute()
내보내기 나열
다음 예에서는 케이스와 연결된 내보내기 목록을 가져오는 방법을 보여줍니다.
자바
public class exports {
public ListExportsResponse listExports(Vault client, String matterId) {
return client.matters().exports().list(matterId).execute();
}
Python
def list_exports(service, matter_id):
return service.matters().exports().list(matterId=matter_id).execute()
내보내기에 관한 정보 가져오기
다음 예에서는 특정 내보내기에 관한 정보를 가져오는 방법을 보여줍니다. 참고: 내보낸 파일과 메시지를 다운로드하려면 다음 예와 같이 Cloud API를 사용합니다.
자바
public Export getExportById(Vault client, String matterId, String exportId) {
return client.matters().exports().get(matterId, exportId).execute();
}
Python
def get_export_by_id(service, matter_id, export_id):
return service.matters().exports().get(
matterId=matter_id, exportId=export_id).execute()
Google Cloud에서 내보내기 다운로드
다음 예에서는 Google Cloud에서 케이스의 완료된 모든 내보내기를 다운로드하는 방법을 보여줍니다. 이 요청은 Vault 및 Cloud API를 사용합니다.
참고: 내보내기를 다운로드하려면 계정에 내보내기 관리 권한이 있어야 하며 해당 계정과 공유된 법적 사안이 있어야 합니다.
Python
def download_exports(service, matter_id):
"""Google Cloud storage service is authenticated by running
`gcloud auth application-default login` and expects a billing enabled project
in ENV variable `GOOGLE_CLOUD_PROJECT` """
gcpClient = storage.Client()
matter_id = os.environ['MATTERID']
for export in vaultService.matters().exports().list(
matterId=matter_id).execute()['exports']:
if 'cloudStorageSink' in export:
directory = export['name']
if not os.path.exists(directory):
os.makedirs(directory)
print(export['id'])
for sinkFile in export['cloudStorageSink']['files']:
filename = '%s/%s' % (directory, sinkFile['objectName'].split('/')[-1])
objectURI = 'gs://%s/%s' % (sinkFile['bucketName'],
sinkFile['objectName'])
print('get %s to %s' % (objectURI, filename))
gcpClient.download_blob_to_file(objectURI, open(filename, 'wb+'))
내보내기 삭제
다음 예에서는 내보내기를 삭제하는 방법을 보여줍니다.
자바
public void deleteExportById(Vault client, String matterId, String exportId) {
client.matters().exports().delete(matterId, exportId).execute();
Python
def delete_export_by_id(service, matter_id, export_id):
return service.matters().exports().delete(
matterId=matter_id, exportId=export_id).execute()
검색 한도를 비롯한 검색 및 내보내기에 관한 앱별 정보는 Vault 검색 및 내보내기 시작하기를 참고하세요.