Vault API를 사용하면 Vault 내보내기를 관리할 수 있습니다. 방법은 다음과 같습니다.
내보내기 만들기: Vault에 요청을 전송하여 쿼리와 일치하는 메시지 또는 파일을 찾아 Google Cloud로 내보냅니다.
참고: 조직 전체에서 진행 중인 내보내기는 최대 20개입니다. 성능을 개선하려면 대규모 내보내기를 작은 세트로 나눕니다. 예를 들어 모든 항목을 한 번에 내보내는 대신 월별로 내보내기를 분할할 수 있습니다. 또 다른 예는 각 내보내기에 더 적은 항목 (예: 사용자 및 그룹, 스페이스와 같은 특수 항목)을 포함하는 것입니다.
예를 들면 다음과 같습니다.
내보내기 나열—법적 사안과 관련된 모든 내보내기의 상태를 가져옵니다.
내보내기 가져오기: 내보내기에 대한 정보를 가져옵니다.
내보내기 다운로드: Google Cloud에서 내보내기를 다운로드합니다.
내보내기 삭제—더 이상 필요하지 않은 법적 사안에서 내보내기를 삭제합니다.
시작하기 전에
필요한 라이브러리와 인증을 설정하려면 사용 중인 프로그래밍 언어의 빠른 시작을 살펴보세요.
Vault 리소스를 사용하려면 계정에 필수 Vault 권한과 법적 사안에 대한 액세스 권한이 있어야 합니다. 법적 사안에 액세스하려면 계정에서 법적 사안을 만들었거나, 법적 사안을 공유받았거나, 모든 법적 사안 보기 권한이 있어야 합니다.
Gmail 내보내기 생성
다음 예는 Gmail 내보내기를 만드는 방법을 보여줍니다. 이 요청은 다음 기준을 충족하는 모든 Gmail 및 기존 행아웃 메시지를 내보냅니다.
email1
및email2
계정에서 소유한 메일- 임시보관 메일은 제외됩니다.
ceo@solarmora.com
(으)로 보낸 메시지
도움말: 이 예에서는 기존 Gmail 내보내기 시스템을 사용합니다. 새 내보내기 시스템을 사용하여 내보내려면 MailExportOptions에서 useNewExport
를 true로 설정합니다.
Java
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로 가져온 특정 조직 단위에 속해 있어야 합니다.
지정한 시간 사이에 생성된 것입니다.
Java
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()
내보내기 나열
다음 예에서는 법적 사안과 관련된 내보내기 목록을 검색하는 방법을 보여줍니다.
Java
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를 사용합니다 (다음 예).
Java
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+'))
내보내기 삭제
다음 예에서는 내보내기를 삭제하는 방법을 보여줍니다.
Java
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 검색 및 내보내기 시작하기를 참고하세요.