Skip to content

Commit

Permalink
Merge branch 'master' into cloudsql-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtisvg authored Jun 5, 2020
2 parents d34b8b1 + af8d1a3 commit b75dbcb
Show file tree
Hide file tree
Showing 80 changed files with 594 additions and 399 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/pubsub/ @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-owners
/run/ @averikitsch @GoogleCloudPlatform/python-samples-owners
/scheduler/ @averikitsch @GoogleCloudPlatform/python-samples-owners
/spanner/ @mmmarklu @GoogleCloudPlatform/python-samples-owners
/spanner/ @larkee @GoogleCloudPlatform/python-samples-owners
/speech/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/storage/ @GoogleCloudPlatform/storage-dpe @GoogleCloudPlatform/python-samples-owners
/tables/automl/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
Expand Down
2 changes: 1 addition & 1 deletion appengine/flexible/numpy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==1.1.2
gunicorn==20.0.4
numpy==1.18.4
numpy==1.18.5
2 changes: 1 addition & 1 deletion appengine/flexible/scipy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Flask==1.1.2
gunicorn==20.0.4
imageio==2.8.0
numpy==1.18.4
numpy==1.18.5
pillow==7.1.2
scipy==1.4.1
1 change: 0 additions & 1 deletion appengine/flexible/tasks/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Flask==1.1.2
gunicorn==20.0.4
google-cloud-tasks==1.5.0
googleapis-common-protos==1.51.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Flask==1.1.2
pyjwt==1.7.1
flask-cors==3.0.8
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
requests-toolbelt==0.9.1
2 changes: 1 addition & 1 deletion appengine/standard/firebase/firetactoe/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flask==1.1.2
requests==2.23.0
requests_toolbelt==0.9.1
google-auth==1.16.0
google-auth==1.16.1
functools32==3.2.3.post2; python_version < "3"
2 changes: 1 addition & 1 deletion appengine/standard/storage/api-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-cloud-datastore==1.12.0
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-cloud-datastore==1.12.0
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
2 changes: 1 addition & 1 deletion appengine/standard_python3/pubsub/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-cloud-pubsub==1.5.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-cloud-datastore==1.12.0
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-cloud-datastore==1.12.0
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
2 changes: 1 addition & 1 deletion appengine/standard_python37/pubsub/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==1.1.2
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-cloud-pubsub==1.5.0
2 changes: 1 addition & 1 deletion auth/api-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==1.9.1
google-auth-httplib2==0.0.3
google-auth==1.16.0
google-auth==1.16.1
2 changes: 1 addition & 1 deletion auth/end-user/web/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-auth==1.16.0
google-auth==1.16.1
google-auth-oauthlib==0.4.1
google-auth-httplib2==0.0.3
google-api-python-client==1.9.1
Expand Down
2 changes: 1 addition & 1 deletion bigquery/pandas-gbq-migration/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
google-cloud-bigquery==1.24.0
google-cloud-bigquery-storage==0.8.0
google-cloud-bigquery-storage==1.0.0
pandas==0.25.3; python_version > '3.0'
pandas==0.24.2; python_version < '3.0'
pandas-gbq==0.13.2
Expand Down
4 changes: 2 additions & 2 deletions bigquery_storage/to_dataframe/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
google-auth==1.16.0
google-cloud-bigquery-storage==0.8.0
google-auth==1.16.1
google-cloud-bigquery-storage==1.0.0
google-cloud-bigquery==1.24.0
pyarrow==0.17.1
ipython==7.10.2; python_version > '3.0'
Expand Down
2 changes: 1 addition & 1 deletion composer/rest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-auth==1.16.0
google-auth==1.16.1
requests==2.23.0
six==1.15.0
2 changes: 1 addition & 1 deletion compute/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
2 changes: 1 addition & 1 deletion compute/auth/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests==2.23.0
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
2 changes: 1 addition & 1 deletion compute/encryption/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cryptography==2.9.2
requests==2.23.0
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
2 changes: 1 addition & 1 deletion compute/oslogin/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-api-python-client==1.9.1
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
requests==2.23.0
2 changes: 1 addition & 1 deletion dataproc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
grpcio==1.29.0
google-auth==1.16.0
google-auth==1.16.1
google-auth-httplib2==0.0.3
google-cloud==0.34.0
google-cloud-storage==1.28.1
Expand Down
34 changes: 18 additions & 16 deletions dlp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ This directory contains samples for Google Data Loss Prevention. `Google Data Lo

.. _Google Data Loss Prevention: https://cloud.google.com/dlp/docs/

To run the sample, you need to enable the API at: https://console.cloud.google.com/apis/library/dlp.googleapis.com


To run the sample, you need to have the following roles:
* `DLP Administrator`
* `DLP API Service Agent`



Setup
-------------------------------------------------------------------------------

Expand Down Expand Up @@ -58,15 +67,6 @@ Install Dependencies
.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/

#. For running *_test.py files, install test dependencies
.. code-block:: bash
$ pip install -r requirements-test.txt
$ pytest inspect_content_test.py
** *_test.py files are demo wrappers and make API calls. You may get rate limited for making high number of requests. **

Samples
-------------------------------------------------------------------------------

Expand All @@ -83,7 +83,7 @@ To run this sample:

.. code-block:: bash
$ python quickstart.py <project-id>
$ python quickstart.py
Inspect Content
Expand All @@ -101,15 +101,16 @@ To run this sample:
$ python inspect_content.py
usage: inspect_content.py [-h] {string,file,gcs,datastore,bigquery} ...
usage: inspect_content.py [-h] {string,table,file,gcs,datastore,bigquery} ...
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,datastore,bigquery}
{string,table,file,gcs,datastore,bigquery}
Select how to submit content to the API.
string Inspect a string.
table Inspect a table.
file Inspect a local file.
gcs Inspect files on Google Cloud Storage.
datastore Inspect files on Google Datastore.
Expand All @@ -135,13 +136,14 @@ To run this sample:
$ python redact.py
usage: redact.py [-h] [--project PROJECT] [--info_types INFO_TYPES]
usage: redact.py [-h] [--project PROJECT]
[--info_types INFO_TYPES [INFO_TYPES ...]]
[--min_likelihood {LIKELIHOOD_UNSPECIFIED,VERY_UNLIKELY,UNLIKELY,POSSIBLE,LIKELY,VERY_LIKELY}]
[--mime_type MIME_TYPE]
filename output_filename
Sample app that uses the Data Loss Prevent API to redact the contents of a
string or an image file.
Sample app that uses the Data Loss Prevent API to redact the contents of an
image file.
positional arguments:
filename The path to the file to inspect.
Expand All @@ -151,7 +153,7 @@ To run this sample:
-h, --help show this help message and exit
--project PROJECT The Google Cloud project id to use as a parent
resource.
--info_types INFO_TYPES
--info_types INFO_TYPES [INFO_TYPES ...]
Strings representing info types to look for. A full
list of info categories and types is available from
the API. Examples include "FIRST_NAME", "LAST_NAME",
Expand Down
8 changes: 7 additions & 1 deletion dlp/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ product:
name: Google Data Loss Prevention
short_name: Data Loss Prevention
url: https://cloud.google.com/dlp/docs/
description: >
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.
Expand All @@ -13,6 +13,12 @@ setup:
- auth
- install_deps

required_api_url: https://console.cloud.google.com/apis/library/dlp.googleapis.com

required_roles:
- DLP Administrator
- DLP API Service Agent

samples:
- name: Quickstart
file: quickstart.py
Expand Down
20 changes: 0 additions & 20 deletions dlp/conftest.py

This file was deleted.

21 changes: 12 additions & 9 deletions dlp/inspect_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,12 @@ def inspect_gcs_file(
url = "gs://{}/{}".format(bucket, filename)
storage_config = {"cloud_storage_options": {"file_set": {"url": url}}}

# Convert the project id into a full resource id.
parent = dlp.project_path(project)
# Convert the project id into full resource ids.
topic = google.cloud.pubsub.PublisherClient.topic_path(project, topic_id)
parent = dlp.location_path(project, 'global')

# Tell the API where to send a notification when the job is complete.
actions = [{"pub_sub": {"topic": "{}/topics/{}".format(parent, topic_id)}}]
actions = [{"pub_sub": {"topic": topic}}]

# Construct the inspect_job, which defines the entire inspect content task.
inspect_job = {
Expand Down Expand Up @@ -623,11 +624,12 @@ def inspect_datastore(
}
}

# Convert the project id into a full resource id.
parent = dlp.project_path(project)
# Convert the project id into full resource ids.
topic = google.cloud.pubsub.PublisherClient.topic_path(project, topic_id)
parent = dlp.location_path(project, 'global')

# Tell the API where to send a notification when the job is complete.
actions = [{"pub_sub": {"topic": "{}/topics/{}".format(parent, topic_id)}}]
actions = [{"pub_sub": {"topic": topic}}]

# Construct the inspect_job, which defines the entire inspect content task.
inspect_job = {
Expand Down Expand Up @@ -790,11 +792,12 @@ def inspect_bigquery(
}
}

# Convert the project id into a full resource id.
parent = dlp.project_path(project)
# Convert the project id into full resource ids.
topic = google.cloud.pubsub.PublisherClient.topic_path(project, topic_id)
parent = dlp.location_path(project, 'global')

# Tell the API where to send a notification when the job is complete.
actions = [{"pub_sub": {"topic": "{}/topics/{}".format(parent, topic_id)}}]
actions = [{"pub_sub": {"topic": topic}}]

# Construct the inspect_job, which defines the entire inspect content task.
inspect_job = {
Expand Down
Loading

0 comments on commit b75dbcb

Please sign in to comment.