diff --git a/.flake8 b/.flake8
index 20fe9bd..ed93163 100644
--- a/.flake8
+++ b/.flake8
@@ -21,6 +21,8 @@ exclude =
# Exclude generated code.
**/proto/**
**/gapic/**
+ **/services/**
+ **/types/**
*_pb2.py
# Standard linting exemptions.
diff --git a/.gitignore b/.gitignore
index 3fb06e0..b87e1ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
dist
build
eggs
+.eggs
parts
bin
var
@@ -49,6 +50,7 @@ bigquery/docs/generated
# Virtual environment
env/
coverage.xml
+sponge_log.xml
# System test environment variables.
system_tests/local_test_setup
diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh
index b840983..8b901b0 100755
--- a/.kokoro/publish-docs.sh
+++ b/.kokoro/publish-docs.sh
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/bash
-
set -eo pipefail
# Disable buffering, so that the logs stream through.
diff --git a/.kokoro/release.sh b/.kokoro/release.sh
index 4772c91..ab45f68 100755
--- a/.kokoro/release.sh
+++ b/.kokoro/release.sh
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/bash
-
set -eo pipefail
# Start the releasetool reporter
diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg
new file mode 100644
index 0000000..73eb55f
--- /dev/null
+++ b/.kokoro/samples/lint/common.cfg
@@ -0,0 +1,34 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "lint"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-containeranalysis/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-containeranalysis/.kokoro/trampoline.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/lint/continuous.cfg b/.kokoro/samples/lint/continuous.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/lint/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/lint/periodic.cfg b/.kokoro/samples/lint/periodic.cfg
new file mode 100644
index 0000000..50fec96
--- /dev/null
+++ b/.kokoro/samples/lint/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/lint/presubmit.cfg b/.kokoro/samples/lint/presubmit.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/lint/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg
new file mode 100644
index 0000000..fc51ea6
--- /dev/null
+++ b/.kokoro/samples/python3.6/common.cfg
@@ -0,0 +1,34 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.6"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-containeranalysis/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-containeranalysis/.kokoro/trampoline.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/continuous.cfg b/.kokoro/samples/python3.6/continuous.cfg
new file mode 100644
index 0000000..7218af1
--- /dev/null
+++ b/.kokoro/samples/python3.6/continuous.cfg
@@ -0,0 +1,7 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg
new file mode 100644
index 0000000..50fec96
--- /dev/null
+++ b/.kokoro/samples/python3.6/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/presubmit.cfg b/.kokoro/samples/python3.6/presubmit.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.6/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg
new file mode 100644
index 0000000..5b9ee9a
--- /dev/null
+++ b/.kokoro/samples/python3.7/common.cfg
@@ -0,0 +1,34 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.7"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-containeranalysis/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-containeranalysis/.kokoro/trampoline.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/continuous.cfg b/.kokoro/samples/python3.7/continuous.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.7/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg
new file mode 100644
index 0000000..50fec96
--- /dev/null
+++ b/.kokoro/samples/python3.7/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/presubmit.cfg b/.kokoro/samples/python3.7/presubmit.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.7/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg
new file mode 100644
index 0000000..1026b49
--- /dev/null
+++ b/.kokoro/samples/python3.8/common.cfg
@@ -0,0 +1,34 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.8"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-containeranalysis/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-containeranalysis/.kokoro/trampoline.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.8/continuous.cfg b/.kokoro/samples/python3.8/continuous.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.8/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg
new file mode 100644
index 0000000..50fec96
--- /dev/null
+++ b/.kokoro/samples/python3.8/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.8/presubmit.cfg b/.kokoro/samples/python3.8/presubmit.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.8/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh
new file mode 100755
index 0000000..a31dcf5
--- /dev/null
+++ b/.kokoro/test-samples.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# `-e` enables the script to automatically fail when a command fails
+# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
+set -eo pipefail
+# Enables `**` to include files nested inside sub-folders
+shopt -s globstar
+
+cd github/python-containeranalysis
+
+# Run periodic samples tests at latest release
+if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
+ LATEST_RELEASE=$(git describe --abbrev=0 --tags)
+ git checkout $LATEST_RELEASE
+fi
+
+# Disable buffering, so that the logs stream through.
+export PYTHONUNBUFFERED=1
+
+# Debug: show build environment
+env | grep KOKORO
+
+# Install nox
+python3.6 -m pip install --upgrade --quiet nox
+
+# Use secrets acessor service account to get secrets
+if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
+ gcloud auth activate-service-account \
+ --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
+ --project="cloud-devrel-kokoro-resources"
+fi
+
+# This script will create 3 files:
+# - testing/test-env.sh
+# - testing/service-account.json
+# - testing/client-secrets.json
+./scripts/decrypt-secrets.sh
+
+source ./testing/test-env.sh
+export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
+
+# For cloud-run session, we activate the service account for gcloud sdk.
+gcloud auth activate-service-account \
+ --key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
+
+export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
+
+echo -e "\n******************** TESTING PROJECTS ********************"
+
+# Switch to 'fail at end' to allow all tests to complete before exiting.
+set +e
+# Use RTN to return a non-zero value if the test fails.
+RTN=0
+ROOT=$(pwd)
+# Find all requirements.txt in the samples directory (may break on whitespace).
+for file in samples/**/requirements.txt; do
+ cd "$ROOT"
+ # Navigate to the project folder.
+ file=$(dirname "$file")
+ cd "$file"
+
+ echo "------------------------------------------------------------"
+ echo "- testing $file"
+ echo "------------------------------------------------------------"
+
+ # Use nox to execute the tests for the project.
+ python3.6 -m nox -s "$RUN_TESTS_SESSION"
+ EXIT=$?
+
+ # If this is a periodic build, send the test log to the Build Cop Bot.
+ # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
+ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
+ chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
+ $KOKORO_GFILE_DIR/linux_amd64/buildcop
+ fi
+
+ if [[ $EXIT -ne 0 ]]; then
+ RTN=1
+ echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
+ else
+ echo -e "\n Testing completed.\n"
+ fi
+
+done
+cd "$ROOT"
+
+# Workaround for Kokoro permissions issue: delete secrets
+rm testing/{test-env.sh,client-secrets.json,service-account.json}
+
+exit "$RTN"
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f71a6c..65f9834 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+### [1.0.2](https://www.github.com/googleapis/python-containeranalysis/compare/v1.0.1...v1.0.2) (2020-07-16)
+
+
+### Bug Fixes
+
+* update retry config ([#23](https://www.github.com/googleapis/python-containeranalysis/issues/23)) ([ddf9585](https://www.github.com/googleapis/python-containeranalysis/commit/ddf95852778c0e60961516ecd77b793e6af3295b))
+
+
+### Documentation
+
+* add multiprocessing note ([#21](https://www.github.com/googleapis/python-containeranalysis/issues/21)) ([be29088](https://www.github.com/googleapis/python-containeranalysis/commit/be290885cef76ffdd27afb44cd858c6a89d4f280))
+
### [1.0.1](https://www.github.com/googleapis/python-containeranalysis/compare/v1.0.0...v1.0.1) (2020-06-16)
diff --git a/MANIFEST.in b/MANIFEST.in
index 68855ab..e9e29d1 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -20,3 +20,6 @@ recursive-include google *.json *.proto
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__
+
+# Exclude scripts for samples readmegen
+prune scripts/readme-gen
\ No newline at end of file
diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html
index 228529e..6316a53 100644
--- a/docs/_templates/layout.html
+++ b/docs/_templates/layout.html
@@ -21,8 +21,8 @@
- On January 1, 2020 this library will no longer support Python 2 on the latest released version.
- Previously released library versions will continue to be available. For more information please
+ As of January 1, 2020 this library no longer supports Python 2 on the latest released version.
+ Library versions released prior to that date will continue to be available. For more information please
visit
Python 2 support on Google Cloud.
{% block body %} {% endblock %}
diff --git a/docs/conf.py b/docs/conf.py
index b3fce8d..58c9eb8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -38,21 +38,18 @@
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
+ "recommonmark",
]
# autodoc/autosummary flags
autoclass_content = "both"
-autodoc_default_flags = ["members"]
+autodoc_default_options = {"members": True}
autosummary_generate = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
-# Allow markdown includes (so releases.md can include CHANGLEOG.md)
-# http://www.sphinx-doc.org/en/master/markdown.html
-source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
-
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
@@ -340,7 +337,7 @@
intersphinx_mapping = {
"python": ("http://python.readthedocs.org/en/latest/", None),
"google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
- "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None),
+ "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"grpc": ("https://grpc.io/grpc/python/", None),
}
diff --git a/docs/index.rst b/docs/index.rst
index 5182497..ec379e7 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,5 +1,7 @@
.. include:: README.rst
+.. include:: multiprocessing.rst
+
Api Reference
-------------
.. toctree::
diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst
new file mode 100644
index 0000000..1cb29d4
--- /dev/null
+++ b/docs/multiprocessing.rst
@@ -0,0 +1,7 @@
+.. note::
+
+ Because this client uses :mod:`grpcio` library, it is safe to
+ share instances across threads. In multiprocessing scenarios, the best
+ practice is to create client instances *after* the invocation of
+ :func:`os.fork` by :class:`multiprocessing.Pool` or
+ :class:`multiprocessing.Process`.
diff --git a/google/cloud/devtools/containeranalysis.py b/google/cloud/devtools/containeranalysis.py
index 25720e4..4707e72 100644
--- a/google/cloud/devtools/containeranalysis.py
+++ b/google/cloud/devtools/containeranalysis.py
@@ -21,4 +21,7 @@
from google.cloud.devtools.containeranalysis_v1 import types
-__all__ = ("types", "ContainerAnalysisClient")
+__all__ = (
+ "types",
+ "ContainerAnalysisClient",
+)
diff --git a/google/cloud/devtools/containeranalysis_v1/__init__.py b/google/cloud/devtools/containeranalysis_v1/__init__.py
index 8e96320..0af72cb 100644
--- a/google/cloud/devtools/containeranalysis_v1/__init__.py
+++ b/google/cloud/devtools/containeranalysis_v1/__init__.py
@@ -25,8 +25,8 @@
if sys.version_info[:2] == (2, 7):
message = (
- "A future version of this library will drop support for Python 2.7."
- "More details about Python 2 support for Google Cloud Client Libraries"
+ "A future version of this library will drop support for Python 2.7. "
+ "More details about Python 2 support for Google Cloud Client Libraries "
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)
@@ -36,4 +36,7 @@ class ContainerAnalysisClient(container_analysis_client.ContainerAnalysisClient)
__doc__ = container_analysis_client.ContainerAnalysisClient.__doc__
-__all__ = ("types", "ContainerAnalysisClient")
+__all__ = (
+ "types",
+ "ContainerAnalysisClient",
+)
diff --git a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py
index 3f11ad6..e03791b 100644
--- a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py
+++ b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py
@@ -50,8 +50,8 @@
class ContainerAnalysisClient(object):
"""
- Retrieves analysis results of Cloud components such as Docker container
- images. The Container Analysis API is an implementation of the
+ Retrieves analysis results of Cloud components such as Docker
+ container images. The Container Analysis API is an implementation of the
`Grafeas
`__ API.
Analysis results are stored as a series of occurrences. An
@@ -180,12 +180,12 @@ def __init__(
self.transport = transport
else:
self.transport = container_analysis_grpc_transport.ContainerAnalysisGrpcTransport(
- address=api_endpoint, channel=channel, credentials=credentials
+ address=api_endpoint, channel=channel, credentials=credentials,
)
if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
- gapic_version=_GAPIC_LIBRARY_VERSION
+ gapic_version=_GAPIC_LIBRARY_VERSION,
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
@@ -196,7 +196,7 @@ def __init__(
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
- client_config["interfaces"][self._INTERFACE_NAME]
+ client_config["interfaces"][self._INTERFACE_NAME],
)
# Save a dictionary of cached API call functions.
@@ -289,7 +289,7 @@ def set_iam_policy(
client_info=self._client_info,
)
- request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy)
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,)
if metadata is None:
metadata = []
metadata = list(metadata)
@@ -374,7 +374,7 @@ def get_iam_policy(
)
request = iam_policy_pb2.GetIamPolicyRequest(
- resource=resource, options=options_
+ resource=resource, options=options_,
)
if metadata is None:
metadata = []
@@ -426,8 +426,8 @@ def test_iam_permissions(
Args:
resource (str): REQUIRED: The resource for which the policy detail is being requested.
See the operation documentation for the appropriate value for this field.
- permissions (list[str]): The set of permissions to check for the ``resource``. Permissions with
- wildcards (such as '*' or 'storage.*') are not allowed. For more
+ permissions (list[str]): The set of permissions to check for the ``resource``. Permissions
+ with wildcards (such as '*' or 'storage.*') are not allowed. For more
information see `IAM
Overview `__.
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -461,7 +461,7 @@ def test_iam_permissions(
)
request = iam_policy_pb2.TestIamPermissionsRequest(
- resource=resource, permissions=permissions
+ resource=resource, permissions=permissions,
)
if metadata is None:
metadata = []
diff --git a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py
index 86030c0..90c1ddb 100644
--- a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py
+++ b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py
@@ -1,36 +1,42 @@
config = {
"interfaces": {
"google.devtools.containeranalysis.v1.ContainerAnalysis": {
- "retry_codes": {
- "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
- "non_idempotent": [],
- },
+ "retry_codes": {"no_retry_codes": [], "no_retry_1_codes": []},
"retry_params": {
- "default": {
- "initial_retry_delay_millis": 100,
- "retry_delay_multiplier": 1.3,
- "max_retry_delay_millis": 60000,
- "initial_rpc_timeout_millis": 20000,
+ "no_retry_params": {
+ "initial_retry_delay_millis": 0,
+ "retry_delay_multiplier": 0.0,
+ "max_retry_delay_millis": 0,
+ "initial_rpc_timeout_millis": 0,
+ "rpc_timeout_multiplier": 1.0,
+ "max_rpc_timeout_millis": 0,
+ "total_timeout_millis": 0,
+ },
+ "no_retry_1_params": {
+ "initial_retry_delay_millis": 0,
+ "retry_delay_multiplier": 0.0,
+ "max_retry_delay_millis": 0,
+ "initial_rpc_timeout_millis": 30000,
"rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 20000,
- "total_timeout_millis": 600000,
- }
+ "max_rpc_timeout_millis": 30000,
+ "total_timeout_millis": 30000,
+ },
},
"methods": {
"SetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "default",
+ "timeout_millis": 30000,
+ "retry_codes_name": "no_retry_1_codes",
+ "retry_params_name": "no_retry_1_params",
},
"GetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "default",
+ "timeout_millis": 30000,
+ "retry_codes_name": "no_retry_1_codes",
+ "retry_params_name": "no_retry_1_params",
},
"TestIamPermissions": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "default",
+ "timeout_millis": 30000,
+ "retry_codes_name": "no_retry_1_codes",
+ "retry_params_name": "no_retry_1_params",
},
},
}
diff --git a/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py b/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py
index 575663a..8b3d81b 100644
--- a/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py
+++ b/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py
@@ -56,7 +56,7 @@ def __init__(
# exception (channels come with credentials baked in already).
if channel is not None and credentials is not None:
raise ValueError(
- "The `channel` and `credentials` arguments are mutually " "exclusive."
+ "The `channel` and `credentials` arguments are mutually " "exclusive.",
)
# Create the channel.
@@ -77,7 +77,7 @@ def __init__(
self._stubs = {
"container_analysis_stub": containeranalysis_pb2_grpc.ContainerAnalysisStub(
channel
- )
+ ),
}
@classmethod
diff --git a/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py b/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py
index 466f1ba..a3b3ba4 100644
--- a/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py
+++ b/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py
@@ -2,9 +2,6 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto
-import sys
-
-_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
@@ -26,12 +23,9 @@
name="google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto",
package="google.devtools.containeranalysis.v1",
syntax="proto3",
- serialized_options=_b(
- "\n\037com.google.containeranalysis.v1P\001ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\242\002\003GCA\252\002*Google.Cloud.DevTools.ContainerAnalysis.V1\352\002$Google::Cloud::ContainerAnalysis::V1"
- ),
- serialized_pb=_b(
- '\nHgoogle/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto\x12$google.devtools.containeranalysis.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x1fgoogle/protobuf/timestamp.proto2\x91\x06\n\x11\x43ontainerAnalysis\x12\xd2\x01\n\x0cSetIamPolicy\x12".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"\x86\x01\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\x01*\xda\x41\x0fresource,policy\x12\xca\x01\n\x0cGetIamPolicy\x12".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"\x7f\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\x01*\xda\x41\x08resource\x12\x83\x02\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse"\x97\x01\x82\xd3\xe4\x93\x02z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\x01*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\x01*\xda\x41\x14resource,permissions\x1aT\xca\x41 containeranalysis.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xd4\x01\n\x1f\x63om.google.containeranalysis.v1P\x01ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\xa2\x02\x03GCA\xaa\x02*Google.Cloud.DevTools.ContainerAnalysis.V1\xea\x02$Google::Cloud::ContainerAnalysis::V1b\x06proto3'
- ),
+ serialized_options=b"\n\037com.google.containeranalysis.v1P\001ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\242\002\003GCA\252\002*Google.Cloud.DevTools.ContainerAnalysis.V1\352\002$Google::Cloud::ContainerAnalysis::V1",
+ create_key=_descriptor._internal_create_key,
+ serialized_pb=b'\nHgoogle/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto\x12$google.devtools.containeranalysis.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x1fgoogle/protobuf/timestamp.proto2\x91\x06\n\x11\x43ontainerAnalysis\x12\xd2\x01\n\x0cSetIamPolicy\x12".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"\x86\x01\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\x01*\xda\x41\x0fresource,policy\x12\xca\x01\n\x0cGetIamPolicy\x12".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"\x7f\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\x01*\xda\x41\x08resource\x12\x83\x02\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse"\x97\x01\x82\xd3\xe4\x93\x02z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\x01*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\x01*\xda\x41\x14resource,permissions\x1aT\xca\x41 containeranalysis.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xd4\x01\n\x1f\x63om.google.containeranalysis.v1P\x01ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\xa2\x02\x03GCA\xaa\x02*Google.Cloud.DevTools.ContainerAnalysis.V1\xea\x02$Google::Cloud::ContainerAnalysis::V1b\x06proto3',
dependencies=[
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
google_dot_api_dot_client__pb2.DESCRIPTOR,
@@ -52,9 +46,8 @@
full_name="google.devtools.containeranalysis.v1.ContainerAnalysis",
file=DESCRIPTOR,
index=0,
- serialized_options=_b(
- "\312A containeranalysis.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform"
- ),
+ serialized_options=b"\312A containeranalysis.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform",
+ create_key=_descriptor._internal_create_key,
serialized_start=263,
serialized_end=1048,
methods=[
@@ -65,9 +58,8 @@
containing_service=None,
input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._SETIAMPOLICYREQUEST,
output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=_b(
- '\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\001*\332A\017resource,policy'
- ),
+ serialized_options=b'\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\001*\332A\017resource,policy',
+ create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name="GetIamPolicy",
@@ -76,9 +68,8 @@
containing_service=None,
input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._GETIAMPOLICYREQUEST,
output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=_b(
- '\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\001*\332A\010resource'
- ),
+ serialized_options=b'\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\001*\332A\010resource',
+ create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name="TestIamPermissions",
@@ -87,9 +78,8 @@
containing_service=None,
input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSREQUEST,
output_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSRESPONSE,
- serialized_options=_b(
- '\202\323\344\223\002z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\001*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\001*\332A\024resource,permissions'
- ),
+ serialized_options=b'\202\323\344\223\002z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\001*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\001*\332A\024resource,permissions',
+ create_key=_descriptor._internal_create_key,
),
],
)
diff --git a/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py b/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py
index e7de182..e6963a6 100644
--- a/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py
+++ b/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py
@@ -1,4 +1,5 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
@@ -7,26 +8,26 @@
class ContainerAnalysisStub(object):
"""Retrieves analysis results of Cloud components such as Docker container
- images. The Container Analysis API is an implementation of the
- [Grafeas](https://grafeas.io) API.
-
- Analysis results are stored as a series of occurrences. An `Occurrence`
- contains information about a specific analysis instance on a resource. An
- occurrence refers to a `Note`. A note contains details describing the
- analysis and is generally stored in a separate project, called a `Provider`.
- Multiple occurrences can refer to the same note.
-
- For example, an SSL vulnerability could affect multiple images. In this case,
- there would be one note for the vulnerability and an occurrence for each
- image with the vulnerability referring to that note.
- """
+ images. The Container Analysis API is an implementation of the
+ [Grafeas](https://grafeas.io) API.
+
+ Analysis results are stored as a series of occurrences. An `Occurrence`
+ contains information about a specific analysis instance on a resource. An
+ occurrence refers to a `Note`. A note contains details describing the
+ analysis and is generally stored in a separate project, called a `Provider`.
+ Multiple occurrences can refer to the same note.
+
+ For example, an SSL vulnerability could affect multiple images. In this case,
+ there would be one note for the vulnerability and an occurrence for each
+ image with the vulnerability referring to that note.
+ """
def __init__(self, channel):
"""Constructor.
- Args:
- channel: A grpc.Channel.
- """
+ Args:
+ channel: A grpc.Channel.
+ """
self.SetIamPolicy = channel.unary_unary(
"/google.devtools.containeranalysis.v1.ContainerAnalysis/SetIamPolicy",
request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
@@ -46,57 +47,57 @@ def __init__(self, channel):
class ContainerAnalysisServicer(object):
"""Retrieves analysis results of Cloud components such as Docker container
- images. The Container Analysis API is an implementation of the
- [Grafeas](https://grafeas.io) API.
-
- Analysis results are stored as a series of occurrences. An `Occurrence`
- contains information about a specific analysis instance on a resource. An
- occurrence refers to a `Note`. A note contains details describing the
- analysis and is generally stored in a separate project, called a `Provider`.
- Multiple occurrences can refer to the same note.
-
- For example, an SSL vulnerability could affect multiple images. In this case,
- there would be one note for the vulnerability and an occurrence for each
- image with the vulnerability referring to that note.
- """
+ images. The Container Analysis API is an implementation of the
+ [Grafeas](https://grafeas.io) API.
+
+ Analysis results are stored as a series of occurrences. An `Occurrence`
+ contains information about a specific analysis instance on a resource. An
+ occurrence refers to a `Note`. A note contains details describing the
+ analysis and is generally stored in a separate project, called a `Provider`.
+ Multiple occurrences can refer to the same note.
+
+ For example, an SSL vulnerability could affect multiple images. In this case,
+ there would be one note for the vulnerability and an occurrence for each
+ image with the vulnerability referring to that note.
+ """
def SetIamPolicy(self, request, context):
"""Sets the access control policy on the specified note or occurrence.
- Requires `containeranalysis.notes.setIamPolicy` or
- `containeranalysis.occurrences.setIamPolicy` permission if the resource is
- a note or an occurrence, respectively.
-
- The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
- notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
- occurrences.
- """
+ Requires `containeranalysis.notes.setIamPolicy` or
+ `containeranalysis.occurrences.setIamPolicy` permission if the resource is
+ a note or an occurrence, respectively.
+
+ The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
+ notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
+ occurrences.
+ """
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def GetIamPolicy(self, request, context):
"""Gets the access control policy for a note or an occurrence resource.
- Requires `containeranalysis.notes.setIamPolicy` or
- `containeranalysis.occurrences.setIamPolicy` permission if the resource is
- a note or occurrence, respectively.
-
- The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
- notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
- occurrences.
- """
+ Requires `containeranalysis.notes.setIamPolicy` or
+ `containeranalysis.occurrences.setIamPolicy` permission if the resource is
+ a note or occurrence, respectively.
+
+ The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
+ notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
+ occurrences.
+ """
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def TestIamPermissions(self, request, context):
"""Returns the permissions that a caller has on the specified note or
- occurrence. Requires list permission on the project (for example,
- `containeranalysis.notes.list`).
+ occurrence. Requires list permission on the project (for example,
+ `containeranalysis.notes.list`).
- The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
- notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
- occurrences.
- """
+ The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
+ notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
+ occurrences.
+ """
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
@@ -124,3 +125,102 @@ def add_ContainerAnalysisServicer_to_server(servicer, server):
"google.devtools.containeranalysis.v1.ContainerAnalysis", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))
+
+
+# This class is part of an EXPERIMENTAL API.
+class ContainerAnalysis(object):
+ """Retrieves analysis results of Cloud components such as Docker container
+ images. The Container Analysis API is an implementation of the
+ [Grafeas](https://grafeas.io) API.
+
+ Analysis results are stored as a series of occurrences. An `Occurrence`
+ contains information about a specific analysis instance on a resource. An
+ occurrence refers to a `Note`. A note contains details describing the
+ analysis and is generally stored in a separate project, called a `Provider`.
+ Multiple occurrences can refer to the same note.
+
+ For example, an SSL vulnerability could affect multiple images. In this case,
+ there would be one note for the vulnerability and an occurrence for each
+ image with the vulnerability referring to that note.
+ """
+
+ @staticmethod
+ def SetIamPolicy(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/google.devtools.containeranalysis.v1.ContainerAnalysis/SetIamPolicy",
+ google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
+ google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
+ options,
+ channel_credentials,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ )
+
+ @staticmethod
+ def GetIamPolicy(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/google.devtools.containeranalysis.v1.ContainerAnalysis/GetIamPolicy",
+ google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
+ google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
+ options,
+ channel_credentials,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ )
+
+ @staticmethod
+ def TestIamPermissions(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/google.devtools.containeranalysis.v1.ContainerAnalysis/TestIamPermissions",
+ google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
+ google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
+ options,
+ channel_credentials,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ )
diff --git a/google/cloud/devtools/containeranalysis_v1/types.py b/google/cloud/devtools/containeranalysis_v1/types.py
index 8977023..8b4c214 100644
--- a/google/cloud/devtools/containeranalysis_v1/types.py
+++ b/google/cloud/devtools/containeranalysis_v1/types.py
@@ -26,7 +26,12 @@
from google.type import expr_pb2
-_shared_modules = [iam_policy_pb2, options_pb2, policy_pb2, expr_pb2]
+_shared_modules = [
+ iam_policy_pb2,
+ options_pb2,
+ policy_pb2,
+ expr_pb2,
+]
_local_modules = []
diff --git a/noxfile.py b/noxfile.py
index e7d6807..39ee5d8 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -23,14 +23,15 @@
import nox
-BLACK_VERSION = "black==19.3b0"
+BLACK_VERSION = "black==19.10b0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
-if os.path.exists("samples"):
- BLACK_PATHS.append("samples")
+DEFAULT_PYTHON_VERSION = "3.8"
+SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"]
+UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"]
-@nox.session(python="3.7")
+@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
@@ -38,7 +39,9 @@ def lint(session):
serious code quality issues.
"""
session.install("flake8", BLACK_VERSION)
- session.run("black", "--check", *BLACK_PATHS)
+ session.run(
+ "black", "--check", *BLACK_PATHS,
+ )
session.run("flake8", "google", "tests")
@@ -53,10 +56,12 @@ def blacken(session):
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
session.install(BLACK_VERSION)
- session.run("black", *BLACK_PATHS)
+ session.run(
+ "black", *BLACK_PATHS,
+ )
-@nox.session(python="3.7")
+@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
@@ -84,13 +89,13 @@ def default(session):
)
-@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
+@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)
-@nox.session(python=["2.7", "3.7"])
+@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def system(session):
"""Run the system test suite."""
system_test_path = os.path.join("tests", "system.py")
@@ -110,7 +115,9 @@ def system(session):
# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
- session.install("mock", "pytest", "google-cloud-testutils")
+ session.install(
+ "mock", "pytest", "google-cloud-testutils",
+ )
session.install("-e", ".")
# Run py.test against the system tests.
@@ -120,7 +127,7 @@ def system(session):
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
-@nox.session(python="3.7")
+@nox.session(python=DEFAULT_PYTHON_VERSION)
def cover(session):
"""Run the final coverage report.
@@ -133,7 +140,7 @@ def cover(session):
session.run("coverage", "erase")
-@nox.session(python="3.7")
+@nox.session(python=DEFAULT_PYTHON_VERSION)
def docs(session):
"""Build the docs for this library."""
diff --git a/scripts/decrypt-secrets.sh b/scripts/decrypt-secrets.sh
new file mode 100755
index 0000000..ff599eb
--- /dev/null
+++ b/scripts/decrypt-secrets.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Copyright 2015 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+ROOT=$( dirname "$DIR" )
+
+# Work from the project root.
+cd $ROOT
+
+# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources.
+PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}"
+
+gcloud secrets versions access latest --secret="python-docs-samples-test-env" \
+ > testing/test-env.sh
+gcloud secrets versions access latest \
+ --secret="python-docs-samples-service-account" \
+ > testing/service-account.json
+gcloud secrets versions access latest \
+ --secret="python-docs-samples-client-secrets" \
+ > testing/client-secrets.json
\ No newline at end of file
diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py
new file mode 100644
index 0000000..d309d6e
--- /dev/null
+++ b/scripts/readme-gen/readme_gen.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+# Copyright 2016 Google Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Generates READMEs using configuration defined in yaml."""
+
+import argparse
+import io
+import os
+import subprocess
+
+import jinja2
+import yaml
+
+
+jinja_env = jinja2.Environment(
+ trim_blocks=True,
+ loader=jinja2.FileSystemLoader(
+ os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates'))))
+
+README_TMPL = jinja_env.get_template('README.tmpl.rst')
+
+
+def get_help(file):
+ return subprocess.check_output(['python', file, '--help']).decode()
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('source')
+ parser.add_argument('--destination', default='README.rst')
+
+ args = parser.parse_args()
+
+ source = os.path.abspath(args.source)
+ root = os.path.dirname(source)
+ destination = os.path.join(root, args.destination)
+
+ jinja_env.globals['get_help'] = get_help
+
+ with io.open(source, 'r') as f:
+ config = yaml.load(f)
+
+ # This allows get_help to execute in the right directory.
+ os.chdir(root)
+
+ output = README_TMPL.render(config)
+
+ with io.open(destination, 'w') as f:
+ f.write(output)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/readme-gen/templates/README.tmpl.rst b/scripts/readme-gen/templates/README.tmpl.rst
new file mode 100644
index 0000000..4fd2397
--- /dev/null
+++ b/scripts/readme-gen/templates/README.tmpl.rst
@@ -0,0 +1,87 @@
+{# The following line is a lie. BUT! Once jinja2 is done with it, it will
+ become truth! #}
+.. This file is automatically generated. Do not edit this file directly.
+
+{{product.name}} 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={{folder}}/README.rst
+
+
+This directory contains samples for {{product.name}}. {{product.description}}
+
+{{description}}
+
+.. _{{product.name}}: {{product.url}}
+
+{% if required_api_url %}
+To run the sample, you need to enable the API at: {{required_api_url}}
+{% endif %}
+
+{% if required_role %}
+To run the sample, you need to have `{{required_role}}` role.
+{% endif %}
+
+{{other_required_steps}}
+
+{% if setup %}
+Setup
+-------------------------------------------------------------------------------
+
+{% for section in setup %}
+
+{% include section + '.tmpl.rst' %}
+
+{% endfor %}
+{% endif %}
+
+{% if samples %}
+Samples
+-------------------------------------------------------------------------------
+
+{% for sample in samples %}
+{{sample.name}}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+{% if not sample.hide_cloudshell_button %}
+.. 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={{folder}}/{{sample.file}},{{folder}}/README.rst
+{% endif %}
+
+
+{{sample.description}}
+
+To run this sample:
+
+.. code-block:: bash
+
+ $ python {{sample.file}}
+{% if sample.show_help %}
+
+ {{get_help(sample.file)|indent}}
+{% endif %}
+
+
+{% endfor %}
+{% endif %}
+
+{% if cloud_client_library %}
+
+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
+
+{% endif %}
+
+.. _Google Cloud SDK: https://cloud.google.com/sdk/
\ No newline at end of file
diff --git a/scripts/readme-gen/templates/auth.tmpl.rst b/scripts/readme-gen/templates/auth.tmpl.rst
new file mode 100644
index 0000000..1446b94
--- /dev/null
+++ b/scripts/readme-gen/templates/auth.tmpl.rst
@@ -0,0 +1,9 @@
+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
diff --git a/scripts/readme-gen/templates/auth_api_key.tmpl.rst b/scripts/readme-gen/templates/auth_api_key.tmpl.rst
new file mode 100644
index 0000000..11957ce
--- /dev/null
+++ b/scripts/readme-gen/templates/auth_api_key.tmpl.rst
@@ -0,0 +1,14 @@
+Authentication
+++++++++++++++
+
+Authentication for this service is done via an `API Key`_. To obtain an API
+Key:
+
+1. Open the `Cloud Platform Console`_
+2. Make sure that billing is enabled for your project.
+3. From the **Credentials** page, create a new **API Key** or use an existing
+ one for your project.
+
+.. _API Key:
+ https://developers.google.com/api-client-library/python/guide/aaa_apikeys
+.. _Cloud Console: https://console.cloud.google.com/project?_
diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst
new file mode 100644
index 0000000..a0406db
--- /dev/null
+++ b/scripts/readme-gen/templates/install_deps.tmpl.rst
@@ -0,0 +1,29 @@
+Install Dependencies
+++++++++++++++++++++
+
+#. Clone python-docs-samples and change directory to the sample directory you want to use.
+
+ .. code-block:: bash
+
+ $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
+
+#. 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/
diff --git a/scripts/readme-gen/templates/install_portaudio.tmpl.rst b/scripts/readme-gen/templates/install_portaudio.tmpl.rst
new file mode 100644
index 0000000..5ea33d1
--- /dev/null
+++ b/scripts/readme-gen/templates/install_portaudio.tmpl.rst
@@ -0,0 +1,35 @@
+Install PortAudio
++++++++++++++++++
+
+Install `PortAudio`_. This is required by the `PyAudio`_ library to stream
+audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the
+platform.
+
+* For Mac OS X, you can use `Homebrew`_::
+
+ brew install portaudio
+
+ **Note**: if you encounter an error when running `pip install` that indicates
+ it can't find `portaudio.h`, try running `pip install` with the following
+ flags::
+
+ pip install --global-option='build_ext' \
+ --global-option='-I/usr/local/include' \
+ --global-option='-L/usr/local/lib' \
+ pyaudio
+
+* For Debian / Ubuntu Linux::
+
+ apt-get install portaudio19-dev python-all-dev
+
+* Windows may work without having to install PortAudio explicitly (it will get
+ installed with PyAudio).
+
+For more details, see the `PyAudio installation`_ page.
+
+
+.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/
+.. _PortAudio: http://www.portaudio.com/
+.. _PyAudio installation:
+ https://people.csail.mit.edu/hubert/pyaudio/#downloads
+.. _Homebrew: http://brew.sh
diff --git a/setup.py b/setup.py
index 05bef45..b46d135 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
name = "google-cloud-containeranalysis"
description = "Container Analysis API API client library"
-version = "1.0.1"
+version = "1.0.2"
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
"google-api-core[grpc] >= 1.14.0, < 2.0.0dev",
diff --git a/synth.metadata b/synth.metadata
index 63eb372..da2fe9f 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -1,32 +1,25 @@
{
"sources": [
- {
- "generator": {
- "name": "artman",
- "version": "2.0.0",
- "dockerImage": "googleapis/artman@sha256:b3b47805231a305d0f40c4bf069df20f6a2635574e6d4259fac651d3f9f6e098"
- }
- },
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-containeranalysis.git",
- "sha": "656b11eee22f11d1109e288190fc63b6c8ff20b7"
+ "sha": "ddf95852778c0e60961516ecd77b793e6af3295b"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "28e76243c23cc282efbb288cb558c174e3e5e9ee",
- "internalRef": "308294748"
+ "sha": "db69b46790b55a82ab7cfa473d031da787bc7591",
+ "internalRef": "320411362"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "01b6f23d24b27878b48667ce597876d66b59780e"
+ "sha": "303271797a360f8a439203413f13a160f2f5b3b4"
}
}
],
@@ -37,8 +30,7 @@
"apiName": "containeranalysis",
"apiVersion": "v1",
"language": "python",
- "generator": "gapic",
- "config": "google/devtools/containeranalysis/artman_containeranalysis_v1.yaml"
+ "generator": "bazel"
}
}
]
diff --git a/synth.py b/synth.py
index b102c0e..b65d81d 100644
--- a/synth.py
+++ b/synth.py
@@ -85,4 +85,7 @@ def set_iam_policy(''',
templated_files = common.py_library(unit_cov_level=45, cov_level=45)
s.move(templated_files)
+# TODO(busunkim): Use latest sphinx after microgenerator transition
+s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"')
+
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
diff --git a/testing/.gitignore b/testing/.gitignore
new file mode 100644
index 0000000..b05fbd6
--- /dev/null
+++ b/testing/.gitignore
@@ -0,0 +1,3 @@
+test-env.sh
+service-account.json
+client-secrets.json
\ No newline at end of file