forked from GoogleCloudPlatform/python-docs-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add samples for DLP API v2beta1 (GoogleCloudPlatform#1369)
- Loading branch information
Showing
15 changed files
with
1,225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
.. This file is automatically generated. Do not edit this file directly. | ||
Google Data Loss Prevention Python Samples | ||
=============================================================================== | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
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**. | ||
|
||
|
||
|
||
|
||
.. _Google Data Loss Prevention: https://cloud.google.com/dlp/docs/ | ||
|
||
Setup | ||
------------------------------------------------------------------------------- | ||
|
||
|
||
Authentication | ||
++++++++++++++ | ||
|
||
This sample requires you to have authentication setup. Refer to the | ||
`Authentication Getting Started Guide`_ for instructions on setting up | ||
credentials for applications. | ||
|
||
.. _Authentication Getting Started Guide: | ||
https://cloud.google.com/docs/authentication/getting-started | ||
|
||
Install Dependencies | ||
++++++++++++++++++++ | ||
|
||
#. 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. | ||
|
||
.. _Python Development Environment Setup Guide: | ||
https://cloud.google.com/python/setup | ||
|
||
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. | ||
|
||
.. code-block:: bash | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
#. Install the dependencies needed to run the samples. | ||
|
||
.. code-block:: bash | ||
$ pip install -r requirements.txt | ||
.. _pip: https://pip.pypa.io/ | ||
.. _virtualenv: https://virtualenv.pypa.io/ | ||
|
||
Samples | ||
------------------------------------------------------------------------------- | ||
|
||
Quickstart | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python quickstart.py | ||
Inspect Content | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python inspect_content.py | ||
usage: inspect_content.py [-h] {string,file,gcs} ... | ||
Sample app that uses the Data Loss Prevention API to inspect a string, a local | ||
file or a file on Google Cloud Storage. | ||
positional arguments: | ||
{string,file,gcs} Select how to submit content to the API. | ||
string Inspect a string. | ||
file Inspect a local file. | ||
gcs Inspect files on Google Cloud Storage. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
Redact Content | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python redact.py | ||
usage: redact.py [-h] {string,image} ... | ||
Sample app that uses the Data Loss Prevent API to redact the contents of a | ||
string or an image file. | ||
positional arguments: | ||
{string,image} Select how to submit content to the API. | ||
string Inspect a string. | ||
image Inspect an image file. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
Display Metadata | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python metadata.py | ||
usage: metadata.py [-h] {categories,info_types} ... | ||
Sample app that queries the Data Loss Prevention API for supported categories | ||
and info types. | ||
positional arguments: | ||
{categories,info_types} | ||
Select which type of metadata to view. | ||
categories Fetch the list of info type categories. | ||
info_types Fetch the list of info types in a specified category. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
The client library | ||
------------------------------------------------------------------------------- | ||
|
||
This sample uses the `Google Cloud Client Library for Python`_. | ||
You can read the documentation for more details on API usage and use GitHub | ||
to `browse the source`_ and `report issues`_. | ||
|
||
.. _Google Cloud Client Library for Python: | ||
https://googlecloudplatform.github.io/google-cloud-python/ | ||
.. _browse the source: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python | ||
.. _report issues: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python/issues | ||
|
||
|
||
.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is used to generate README.rst | ||
|
||
product: | ||
name: Google Data Loss Prevention | ||
short_name: Data Loss Prevention | ||
url: https://cloud.google.com/dlp/docs/ | ||
description: > | ||
`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**. | ||
|
||
setup: | ||
- auth | ||
- install_deps | ||
|
||
samples: | ||
- name: Quickstart | ||
file: quickstart.py | ||
- name: Inspect Content | ||
file: inspect_content.py | ||
show_help: true | ||
- name: Redact Content | ||
file: redact.py | ||
show_help: true | ||
- name: Display Metadata | ||
file: metadata.py | ||
show_help: true | ||
|
||
cloud_client_library: true | ||
|
||
folder: dlp |
Oops, something went wrong.