Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb7511a

Browse filesBrowse files
authored
Add samples for DLP API v2beta1 (GoogleCloudPlatform#1369)
1 parent 32d99af commit eb7511a
Copy full SHA for eb7511a
Expand file treeCollapse file tree

15 files changed

+1225
-0
lines changed

‎dlp/README.rst

Copy file name to clipboard
+183Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
.. This file is automatically generated. Do not edit this file directly.
2+
3+
Google Data Loss Prevention Python Samples
4+
===============================================================================
5+
6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=dlp/README.rst
8+
9+
10+
This directory contains samples for Google Data Loss Prevention. `Google Data Loss Prevention`_ provides programmatic access to a powerful detection engine for personally identifiable information and other privacy-sensitive data in unstructured data streams. **This api is currently in beta**.
11+
12+
13+
14+
15+
.. _Google Data Loss Prevention: https://cloud.google.com/dlp/docs/
16+
17+
Setup
18+
-------------------------------------------------------------------------------
19+
20+
21+
Authentication
22+
++++++++++++++
23+
24+
This sample requires you to have authentication setup. Refer to the
25+
`Authentication Getting Started Guide`_ for instructions on setting up
26+
credentials for applications.
27+
28+
.. _Authentication Getting Started Guide:
29+
https://cloud.google.com/docs/authentication/getting-started
30+
31+
Install Dependencies
32+
++++++++++++++++++++
33+
34+
#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.
35+
36+
.. _Python Development Environment Setup Guide:
37+
https://cloud.google.com/python/setup
38+
39+
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
40+
41+
.. code-block:: bash
42+
43+
$ virtualenv env
44+
$ source env/bin/activate
45+
46+
#. Install the dependencies needed to run the samples.
47+
48+
.. code-block:: bash
49+
50+
$ pip install -r requirements.txt
51+
52+
.. _pip: https://pip.pypa.io/
53+
.. _virtualenv: https://virtualenv.pypa.io/
54+
55+
Samples
56+
-------------------------------------------------------------------------------
57+
58+
Quickstart
59+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60+
61+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
62+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=dlp/quickstart.py;dlp/README.rst
63+
64+
65+
66+
67+
To run this sample:
68+
69+
.. code-block:: bash
70+
71+
$ python quickstart.py
72+
73+
74+
Inspect Content
75+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76+
77+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
78+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=dlp/inspect_content.py;dlp/README.rst
79+
80+
81+
82+
83+
To run this sample:
84+
85+
.. code-block:: bash
86+
87+
$ python inspect_content.py
88+
89+
usage: inspect_content.py [-h] {string,file,gcs} ...
90+
91+
Sample app that uses the Data Loss Prevention API to inspect a string, a local
92+
file or a file on Google Cloud Storage.
93+
94+
positional arguments:
95+
{string,file,gcs} Select how to submit content to the API.
96+
string Inspect a string.
97+
file Inspect a local file.
98+
gcs Inspect files on Google Cloud Storage.
99+
100+
optional arguments:
101+
-h, --help show this help message and exit
102+
103+
104+
105+
Redact Content
106+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
107+
108+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
109+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=dlp/redact.py;dlp/README.rst
110+
111+
112+
113+
114+
To run this sample:
115+
116+
.. code-block:: bash
117+
118+
$ python redact.py
119+
120+
usage: redact.py [-h] {string,image} ...
121+
122+
Sample app that uses the Data Loss Prevent API to redact the contents of a
123+
string or an image file.
124+
125+
positional arguments:
126+
{string,image} Select how to submit content to the API.
127+
string Inspect a string.
128+
image Inspect an image file.
129+
130+
optional arguments:
131+
-h, --help show this help message and exit
132+
133+
134+
135+
Display Metadata
136+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
137+
138+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
139+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=dlp/metadata.py;dlp/README.rst
140+
141+
142+
143+
144+
To run this sample:
145+
146+
.. code-block:: bash
147+
148+
$ python metadata.py
149+
150+
usage: metadata.py [-h] {categories,info_types} ...
151+
152+
Sample app that queries the Data Loss Prevention API for supported categories
153+
and info types.
154+
155+
positional arguments:
156+
{categories,info_types}
157+
Select which type of metadata to view.
158+
categories Fetch the list of info type categories.
159+
info_types Fetch the list of info types in a specified category.
160+
161+
optional arguments:
162+
-h, --help show this help message and exit
163+
164+
165+
166+
167+
168+
The client library
169+
-------------------------------------------------------------------------------
170+
171+
This sample uses the `Google Cloud Client Library for Python`_.
172+
You can read the documentation for more details on API usage and use GitHub
173+
to `browse the source`_ and `report issues`_.
174+
175+
.. _Google Cloud Client Library for Python:
176+
https://googlecloudplatform.github.io/google-cloud-python/
177+
.. _browse the source:
178+
https://github.com/GoogleCloudPlatform/google-cloud-python
179+
.. _report issues:
180+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
181+
182+
183+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

‎dlp/README.rst.in

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This file is used to generate README.rst
2+
3+
product:
4+
name: Google Data Loss Prevention
5+
short_name: Data Loss Prevention
6+
url: https://cloud.google.com/dlp/docs/
7+
description: >
8+
`Google Data Loss Prevention`_ provides programmatic access to a powerful
9+
detection engine for personally identifiable information and other
10+
privacy-sensitive data in unstructured data streams.
11+
**This api is currently in beta**.
12+
13+
setup:
14+
- auth
15+
- install_deps
16+
17+
samples:
18+
- name: Quickstart
19+
file: quickstart.py
20+
- name: Inspect Content
21+
file: inspect_content.py
22+
show_help: true
23+
- name: Redact Content
24+
file: redact.py
25+
show_help: true
26+
- name: Display Metadata
27+
file: metadata.py
28+
show_help: true
29+
30+
cloud_client_library: true
31+
32+
folder: dlp

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.