diff --git a/.coveragerc b/.coveragerc
index df3be7a..6b01f69 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -4,7 +4,8 @@ branch = True
[report]
fail_under = 100
show_missing = True
-omit = google/cloud/devtools/containeranalysis/__init__.py
+omit =
+ google/cloud/devtools/containeranalysis/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
@@ -14,4 +15,4 @@ exclude_lines =
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
- except pkg_resources.DistributionNotFound
\ No newline at end of file
+ except pkg_resources.DistributionNotFound
diff --git a/.flake8 b/.flake8
index ed93163..29227d4 100644
--- a/.flake8
+++ b/.flake8
@@ -26,6 +26,7 @@ exclude =
*_pb2.py
# Standard linting exemptions.
+ **/.nox/**
__pycache__,
.git,
*.pyc,
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 30c3973..e2ec9cb 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -5,7 +5,7 @@
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
# The @googleapis/yoshi-python is the default owner for changes in this repo
-* @googleapis/yoshi-python
+* @googleapis/yoshi-python @googleapis/cicd
# The python-samples-reviewers team is the default owner for samples changes
-/samples/ @googleapis/python-samples-owners
\ No newline at end of file
+/samples/ @googleapis/python-samples-owners
diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml
new file mode 100644
index 0000000..af59935
--- /dev/null
+++ b/.github/sync-repo-settings.yaml
@@ -0,0 +1,13 @@
+# https://github.com/googleapis/repo-automation-bots/tree/master/packages/sync-repo-settings
+# Rules for master branch protection
+branchProtectionRules:
+# Identifies the protection rule pattern. Name of the branch to be protected.
+# Defaults to `master`
+- pattern: master
+ requiredStatusCheckContexts:
+ - 'Kokoro'
+ - 'cla/google'
+ - 'Samples - Lint'
+ - 'Samples - Python 3.6'
+ - 'Samples - Python 3.7'
+ - 'Samples - Python 3.8'
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..a9024b1
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,17 @@
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.4.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-yaml
+- repo: https://github.com/psf/black
+ rev: 19.10b0
+ hooks:
+ - id: black
+- repo: https://gitlab.com/pycqa/flake8
+ rev: 3.8.4
+ hooks:
+ - id: flake8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ede2b6..644ceae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+## [2.2.0](https://www.github.com/googleapis/python-containeranalysis/compare/v2.1.0...v2.2.0) (2021-01-06)
+
+
+### Features
+
+* add from_service_account_info factory and fix sphinx identifiers ([#74](https://www.github.com/googleapis/python-containeranalysis/issues/74)) ([7a87c41](https://www.github.com/googleapis/python-containeranalysis/commit/7a87c4115b15ccd42ccf0836ed62d663601720f7))
+
+
+### Bug Fixes
+
+* remove client recv msg limit and add enums to `types/__init__.py` ([#68](https://www.github.com/googleapis/python-containeranalysis/issues/68)) ([77d47d3](https://www.github.com/googleapis/python-containeranalysis/commit/77d47d3efaceb30ed5952935a056229a960dc964))
+
## [2.1.0](https://www.github.com/googleapis/python-containeranalysis/compare/v2.0.0...v2.1.0) (2020-11-18)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 37164c5..c561ac7 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -21,8 +21,8 @@ In order to add a feature:
- The feature must be documented in both the API and narrative
documentation.
-- The feature must work fully on the following CPython versions: 2.7,
- 3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows.
+- The feature must work fully on the following CPython versions:
+ 3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.
- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
@@ -111,6 +111,16 @@ Coding Style
should point to the official ``googleapis`` checkout and the
the branch should be the main branch on that remote (``master``).
+- This repository contains configuration for the
+ `pre-commit `__ tool, which automates checking
+ our linters during a commit. If you have it installed on your ``$PATH``,
+ you can enable enforcing those checks via:
+
+.. code-block:: bash
+
+ $ pre-commit install
+ pre-commit installed at .git/hooks/pre-commit
+
Exceptions to PEP8:
- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for
@@ -192,25 +202,24 @@ Supported Python Versions
We support:
-- `Python 3.5`_
- `Python 3.6`_
- `Python 3.7`_
- `Python 3.8`_
+- `Python 3.9`_
-.. _Python 3.5: https://docs.python.org/3.5/
.. _Python 3.6: https://docs.python.org/3.6/
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
+.. _Python 3.9: https://docs.python.org/3.9/
Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-containeranalysis/blob/master/noxfile.py
-Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020.
We also explicitly decided to support Python 3 beginning with version
-3.5. Reasons for this include:
+3.6. Reasons for this include:
- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
diff --git a/docs/conf.py b/docs/conf.py
index ed14131..01f5f1e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -345,10 +345,10 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
- "python": ("http://python.readthedocs.org/en/latest/", None),
- "google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
+ "python": ("https://python.readthedocs.org/en/latest/", None),
+ "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
- "grpc": ("https://grpc.io/grpc/python/", None),
+ "grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
}
diff --git a/docs/containeranalysis_v1/container_analysis.rst b/docs/containeranalysis_v1/container_analysis.rst
new file mode 100644
index 0000000..30082cd
--- /dev/null
+++ b/docs/containeranalysis_v1/container_analysis.rst
@@ -0,0 +1,6 @@
+ContainerAnalysis
+-----------------------------------
+
+.. automodule:: google.cloud.devtools.containeranalysis_v1.services.container_analysis
+ :members:
+ :inherited-members:
diff --git a/docs/containeranalysis_v1/services.rst b/docs/containeranalysis_v1/services.rst
index 1547128..38d2a15 100644
--- a/docs/containeranalysis_v1/services.rst
+++ b/docs/containeranalysis_v1/services.rst
@@ -1,6 +1,6 @@
Services for Google Cloud Devtools Containeranalysis v1 API
===========================================================
+.. toctree::
+ :maxdepth: 2
-.. automodule:: google.cloud.devtools.containeranalysis_v1.services.container_analysis
- :members:
- :inherited-members:
+ container_analysis
diff --git a/docs/containeranalysis_v1/types.rst b/docs/containeranalysis_v1/types.rst
index c0d2aa5..1fa561b 100644
--- a/docs/containeranalysis_v1/types.rst
+++ b/docs/containeranalysis_v1/types.rst
@@ -3,4 +3,5 @@ Types for Google Cloud Devtools Containeranalysis v1 API
.. automodule:: google.cloud.devtools.containeranalysis_v1.types
:members:
+ :undoc-members:
:show-inheritance:
diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py
index 65ed9b8..769f5d4 100644
--- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py
+++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py
@@ -93,6 +93,7 @@ class ContainerAnalysisAsyncClient:
ContainerAnalysisClient.parse_common_location_path
)
+ from_service_account_info = ContainerAnalysisClient.from_service_account_info
from_service_account_file = ContainerAnalysisClient.from_service_account_file
from_service_account_json = from_service_account_file
@@ -186,7 +187,7 @@ async def set_iam_policy(
occurrences.
Args:
- request (:class:`~.iam_policy.SetIamPolicyRequest`):
+ request (:class:`google.iam.v1.iam_policy_pb2.SetIamPolicyRequest`):
The request object. Request message for `SetIamPolicy`
method.
resource (:class:`str`):
@@ -194,6 +195,7 @@ async def set_iam_policy(
policy is being specified. See the
operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -205,72 +207,62 @@ async def set_iam_policy(
sent along with the request as metadata.
Returns:
- ~.policy.Policy:
- Defines an Identity and Access Management (IAM) policy.
- It is used to specify access control policies for Cloud
- Platform resources.
-
- A ``Policy`` is a collection of ``bindings``. A
- ``binding`` binds one or more ``members`` to a single
- ``role``. Members can be user accounts, service
- accounts, Google groups, and domains (such as G Suite).
- A ``role`` is a named list of permissions (defined by
- IAM or configured by users). A ``binding`` can
- optionally specify a ``condition``, which is a logic
- expression that further constrains the role binding
- based on attributes about the request and/or target
- resource.
-
- **JSON Example**
-
- ::
-
- {
- "bindings": [
- {
- "role": "roles/resourcemanager.organizationAdmin",
- "members": [
- "user:mike@example.com",
- "group:admins@example.com",
- "domain:google.com",
- "serviceAccount:my-project-id@appspot.gserviceaccount.com"
- ]
- },
- {
- "role": "roles/resourcemanager.organizationViewer",
- "members": ["user:eve@example.com"],
- "condition": {
- "title": "expirable access",
- "description": "Does not grant access after Sep 2020",
- "expression": "request.time <
- timestamp('2020-10-01T00:00:00.000Z')",
- }
- }
- ]
- }
-
- **YAML Example**
-
- ::
-
- bindings:
- - members:
- - user:mike@example.com
- - group:admins@example.com
- - domain:google.com
- - serviceAccount:my-project-id@appspot.gserviceaccount.com
- role: roles/resourcemanager.organizationAdmin
- - members:
- - user:eve@example.com
- role: roles/resourcemanager.organizationViewer
- condition:
- title: expirable access
- description: Does not grant access after Sep 2020
- expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
-
- For a description of IAM and its features, see the `IAM
- developer's
- guide `__.
+ google.iam.v1.policy_pb2.Policy:
+ Defines an Identity and Access Management (IAM) policy. It is used to
+ specify access control policies for Cloud Platform
+ resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members to a single role. Members can be
+ user accounts, service accounts, Google groups, and
+ domains (such as G Suite). A role is a named list of
+ permissions (defined by IAM or configured by users).
+ A binding can optionally specify a condition, which
+ is a logic expression that further constrains the
+ role binding based on attributes about the request
+ and/or target resource.
+
+ **JSON Example**
+
+ {
+ "bindings": [
+ {
+ "role":
+ "roles/resourcemanager.organizationAdmin",
+ "members": [ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+
+ }, { "role":
+ "roles/resourcemanager.organizationViewer",
+ "members": ["user:eve@example.com"],
+ "condition": { "title": "expirable access",
+ "description": "Does not grant access after
+ Sep 2020", "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')", } }
+
+ ]
+
+ }
+
+ **YAML Example**
+
+ bindings: - members: - user:\ mike@example.com -
+ group:\ admins@example.com - domain:google.com -
+ serviceAccount:\ my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin -
+ members: - user:\ eve@example.com role:
+ roles/resourcemanager.organizationViewer
+ condition: title: expirable access description:
+ Does not grant access after Sep 2020 expression:
+ request.time <
+ timestamp('2020-10-01T00:00:00.000Z')
+
+ For a description of IAM and its features, see the
+ [IAM developer's
+ guide](\ https://cloud.google.com/iam/docs).
"""
# Create or coerce a protobuf request object.
@@ -331,7 +323,7 @@ async def get_iam_policy(
occurrences.
Args:
- request (:class:`~.iam_policy.GetIamPolicyRequest`):
+ request (:class:`google.iam.v1.iam_policy_pb2.GetIamPolicyRequest`):
The request object. Request message for `GetIamPolicy`
method.
resource (:class:`str`):
@@ -339,6 +331,7 @@ async def get_iam_policy(
policy is being requested. See the
operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -350,72 +343,62 @@ async def get_iam_policy(
sent along with the request as metadata.
Returns:
- ~.policy.Policy:
- Defines an Identity and Access Management (IAM) policy.
- It is used to specify access control policies for Cloud
- Platform resources.
-
- A ``Policy`` is a collection of ``bindings``. A
- ``binding`` binds one or more ``members`` to a single
- ``role``. Members can be user accounts, service
- accounts, Google groups, and domains (such as G Suite).
- A ``role`` is a named list of permissions (defined by
- IAM or configured by users). A ``binding`` can
- optionally specify a ``condition``, which is a logic
- expression that further constrains the role binding
- based on attributes about the request and/or target
- resource.
-
- **JSON Example**
-
- ::
-
- {
- "bindings": [
- {
- "role": "roles/resourcemanager.organizationAdmin",
- "members": [
- "user:mike@example.com",
- "group:admins@example.com",
- "domain:google.com",
- "serviceAccount:my-project-id@appspot.gserviceaccount.com"
- ]
- },
- {
- "role": "roles/resourcemanager.organizationViewer",
- "members": ["user:eve@example.com"],
- "condition": {
- "title": "expirable access",
- "description": "Does not grant access after Sep 2020",
- "expression": "request.time <
- timestamp('2020-10-01T00:00:00.000Z')",
- }
- }
- ]
- }
-
- **YAML Example**
-
- ::
-
- bindings:
- - members:
- - user:mike@example.com
- - group:admins@example.com
- - domain:google.com
- - serviceAccount:my-project-id@appspot.gserviceaccount.com
- role: roles/resourcemanager.organizationAdmin
- - members:
- - user:eve@example.com
- role: roles/resourcemanager.organizationViewer
- condition:
- title: expirable access
- description: Does not grant access after Sep 2020
- expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
-
- For a description of IAM and its features, see the `IAM
- developer's
- guide `__.
+ google.iam.v1.policy_pb2.Policy:
+ Defines an Identity and Access Management (IAM) policy. It is used to
+ specify access control policies for Cloud Platform
+ resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members to a single role. Members can be
+ user accounts, service accounts, Google groups, and
+ domains (such as G Suite). A role is a named list of
+ permissions (defined by IAM or configured by users).
+ A binding can optionally specify a condition, which
+ is a logic expression that further constrains the
+ role binding based on attributes about the request
+ and/or target resource.
+
+ **JSON Example**
+
+ {
+ "bindings": [
+ {
+ "role":
+ "roles/resourcemanager.organizationAdmin",
+ "members": [ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+
+ }, { "role":
+ "roles/resourcemanager.organizationViewer",
+ "members": ["user:eve@example.com"],
+ "condition": { "title": "expirable access",
+ "description": "Does not grant access after
+ Sep 2020", "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')", } }
+
+ ]
+
+ }
+
+ **YAML Example**
+
+ bindings: - members: - user:\ mike@example.com -
+ group:\ admins@example.com - domain:google.com -
+ serviceAccount:\ my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin -
+ members: - user:\ eve@example.com role:
+ roles/resourcemanager.organizationViewer
+ condition: title: expirable access description:
+ Does not grant access after Sep 2020 expression:
+ request.time <
+ timestamp('2020-10-01T00:00:00.000Z')
+
+ For a description of IAM and its features, see the
+ [IAM developer's
+ guide](\ https://cloud.google.com/iam/docs).
"""
# Create or coerce a protobuf request object.
@@ -476,7 +459,7 @@ async def test_iam_permissions(
occurrences.
Args:
- request (:class:`~.iam_policy.TestIamPermissionsRequest`):
+ request (:class:`google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest`):
The request object. Request message for
`TestIamPermissions` method.
resource (:class:`str`):
@@ -484,6 +467,7 @@ async def test_iam_permissions(
policy detail is being requested. See
the operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -492,6 +476,7 @@ async def test_iam_permissions(
Permissions with wildcards (such as '*' or 'storage.*')
are not allowed. For more information see `IAM
Overview `__.
+
This corresponds to the ``permissions`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -503,8 +488,8 @@ async def test_iam_permissions(
sent along with the request as metadata.
Returns:
- ~.iam_policy.TestIamPermissionsResponse:
- Response message for ``TestIamPermissions`` method.
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for TestIamPermissions method.
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
@@ -560,12 +545,13 @@ async def get_vulnerability_occurrences_summary(
occurrences.
Args:
- request (:class:`~.containeranalysis.GetVulnerabilityOccurrencesSummaryRequest`):
+ request (:class:`google.cloud.devtools.containeranalysis_v1.types.GetVulnerabilityOccurrencesSummaryRequest`):
The request object. Request to get a vulnerability
summary for some set of occurrences.
parent (:class:`str`):
The name of the project to get a vulnerability summary
for in the form of ``projects/[PROJECT_ID]``.
+
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -582,7 +568,7 @@ async def get_vulnerability_occurrences_summary(
sent along with the request as metadata.
Returns:
- ~.containeranalysis.VulnerabilityOccurrencesSummary:
+ google.cloud.devtools.containeranalysis_v1.types.VulnerabilityOccurrencesSummary:
A summary of how many vulnerability
occurrences there are per resource and
severity type.
diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py
index c38a489..556c376 100644
--- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py
+++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py
@@ -132,6 +132,22 @@ def _get_default_mtls_endpoint(api_endpoint):
DEFAULT_ENDPOINT
)
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ ContainerAnalysisClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_info(info)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
@@ -144,7 +160,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
kwargs: Additional arguments to pass to the constructor.
Returns:
- {@api.name}: The constructed client.
+ ContainerAnalysisClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(filename)
kwargs["credentials"] = credentials
@@ -236,10 +252,10 @@ def __init__(
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
- transport (Union[str, ~.ContainerAnalysisTransport]): The
+ transport (Union[str, ContainerAnalysisTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
- client_options (client_options_lib.ClientOptions): Custom options for the
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
@@ -366,14 +382,15 @@ def set_iam_policy(
occurrences.
Args:
- request (:class:`~.iam_policy.SetIamPolicyRequest`):
+ request (google.iam.v1.iam_policy_pb2.SetIamPolicyRequest):
The request object. Request message for `SetIamPolicy`
method.
- resource (:class:`str`):
+ resource (str):
REQUIRED: The resource for which the
policy is being specified. See the
operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -385,72 +402,62 @@ def set_iam_policy(
sent along with the request as metadata.
Returns:
- ~.policy.Policy:
- Defines an Identity and Access Management (IAM) policy.
- It is used to specify access control policies for Cloud
- Platform resources.
-
- A ``Policy`` is a collection of ``bindings``. A
- ``binding`` binds one or more ``members`` to a single
- ``role``. Members can be user accounts, service
- accounts, Google groups, and domains (such as G Suite).
- A ``role`` is a named list of permissions (defined by
- IAM or configured by users). A ``binding`` can
- optionally specify a ``condition``, which is a logic
- expression that further constrains the role binding
- based on attributes about the request and/or target
- resource.
-
- **JSON Example**
-
- ::
-
- {
- "bindings": [
- {
- "role": "roles/resourcemanager.organizationAdmin",
- "members": [
- "user:mike@example.com",
- "group:admins@example.com",
- "domain:google.com",
- "serviceAccount:my-project-id@appspot.gserviceaccount.com"
- ]
- },
- {
- "role": "roles/resourcemanager.organizationViewer",
- "members": ["user:eve@example.com"],
- "condition": {
- "title": "expirable access",
- "description": "Does not grant access after Sep 2020",
- "expression": "request.time <
- timestamp('2020-10-01T00:00:00.000Z')",
- }
- }
- ]
- }
-
- **YAML Example**
-
- ::
-
- bindings:
- - members:
- - user:mike@example.com
- - group:admins@example.com
- - domain:google.com
- - serviceAccount:my-project-id@appspot.gserviceaccount.com
- role: roles/resourcemanager.organizationAdmin
- - members:
- - user:eve@example.com
- role: roles/resourcemanager.organizationViewer
- condition:
- title: expirable access
- description: Does not grant access after Sep 2020
- expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
-
- For a description of IAM and its features, see the `IAM
- developer's
- guide `__.
+ google.iam.v1.policy_pb2.Policy:
+ Defines an Identity and Access Management (IAM) policy. It is used to
+ specify access control policies for Cloud Platform
+ resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members to a single role. Members can be
+ user accounts, service accounts, Google groups, and
+ domains (such as G Suite). A role is a named list of
+ permissions (defined by IAM or configured by users).
+ A binding can optionally specify a condition, which
+ is a logic expression that further constrains the
+ role binding based on attributes about the request
+ and/or target resource.
+
+ **JSON Example**
+
+ {
+ "bindings": [
+ {
+ "role":
+ "roles/resourcemanager.organizationAdmin",
+ "members": [ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+
+ }, { "role":
+ "roles/resourcemanager.organizationViewer",
+ "members": ["user:eve@example.com"],
+ "condition": { "title": "expirable access",
+ "description": "Does not grant access after
+ Sep 2020", "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')", } }
+
+ ]
+
+ }
+
+ **YAML Example**
+
+ bindings: - members: - user:\ mike@example.com -
+ group:\ admins@example.com - domain:google.com -
+ serviceAccount:\ my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin -
+ members: - user:\ eve@example.com role:
+ roles/resourcemanager.organizationViewer
+ condition: title: expirable access description:
+ Does not grant access after Sep 2020 expression:
+ request.time <
+ timestamp('2020-10-01T00:00:00.000Z')
+
+ For a description of IAM and its features, see the
+ [IAM developer's
+ guide](\ https://cloud.google.com/iam/docs).
"""
# Create or coerce a protobuf request object.
@@ -507,14 +514,15 @@ def get_iam_policy(
occurrences.
Args:
- request (:class:`~.iam_policy.GetIamPolicyRequest`):
+ request (google.iam.v1.iam_policy_pb2.GetIamPolicyRequest):
The request object. Request message for `GetIamPolicy`
method.
- resource (:class:`str`):
+ resource (str):
REQUIRED: The resource for which the
policy is being requested. See the
operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -526,72 +534,62 @@ def get_iam_policy(
sent along with the request as metadata.
Returns:
- ~.policy.Policy:
- Defines an Identity and Access Management (IAM) policy.
- It is used to specify access control policies for Cloud
- Platform resources.
-
- A ``Policy`` is a collection of ``bindings``. A
- ``binding`` binds one or more ``members`` to a single
- ``role``. Members can be user accounts, service
- accounts, Google groups, and domains (such as G Suite).
- A ``role`` is a named list of permissions (defined by
- IAM or configured by users). A ``binding`` can
- optionally specify a ``condition``, which is a logic
- expression that further constrains the role binding
- based on attributes about the request and/or target
- resource.
-
- **JSON Example**
-
- ::
-
- {
- "bindings": [
- {
- "role": "roles/resourcemanager.organizationAdmin",
- "members": [
- "user:mike@example.com",
- "group:admins@example.com",
- "domain:google.com",
- "serviceAccount:my-project-id@appspot.gserviceaccount.com"
- ]
- },
- {
- "role": "roles/resourcemanager.organizationViewer",
- "members": ["user:eve@example.com"],
- "condition": {
- "title": "expirable access",
- "description": "Does not grant access after Sep 2020",
- "expression": "request.time <
- timestamp('2020-10-01T00:00:00.000Z')",
- }
- }
- ]
- }
-
- **YAML Example**
-
- ::
-
- bindings:
- - members:
- - user:mike@example.com
- - group:admins@example.com
- - domain:google.com
- - serviceAccount:my-project-id@appspot.gserviceaccount.com
- role: roles/resourcemanager.organizationAdmin
- - members:
- - user:eve@example.com
- role: roles/resourcemanager.organizationViewer
- condition:
- title: expirable access
- description: Does not grant access after Sep 2020
- expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
-
- For a description of IAM and its features, see the `IAM
- developer's
- guide `__.
+ google.iam.v1.policy_pb2.Policy:
+ Defines an Identity and Access Management (IAM) policy. It is used to
+ specify access control policies for Cloud Platform
+ resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members to a single role. Members can be
+ user accounts, service accounts, Google groups, and
+ domains (such as G Suite). A role is a named list of
+ permissions (defined by IAM or configured by users).
+ A binding can optionally specify a condition, which
+ is a logic expression that further constrains the
+ role binding based on attributes about the request
+ and/or target resource.
+
+ **JSON Example**
+
+ {
+ "bindings": [
+ {
+ "role":
+ "roles/resourcemanager.organizationAdmin",
+ "members": [ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+
+ }, { "role":
+ "roles/resourcemanager.organizationViewer",
+ "members": ["user:eve@example.com"],
+ "condition": { "title": "expirable access",
+ "description": "Does not grant access after
+ Sep 2020", "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')", } }
+
+ ]
+
+ }
+
+ **YAML Example**
+
+ bindings: - members: - user:\ mike@example.com -
+ group:\ admins@example.com - domain:google.com -
+ serviceAccount:\ my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin -
+ members: - user:\ eve@example.com role:
+ roles/resourcemanager.organizationViewer
+ condition: title: expirable access description:
+ Does not grant access after Sep 2020 expression:
+ request.time <
+ timestamp('2020-10-01T00:00:00.000Z')
+
+ For a description of IAM and its features, see the
+ [IAM developer's
+ guide](\ https://cloud.google.com/iam/docs).
"""
# Create or coerce a protobuf request object.
@@ -648,22 +646,24 @@ def test_iam_permissions(
occurrences.
Args:
- request (:class:`~.iam_policy.TestIamPermissionsRequest`):
+ request (google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest):
The request object. Request message for
`TestIamPermissions` method.
- resource (:class:`str`):
+ resource (str):
REQUIRED: The resource for which the
policy detail is being requested. See
the operation documentation for the
appropriate value for this field.
+
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
- permissions (:class:`Sequence[str]`):
+ permissions (Sequence[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 `__.
+
This corresponds to the ``permissions`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
@@ -675,8 +675,8 @@ def test_iam_permissions(
sent along with the request as metadata.
Returns:
- ~.iam_policy.TestIamPermissionsResponse:
- Response message for ``TestIamPermissions`` method.
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for TestIamPermissions method.
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
@@ -728,16 +728,17 @@ def get_vulnerability_occurrences_summary(
occurrences.
Args:
- request (:class:`~.containeranalysis.GetVulnerabilityOccurrencesSummaryRequest`):
+ request (google.cloud.devtools.containeranalysis_v1.types.GetVulnerabilityOccurrencesSummaryRequest):
The request object. Request to get a vulnerability
summary for some set of occurrences.
- parent (:class:`str`):
+ parent (str):
The name of the project to get a vulnerability summary
for in the form of ``projects/[PROJECT_ID]``.
+
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
- filter (:class:`str`):
+ filter (str):
The filter expression.
This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -750,7 +751,7 @@ def get_vulnerability_occurrences_summary(
sent along with the request as metadata.
Returns:
- ~.containeranalysis.VulnerabilityOccurrencesSummary:
+ google.cloud.devtools.containeranalysis_v1.types.VulnerabilityOccurrencesSummary:
A summary of how many vulnerability
occurrences there are per resource and
severity type.
diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/__init__.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/__init__.py
index 68e64ee..e6fda6a 100644
--- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/__init__.py
+++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/__init__.py
@@ -28,7 +28,6 @@
_transport_registry["grpc"] = ContainerAnalysisGrpcTransport
_transport_registry["grpc_asyncio"] = ContainerAnalysisGrpcAsyncIOTransport
-
__all__ = (
"ContainerAnalysisTransport",
"ContainerAnalysisGrpcTransport",
diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py
index ddd59e6..405911f 100644
--- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py
+++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py
@@ -162,6 +162,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._ssl_channel_credentials = ssl_credentials
else:
@@ -180,6 +184,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._stubs = {} # type: Dict[str, Callable]
@@ -206,7 +214,7 @@ def create_channel(
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
- address (Optionsl[str]): The host for the channel to use.
+ address (Optional[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py
index af63a0d..68b11da 100644
--- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py
+++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py
@@ -207,6 +207,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
self._ssl_channel_credentials = ssl_credentials
else:
@@ -225,6 +229,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
# Run the base constructor.
diff --git a/google/cloud/devtools/containeranalysis_v1/types/__init__.py b/google/cloud/devtools/containeranalysis_v1/types/__init__.py
index 4690bc4..020aad5 100644
--- a/google/cloud/devtools/containeranalysis_v1/types/__init__.py
+++ b/google/cloud/devtools/containeranalysis_v1/types/__init__.py
@@ -20,7 +20,6 @@
VulnerabilityOccurrencesSummary,
)
-
__all__ = (
"GetVulnerabilityOccurrencesSummaryRequest",
"VulnerabilityOccurrencesSummary",
diff --git a/google/cloud/devtools/containeranalysis_v1/types/containeranalysis.py b/google/cloud/devtools/containeranalysis_v1/types/containeranalysis.py
index fa22eaa..0d45939 100644
--- a/google/cloud/devtools/containeranalysis_v1/types/containeranalysis.py
+++ b/google/cloud/devtools/containeranalysis_v1/types/containeranalysis.py
@@ -52,7 +52,7 @@ class VulnerabilityOccurrencesSummary(proto.Message):
resource and severity type.
Attributes:
- counts (Sequence[~.containeranalysis.VulnerabilityOccurrencesSummary.FixableTotalByDigest]):
+ counts (Sequence[google.cloud.devtools.containeranalysis_v1.types.VulnerabilityOccurrencesSummary.FixableTotalByDigest]):
A listing by resource of the number of
fixable and total vulnerabilities.
"""
@@ -64,7 +64,7 @@ class FixableTotalByDigest(proto.Message):
Attributes:
resource_uri (str):
The affected resource.
- severity (~.vulnerability.Severity):
+ severity (grafeas.v1.vulnerability_pb2.Severity):
The severity for this count. SEVERITY_UNSPECIFIED indicates
total across all severities.
fixable_count (int):
diff --git a/noxfile.py b/noxfile.py
index 27349c9..6587c60 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -81,9 +81,8 @@ def default(session):
session.run(
"py.test",
"--quiet",
- "--cov=google.cloud.containeranalysis",
- "--cov=google.cloud",
- "--cov=tests.unit",
+ "--cov=google/cloud",
+ "--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
index b90eef0..bca0522 100644
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -17,6 +17,7 @@
import os
from pathlib import Path
import sys
+from typing import Callable, Dict, List, Optional
import nox
@@ -68,7 +69,7 @@
TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
-def get_pytest_env_vars():
+def get_pytest_env_vars() -> Dict[str, str]:
"""Returns a dict for pytest invocation."""
ret = {}
@@ -97,7 +98,7 @@ def get_pytest_env_vars():
#
-def _determine_local_import_names(start_dir):
+def _determine_local_import_names(start_dir: str) -> List[str]:
"""Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
@@ -135,7 +136,7 @@ def _determine_local_import_names(start_dir):
@nox.session
-def lint(session):
+def lint(session: nox.sessions.Session) -> None:
if not TEST_CONFIG['enforce_type_hints']:
session.install("flake8", "flake8-import-order")
else:
@@ -154,7 +155,7 @@ def lint(session):
@nox.session
-def blacken(session):
+def blacken(session: nox.sessions.Session) -> None:
session.install("black")
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
@@ -168,7 +169,7 @@ def blacken(session):
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
-def _session_tests(session, post_install=None):
+def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
"""Runs py.test for a particular project."""
if os.path.exists("requirements.txt"):
session.install("-r", "requirements.txt")
@@ -194,7 +195,7 @@ def _session_tests(session, post_install=None):
@nox.session(python=ALL_VERSIONS)
-def py(session):
+def py(session: nox.sessions.Session) -> None:
"""Runs py.test for a sample using the specified version of Python."""
if session.python in TESTED_VERSIONS:
_session_tests(session)
@@ -209,7 +210,7 @@ def py(session):
#
-def _get_repo_root():
+def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
@@ -232,7 +233,7 @@ def _get_repo_root():
@nox.session
@nox.parametrize("path", GENERATED_READMES)
-def readmegen(session, path):
+def readmegen(session: nox.sessions.Session, path: str) -> None:
"""(Re-)generates the readme for a sample."""
session.install("jinja2", "pyyaml")
dir_ = os.path.dirname(path)
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index 33b4937..f650d3f 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1,7 +1,7 @@
-google-cloud-pubsub==2.1.0
-google-cloud-containeranalysis==2.0.0
+google-cloud-pubsub==2.2.0
+google-cloud-containeranalysis==2.1.0
grafeas==1.0.1
pytest==5.3.0; python_version > "3.0"
pytest==4.6.6; python_version < "3.0"
flaky==3.7.0
-mock==4.0.2
+mock==4.0.3
diff --git a/setup.py b/setup.py
index 9216a3e..53d65e6 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
name = "google-cloud-containeranalysis"
description = "Container Analysis API API client library"
-version = "2.1.0"
+version = "2.2.0"
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
"google-api-core[grpc] >= 1.22.0, < 2.0.0dev",
diff --git a/synth.metadata b/synth.metadata
index cabe0c7..92f6852 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,29 +4,29 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-containeranalysis.git",
- "sha": "2ce48dca5bf1ca50f30266dd0b2deb5e36346c6c"
+ "sha": "56c8dafd3995079015f86119ae2d48bd50124ef3"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "07d41a7e5cade45aba6f0d277c89722b48f2c956",
- "internalRef": "339292950"
+ "sha": "520682435235d9c503983a360a2090025aa47cd1",
+ "internalRef": "350246057"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
+ "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
+ "sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
}
],
@@ -42,6 +42,7 @@
}
],
"generatedFiles": [
+ ".coveragerc",
".flake8",
".github/CONTRIBUTING.md",
".github/ISSUE_TEMPLATE/bug_report.md",
@@ -85,6 +86,7 @@
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
+ ".pre-commit-config.yaml",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
@@ -93,6 +95,7 @@
"docs/_static/custom.css",
"docs/_templates/layout.html",
"docs/conf.py",
+ "docs/containeranalysis_v1/container_analysis.rst",
"docs/containeranalysis_v1/services.rst",
"docs/containeranalysis_v1/types.rst",
"docs/multiprocessing.rst",
diff --git a/synth.py b/synth.py
index d343fe8..3028b70 100644
--- a/synth.py
+++ b/synth.py
@@ -50,6 +50,14 @@
r"""google-cloud-containeranalysis""",
)
+# Fix imported type from grafeas
+
+s.replace(
+ "google/**/types/containeranalysis.py",
+ "from grafeas\.v1 import vulnerability_pb2 as vulnerability",
+ "from grafeas.grafeas_v1.types import vulnerability"
+)
+
# Insert helper method to get grafeas client
s.replace(
diff --git a/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py b/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py
index a8f1156..e18615c 100644
--- a/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py
+++ b/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py
@@ -94,8 +94,21 @@ def test__get_default_mtls_endpoint():
)
+def test_container_analysis_client_from_service_account_info():
+ creds = credentials.AnonymousCredentials()
+ with mock.patch.object(
+ service_account.Credentials, "from_service_account_info"
+ ) as factory:
+ factory.return_value = creds
+ info = {"valid": True}
+ client = ContainerAnalysisClient.from_service_account_info(info)
+ assert client.transport._credentials == creds
+
+ assert client.transport._host == "containeranalysis.googleapis.com:443"
+
+
@pytest.mark.parametrize(
- "client_class", [ContainerAnalysisClient, ContainerAnalysisAsyncClient]
+ "client_class", [ContainerAnalysisClient, ContainerAnalysisAsyncClient,]
)
def test_container_analysis_client_from_service_account_file(client_class):
creds = credentials.AnonymousCredentials()
@@ -114,7 +127,10 @@ def test_container_analysis_client_from_service_account_file(client_class):
def test_container_analysis_client_get_transport_class():
transport = ContainerAnalysisClient.get_transport_class()
- assert transport == transports.ContainerAnalysisGrpcTransport
+ available_transports = [
+ transports.ContainerAnalysisGrpcTransport,
+ ]
+ assert transport in available_transports
transport = ContainerAnalysisClient.get_transport_class("grpc")
assert transport == transports.ContainerAnalysisGrpcTransport
@@ -1526,7 +1542,7 @@ def test_container_analysis_host_with_port():
def test_container_analysis_grpc_transport_channel():
- channel = grpc.insecure_channel("http://localhost/")
+ channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.ContainerAnalysisGrpcTransport(
@@ -1538,7 +1554,7 @@ def test_container_analysis_grpc_transport_channel():
def test_container_analysis_grpc_asyncio_transport_channel():
- channel = aio.insecure_channel("http://localhost/")
+ channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials())
# Check that channel is used if provided.
transport = transports.ContainerAnalysisGrpcAsyncIOTransport(
@@ -1563,7 +1579,7 @@ def test_container_analysis_transport_channel_mtls_with_client_cert_source(
"grpc.ssl_channel_credentials", autospec=True
) as grpc_ssl_channel_cred:
with mock.patch.object(
- transport_class, "create_channel", autospec=True
+ transport_class, "create_channel"
) as grpc_create_channel:
mock_ssl_cred = mock.Mock()
grpc_ssl_channel_cred.return_value = mock_ssl_cred
@@ -1592,6 +1608,10 @@ def test_container_analysis_transport_channel_mtls_with_client_cert_source(
scopes=("https://www.googleapis.com/auth/cloud-platform",),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
assert transport.grpc_channel == mock_grpc_channel
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -1612,7 +1632,7 @@ def test_container_analysis_transport_channel_mtls_with_adc(transport_class):
ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
):
with mock.patch.object(
- transport_class, "create_channel", autospec=True
+ transport_class, "create_channel"
) as grpc_create_channel:
mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
@@ -1633,6 +1653,10 @@ def test_container_analysis_transport_channel_mtls_with_adc(transport_class):
scopes=("https://www.googleapis.com/auth/cloud-platform",),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
)
assert transport.grpc_channel == mock_grpc_channel