이제 Cloud Data Loss Prevention(Cloud DLP)은 민감한 정보 보호에 포함됩니다. API 이름은 Cloud Data Loss Prevention API(DLP API)로 그대로 유지됩니다. 민감한 정보 보호를 구성하는 서비스에 대한 자세한 내용은
민감한 정보 보호 개요 를 참조하세요.
의견 보내기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
DLP API를 사용하여 민감한 텍스트 검사
Sensitive Data Protection 및 JSON의 Cloud Data Loss Prevention API를 사용하여 샘플 문자열에서 민감한 정보를 스캔하는 방법을 알아봅니다.
Google Cloud 콘솔에서 이 태스크에 대한 단계별 안내를 직접 수행하려면 둘러보기 를 클릭합니다.
둘러보기
시작하기 전에
Install the Google Cloud CLI.
Configure the gcloud CLI to use your federated identity.
For more information, see
Browser-based sign-in with the gcloud CLI .
To initialize the gcloud CLI, run the following command:
gcloud init
Create or select a Google Cloud project .
Note : If you don't plan to keep the
resources that you create in this procedure, create a project instead of
selecting an existing project. After you finish these steps, you can
delete the project, removing all resources associated with the project.
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace PROJECT_ID
with a name for the Google Cloud project you are creating.
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace PROJECT_ID
with your Google Cloud project name.
Google Cloud 프로젝트에 결제가 사용 설정되어 있는지 확인합니다 .
DLP API를 사용 설정합니다.
gcloud services enable dlp.googleapis.com
Google 계정에 역할을 부여합니다. 다음 각 IAM 역할에 대해 다음 명령어를 한 번씩 실행합니다.
roles/dlp.user
gcloud projects add-iam-policy-binding PROJECT_ID --member= "user:EMAIL_ADDRESS " --role= ROLE
PROJECT_ID
를 프로젝트 ID로 바꿉니다.
EMAIL_ADDRESS
를 이메일 주소로 바꿉니다.
ROLE
을 각 개별 역할로 바꿉니다.
문자열에서 민감한 정보 검사
이 섹션에서는 projects.content.inspect
REST 메서드를 사용하여 샘플 텍스트를 스캔하도록 DLP API를 구성하는 방법을 보여줍니다.
이 섹션에서는 샘플 요청을 JSON 파일에 저장해야 합니다. Cloud Shell을 사용 중인 경우 Cloud Shell 편집기를 사용하여 파일을 만들면 됩니다. 편집기를 실행하려면 Cloud Shell 창의 툴바에서
edit 편집기 열기
launch 를 클릭합니다.
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트 ID입니다. 프로젝트 ID는 my-project
같은 영숫자 문자열입니다.
HTTP 메서드 및 URL:
POST https://dlp.googleapis.com/v2/projects/PROJECT_ID /content:inspect
JSON 요청 본문:
{
"item": {
"value": "My phone number is (800) 555-0123."
},
"inspectConfig": {
"infoTypes": [
{
"name": "PHONE_NUMBER"
},
{
"name": "US_TOLLFREE_PHONE_NUMBER"
}
],
"minLikelihood": "POSSIBLE",
"limits": {
"maxFindingsPerItem": 0
},
"includeQuote": true
}
}
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
요청 본문을 inspect-request.json
파일에 저장하고 다음 명령어를 실행합니다.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-user-project: PROJECT_ID " \ -H "Content-Type: application/json; charset=utf-8" \ -d @inspect-request.json \ "https://dlp.googleapis.com/v2/projects/PROJECT_ID /content:inspect"
PowerShell(Windows)
요청 본문을 inspect-request.json
파일에 저장하고 다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID " } Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile inspect-request.json ` -Uri "https://dlp.googleapis.com/v2/projects/PROJECT_ID /content:inspect" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
{
"result": {
"findings": [
{
"quote": "(800) 555-0123",
"infoType": {
"name": "US_TOLLFREE_PHONE_NUMBER"
},
"likelihood": "LIKELY",
"location": {
"byteRange": {
"start": "19",
"end": "33"
},
"codepointRange": {
"start": "19",
"end": "33"
}
},
"createTime": "2022-09-23T01:53:05.303Z",
"findingId": "2022-09-23T01:53:05.306348Z5328915744504121862"
}
]
}
}
삭제
이 페이지에서 사용한 리소스 비용이 Google Cloud 계정에 청구되지 않도록 하려면 리소스가 포함된 Google Cloud 프로젝트를 삭제하면 됩니다.
프로젝트 삭제
이 빠른 시작을 위해 새 프로젝트를 만든 경우 추가 요금 청구를 방지하는 가장 쉬운 방법은 프로젝트를 삭제하는 것입니다.
주의 : 프로젝트를 삭제하면 다음과 같은 효과가 발생합니다.
프로젝트의 모든 항목이 삭제됩니다. 이 문서의 태스크에 기존 프로젝트를 사용한 경우 프로젝트를 삭제하면 프로젝트에서 수행한 다른 작업도 삭제됩니다.
커스텀 프로젝트 ID가 손실됩니다.
이 프로젝트를 만들 때 앞으로 사용할 커스텀 프로젝트 ID를 만들었을 수 있습니다. appspot.com
URL과 같이 프로젝트 ID를 사용하는 URL을 보존하려면 전체 프로젝트를 삭제하는 대신 프로젝트 내에서 선택한 리소스만 삭제합니다.
여러 아키텍처, 튜토리얼, 빠른 시작을 살펴보려는 경우 프로젝트를 재사용하면 프로젝트 할당량 한도 초과를 방지할 수 있습니다.
Google Cloud 프로젝트를 삭제합니다.
gcloud projects delete PROJECT_ID
사용자 인증 정보 취소
선택사항: gcloud CLI에서 사용자 인증 정보를 취소합니다.
gcloud auth revoke
다음 단계
텍스트 및 이미지에서 민감한 데이터 검사를 시작하려면 안내 가이드 를 참조하세요.
검사, 수정, infoType, 가능성에 대한 자세한 내용은 개념 을 참조하세요.
DLP API 자세히 알아보기
의견 보내기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-23(UTC)
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"번역 문제"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"기타"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"이해하기 쉬움"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"문제가 해결됨"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"기타"
}]
의견을 전달하고 싶나요?
{
"lastModified": "최종 업데이트: 2024-08-23(UTC)",
"confidential": False
}