diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# Copyright 2022 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 +# +# 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. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index d70dca3..46f2f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.5.0](https://github.com/googleapis/python-bigquery-connection/compare/v1.4.0...v1.5.0) (2022-05-05) + + +### Features + +* AuditConfig for IAM v1 ([#194](https://github.com/googleapis/python-bigquery-connection/issues/194)) ([d350b94](https://github.com/googleapis/python-bigquery-connection/commit/d350b947b3cfbb1aede8638c518eac2e8ba5495d)) + + +### Bug Fixes + +* **deps:** require grpc-google-iam-v1 >=0.12.4 ([d350b94](https://github.com/googleapis/python-bigquery-connection/commit/d350b947b3cfbb1aede8638c518eac2e8ba5495d)) +* region tags in create_mysql_connection.py ([#205](https://github.com/googleapis/python-bigquery-connection/issues/205)) ([f082fd2](https://github.com/googleapis/python-bigquery-connection/commit/f082fd246495cd6f874e6ac85655d27d594ab786)) + + +### Documentation + +* **samples:** create connection sample for MySQL instance ([#147](https://github.com/googleapis/python-bigquery-connection/issues/147)) ([8e664be](https://github.com/googleapis/python-bigquery-connection/commit/8e664bea488183d1132a61cb1ab7a912dde48b43)) + ## [1.4.0](https://github.com/googleapis/python-bigquery-connection/compare/v1.3.4...v1.4.0) (2022-03-08) diff --git a/docs/conf.py b/docs/conf.py index 4a15e89..f73bbd7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -361,7 +361,10 @@ intersphinx_mapping = { "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,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/bigquery_connection/__init__.py b/google/cloud/bigquery_connection/__init__.py index 38d8d1f..3b48bcc 100644 --- a/google/cloud/bigquery_connection/__init__.py +++ b/google/cloud/bigquery_connection/__init__.py @@ -14,28 +14,29 @@ # limitations under the License. # +from google.cloud.bigquery_connection_v1.services.connection_service.async_client import ( + ConnectionServiceAsyncClient, +) from google.cloud.bigquery_connection_v1.services.connection_service.client import ( ConnectionServiceClient, ) -from google.cloud.bigquery_connection_v1.services.connection_service.async_client import ( - ConnectionServiceAsyncClient, +from google.cloud.bigquery_connection_v1.types.connection import ( + AwsAccessRole, + AwsCrossAccountRole, + AwsProperties, + CloudResourceProperties, + CloudSpannerProperties, + CloudSqlCredential, + CloudSqlProperties, + Connection, + CreateConnectionRequest, + DeleteConnectionRequest, + GetConnectionRequest, + ListConnectionsRequest, + ListConnectionsResponse, + UpdateConnectionRequest, ) -from google.cloud.bigquery_connection_v1.types.connection import AwsAccessRole -from google.cloud.bigquery_connection_v1.types.connection import AwsCrossAccountRole -from google.cloud.bigquery_connection_v1.types.connection import AwsProperties -from google.cloud.bigquery_connection_v1.types.connection import CloudResourceProperties -from google.cloud.bigquery_connection_v1.types.connection import CloudSpannerProperties -from google.cloud.bigquery_connection_v1.types.connection import CloudSqlCredential -from google.cloud.bigquery_connection_v1.types.connection import CloudSqlProperties -from google.cloud.bigquery_connection_v1.types.connection import Connection -from google.cloud.bigquery_connection_v1.types.connection import CreateConnectionRequest -from google.cloud.bigquery_connection_v1.types.connection import DeleteConnectionRequest -from google.cloud.bigquery_connection_v1.types.connection import GetConnectionRequest -from google.cloud.bigquery_connection_v1.types.connection import ListConnectionsRequest -from google.cloud.bigquery_connection_v1.types.connection import ListConnectionsResponse -from google.cloud.bigquery_connection_v1.types.connection import UpdateConnectionRequest - __all__ = ( "ConnectionServiceClient", "ConnectionServiceAsyncClient", diff --git a/google/cloud/bigquery_connection_v1/__init__.py b/google/cloud/bigquery_connection_v1/__init__.py index 72991c9..057bb6d 100644 --- a/google/cloud/bigquery_connection_v1/__init__.py +++ b/google/cloud/bigquery_connection_v1/__init__.py @@ -14,23 +14,26 @@ # limitations under the License. # -from .services.connection_service import ConnectionServiceClient -from .services.connection_service import ConnectionServiceAsyncClient - -from .types.connection import AwsAccessRole -from .types.connection import AwsCrossAccountRole -from .types.connection import AwsProperties -from .types.connection import CloudResourceProperties -from .types.connection import CloudSpannerProperties -from .types.connection import CloudSqlCredential -from .types.connection import CloudSqlProperties -from .types.connection import Connection -from .types.connection import CreateConnectionRequest -from .types.connection import DeleteConnectionRequest -from .types.connection import GetConnectionRequest -from .types.connection import ListConnectionsRequest -from .types.connection import ListConnectionsResponse -from .types.connection import UpdateConnectionRequest +from .services.connection_service import ( + ConnectionServiceAsyncClient, + ConnectionServiceClient, +) +from .types.connection import ( + AwsAccessRole, + AwsCrossAccountRole, + AwsProperties, + CloudResourceProperties, + CloudSpannerProperties, + CloudSqlCredential, + CloudSqlProperties, + Connection, + CreateConnectionRequest, + DeleteConnectionRequest, + GetConnectionRequest, + ListConnectionsRequest, + ListConnectionsResponse, + UpdateConnectionRequest, +) __all__ = ( "ConnectionServiceAsyncClient", diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/__init__.py b/google/cloud/bigquery_connection_v1/services/connection_service/__init__.py index 2f37b5d..34709ef 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/__init__.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ConnectionServiceClient from .async_client import ConnectionServiceAsyncClient +from .client import ConnectionServiceClient __all__ = ( "ConnectionServiceClient", diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py b/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py index 11cb2cc..6d79266 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py @@ -16,30 +16,32 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_connection_v1.services.connection_service import pagers -from google.cloud.bigquery_connection_v1.types import connection -from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore -from .transports.base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport + +from google.cloud.bigquery_connection_v1.services.connection_service import pagers +from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection +from google.cloud.bigquery_connection_v1.types import connection + from .client import ConnectionServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, ConnectionServiceTransport +from .transports.grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport class ConnectionServiceAsyncClient: @@ -223,9 +225,9 @@ async def create_connection( from google.cloud import bigquery_connection_v1 - def sample_create_connection(): + async def sample_create_connection(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) request = bigquery_connection_v1.CreateConnectionRequest( @@ -233,7 +235,7 @@ def sample_create_connection(): ) # Make the request - response = client.create_connection(request=request) + response = await client.create_connection(request=request) # Handle the response print(response) @@ -310,7 +312,12 @@ def sample_create_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -330,9 +337,9 @@ async def get_connection( from google.cloud import bigquery_connection_v1 - def sample_get_connection(): + async def sample_get_connection(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) request = bigquery_connection_v1.GetConnectionRequest( @@ -340,7 +347,7 @@ def sample_get_connection(): ) # Make the request - response = client.get_connection(request=request) + response = await client.get_connection(request=request) # Handle the response print(response) @@ -411,7 +418,12 @@ def sample_get_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -431,9 +443,9 @@ async def list_connections( from google.cloud import bigquery_connection_v1 - def sample_list_connections(): + async def sample_list_connections(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) request = bigquery_connection_v1.ListConnectionsRequest( @@ -445,7 +457,7 @@ def sample_list_connections(): page_result = client.list_connections(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -516,12 +528,20 @@ def sample_list_connections(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListConnectionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -542,14 +562,13 @@ async def update_connection( reasons, also resets credential if connection properties are in the update field mask. - .. code-block:: python from google.cloud import bigquery_connection_v1 - def sample_update_connection(): + async def sample_update_connection(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) request = bigquery_connection_v1.UpdateConnectionRequest( @@ -557,7 +576,7 @@ def sample_update_connection(): ) # Make the request - response = client.update_connection(request=request) + response = await client.update_connection(request=request) # Handle the response print(response) @@ -636,7 +655,12 @@ def sample_update_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -656,9 +680,9 @@ async def delete_connection( from google.cloud import bigquery_connection_v1 - def sample_delete_connection(): + async def sample_delete_connection(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) request = bigquery_connection_v1.DeleteConnectionRequest( @@ -666,7 +690,7 @@ def sample_delete_connection(): ) # Make the request - client.delete_connection(request=request) + await client.delete_connection(request=request) Args: request (Union[google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest, dict]): @@ -728,7 +752,10 @@ def sample_delete_connection(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def get_iam_policy( @@ -744,22 +771,22 @@ async def get_iam_policy( Returns an empty policy if the resource exists and does not have a policy set. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_get_iam_policy(): + async def sample_get_iam_policy(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) # Make the request - response = client.get_iam_policy(request=request) + response = await client.get_iam_policy(request=request) # Handle the response print(response) @@ -785,21 +812,26 @@ def sample_get_iam_policy(): Returns: 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. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud 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** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -814,17 +846,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -835,11 +867,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -857,7 +890,9 @@ def sample_get_iam_policy(): if isinstance(request, dict): request = iam_policy_pb2.GetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.GetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.GetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -874,7 +909,12 @@ def sample_get_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -894,22 +934,22 @@ async def set_iam_policy( Can return ``NOT_FOUND``, ``INVALID_ARGUMENT``, and ``PERMISSION_DENIED`` errors. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_set_iam_policy(): + async def sample_set_iam_policy(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) # Make the request - response = client.set_iam_policy(request=request) + response = await client.set_iam_policy(request=request) # Handle the response print(response) @@ -935,21 +975,26 @@ def sample_set_iam_policy(): Returns: 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. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud 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** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -964,17 +1009,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -985,11 +1030,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1007,7 +1053,9 @@ def sample_set_iam_policy(): if isinstance(request, dict): request = iam_policy_pb2.SetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1024,7 +1072,12 @@ def sample_set_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1048,23 +1101,23 @@ async def test_iam_permissions( authorization checking. This operation may "fail open" without warning. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_test_iam_permissions(): + async def sample_test_iam_permissions(): # Create a client - client = bigquery_connection_v1.ConnectionServiceClient() + client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) # Make the request - response = client.test_iam_permissions(request=request) + response = await client.test_iam_permissions(request=request) # Handle the response print(response) @@ -1117,7 +1170,8 @@ def sample_test_iam_permissions(): request = iam_policy_pb2.TestIamPermissionsRequest(**request) elif not request: request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions, + resource=resource, + permissions=permissions, ) # Wrap the RPC method; this adds retry and timeout information, @@ -1135,7 +1189,12 @@ def sample_test_iam_permissions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/client.py b/google/cloud/bigquery_connection_v1/services/connection_service/client.py index cc91665..fa63321 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/client.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/client.py @@ -16,31 +16,33 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_connection_v1.services.connection_service import pagers -from google.cloud.bigquery_connection_v1.types import connection -from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore -from .transports.base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_connection_v1.services.connection_service import pagers +from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection +from google.cloud.bigquery_connection_v1.types import connection + +from .transports.base import DEFAULT_CLIENT_INFO, ConnectionServiceTransport from .transports.grpc import ConnectionServiceGrpcTransport from .transports.grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport @@ -60,7 +62,8 @@ class ConnectionServiceClientMeta(type): _transport_registry["grpc_asyncio"] = ConnectionServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[ConnectionServiceTransport]: """Returns an appropriate transport class. @@ -166,10 +169,18 @@ def transport(self) -> ConnectionServiceTransport: return self._transport @staticmethod - def connection_path(project: str, location: str, connection: str,) -> str: + def connection_path( + project: str, + location: str, + connection: str, + ) -> str: """Returns a fully-qualified connection string.""" - return "projects/{project}/locations/{location}/connections/{connection}".format( - project=project, location=location, connection=connection, + return ( + "projects/{project}/locations/{location}/connections/{connection}".format( + project=project, + location=location, + connection=connection, + ) ) @staticmethod @@ -182,7 +193,9 @@ def parse_connection_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -195,9 +208,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -206,9 +223,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -217,9 +238,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -228,10 +253,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -509,7 +538,12 @@ def sample_create_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -600,7 +634,12 @@ def sample_get_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -695,12 +734,20 @@ def sample_list_connections(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListConnectionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -721,7 +768,6 @@ def update_connection( reasons, also resets credential if connection properties are in the update field mask. - .. code-block:: python from google.cloud import bigquery_connection_v1 @@ -815,7 +861,12 @@ def sample_update_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -897,7 +948,10 @@ def sample_delete_connection(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def get_iam_policy( @@ -913,17 +967,17 @@ def get_iam_policy( Returns an empty policy if the resource exists and does not have a policy set. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): # Create a client client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) @@ -954,21 +1008,26 @@ def sample_get_iam_policy(): Returns: 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. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud 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** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -983,17 +1042,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1004,11 +1063,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1042,7 +1102,12 @@ def sample_get_iam_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1062,17 +1127,17 @@ def set_iam_policy( Can return ``NOT_FOUND``, ``INVALID_ARGUMENT``, and ``PERMISSION_DENIED`` errors. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): # Create a client client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) @@ -1103,21 +1168,26 @@ def sample_set_iam_policy(): Returns: 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. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud 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** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -1132,17 +1202,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1153,11 +1223,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1191,7 +1262,12 @@ def sample_set_iam_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1215,17 +1291,17 @@ def test_iam_permissions( authorization checking. This operation may "fail open" without warning. - .. code-block:: python from google.cloud import bigquery_connection_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): # Create a client client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) @@ -1301,7 +1377,12 @@ def sample_test_iam_permissions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/pagers.py b/google/cloud/bigquery_connection_v1/services/connection_service/pagers.py index a55ab33..a2394cc 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/pagers.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.bigquery_connection_v1.types import connection diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/__init__.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/__init__.py index a5ae926..b581fa9 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/__init__.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ConnectionServiceGrpcTransport from .grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ConnectionServiceTransport]] _transport_registry["grpc"] = ConnectionServiceGrpcTransport diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py index 35c5fbd..3121889 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py @@ -15,21 +15,21 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.bigquery_connection_v1.types import connection -from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore +from google.oauth2 import service_account # type: ignore from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection +from google.cloud.bigquery_connection_v1.types import connection try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,7 +129,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_connection: gapic_v1.method.wrap_method( - self.create_connection, default_timeout=60.0, client_info=client_info, + self.create_connection, + default_timeout=60.0, + client_info=client_info, ), self.get_connection: gapic_v1.method.wrap_method( self.get_connection, @@ -161,7 +164,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_connection: gapic_v1.method.wrap_method( - self.update_connection, default_timeout=60.0, client_info=client_info, + self.update_connection, + default_timeout=60.0, + client_info=client_info, ), self.delete_connection: gapic_v1.method.wrap_method( self.delete_connection, @@ -179,10 +184,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=60.0, client_info=client_info, + self.get_iam_policy, + default_timeout=60.0, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=60.0, client_info=client_info, + self.set_iam_policy, + default_timeout=60.0, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -194,9 +203,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -278,5 +287,9 @@ def test_iam_permissions( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ConnectionServiceTransport",) diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc.py index 918b24d..6522028 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc.py @@ -13,23 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.cloud.bigquery_connection_v1.types import connection -from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore -from .base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO +import grpc # type: ignore + +from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection +from google.cloud.bigquery_connection_v1.types import connection + +from .base import DEFAULT_CLIENT_INFO, ConnectionServiceTransport class ConnectionServiceGrpcTransport(ConnectionServiceTransport): @@ -228,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -467,5 +465,9 @@ def test_iam_permissions( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ConnectionServiceGrpcTransport",) diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py index 4b8ec20..1c0cf2f 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py @@ -13,23 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.bigquery_connection_v1.types import connection from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from .base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_connection_v1.types import connection + +from .base import DEFAULT_CLIENT_INFO, ConnectionServiceTransport from .grpc import ConnectionServiceGrpcTransport diff --git a/google/cloud/bigquery_connection_v1/types/connection.py b/google/cloud/bigquery_connection_v1/types/connection.py index 2c8256f..3f3a449 100644 --- a/google/cloud/bigquery_connection_v1/types/connection.py +++ b/google/cloud/bigquery_connection_v1/types/connection.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import field_mask_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.connection.v1", @@ -54,9 +52,19 @@ class CreateConnectionRequest(proto.Message): Required. Connection to create. """ - parent = proto.Field(proto.STRING, number=1,) - connection_id = proto.Field(proto.STRING, number=2,) - connection = proto.Field(proto.MESSAGE, number=3, message="Connection",) + parent = proto.Field( + proto.STRING, + number=1, + ) + connection_id = proto.Field( + proto.STRING, + number=2, + ) + connection = proto.Field( + proto.MESSAGE, + number=3, + message="Connection", + ) class GetConnectionRequest(proto.Message): @@ -69,7 +77,10 @@ class GetConnectionRequest(proto.Message): ``projects/{project_id}/locations/{location_id}/connections/{connection_id}`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListConnectionsRequest(proto.Message): @@ -86,9 +97,18 @@ class ListConnectionsRequest(proto.Message): Page token. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListConnectionsResponse(proto.Message): @@ -106,8 +126,15 @@ class ListConnectionsResponse(proto.Message): def raw_page(self): return self - next_page_token = proto.Field(proto.STRING, number=1,) - connections = proto.RepeatedField(proto.MESSAGE, number=2, message="Connection",) + next_page_token = proto.Field( + proto.STRING, + number=1, + ) + connections = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Connection", + ) class UpdateConnectionRequest(proto.Message): @@ -126,10 +153,19 @@ class UpdateConnectionRequest(proto.Message): fields to be updated. """ - name = proto.Field(proto.STRING, number=1,) - connection = proto.Field(proto.MESSAGE, number=2, message="Connection",) + name = proto.Field( + proto.STRING, + number=1, + ) + connection = proto.Field( + proto.MESSAGE, + number=2, + message="Connection", + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -142,7 +178,10 @@ class DeleteConnectionRequest(proto.Message): ``projects/{project_id}/locations/{location_id}/connections/{connection_id}`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class Connection(proto.Message): @@ -192,24 +231,54 @@ class Connection(proto.Message): configured for this connection. """ - name = proto.Field(proto.STRING, number=1,) - friendly_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + friendly_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) cloud_sql = proto.Field( - proto.MESSAGE, number=4, oneof="properties", message="CloudSqlProperties", + proto.MESSAGE, + number=4, + oneof="properties", + message="CloudSqlProperties", ) aws = proto.Field( - proto.MESSAGE, number=8, oneof="properties", message="AwsProperties", + proto.MESSAGE, + number=8, + oneof="properties", + message="AwsProperties", ) cloud_spanner = proto.Field( - proto.MESSAGE, number=21, oneof="properties", message="CloudSpannerProperties", + proto.MESSAGE, + number=21, + oneof="properties", + message="CloudSpannerProperties", ) cloud_resource = proto.Field( - proto.MESSAGE, number=22, oneof="properties", message="CloudResourceProperties", + proto.MESSAGE, + number=22, + oneof="properties", + message="CloudResourceProperties", + ) + creation_time = proto.Field( + proto.INT64, + number=5, + ) + last_modified_time = proto.Field( + proto.INT64, + number=6, + ) + has_credential = proto.Field( + proto.BOOL, + number=7, ) - creation_time = proto.Field(proto.INT64, number=5,) - last_modified_time = proto.Field(proto.INT64, number=6,) - has_credential = proto.Field(proto.BOOL, number=7,) class CloudSqlProperties(proto.Message): @@ -233,10 +302,24 @@ class DatabaseType(proto.Enum): POSTGRES = 1 MYSQL = 2 - instance_id = proto.Field(proto.STRING, number=1,) - database = proto.Field(proto.STRING, number=2,) - type_ = proto.Field(proto.ENUM, number=3, enum=DatabaseType,) - credential = proto.Field(proto.MESSAGE, number=4, message="CloudSqlCredential",) + instance_id = proto.Field( + proto.STRING, + number=1, + ) + database = proto.Field( + proto.STRING, + number=2, + ) + type_ = proto.Field( + proto.ENUM, + number=3, + enum=DatabaseType, + ) + credential = proto.Field( + proto.MESSAGE, + number=4, + message="CloudSqlCredential", + ) class CloudSqlCredential(proto.Message): @@ -249,8 +332,14 @@ class CloudSqlCredential(proto.Message): The password for the credential. """ - username = proto.Field(proto.STRING, number=1,) - password = proto.Field(proto.STRING, number=2,) + username = proto.Field( + proto.STRING, + number=1, + ) + password = proto.Field( + proto.STRING, + number=2, + ) class CloudSpannerProperties(proto.Message): @@ -265,8 +354,14 @@ class CloudSpannerProperties(proto.Message): from Cloud Spanner """ - database = proto.Field(proto.STRING, number=1,) - use_parallelism = proto.Field(proto.BOOL, number=2,) + database = proto.Field( + proto.STRING, + number=1, + ) + use_parallelism = proto.Field( + proto.BOOL, + number=2, + ) class AwsProperties(proto.Message): @@ -300,7 +395,10 @@ class AwsProperties(proto.Message): message="AwsCrossAccountRole", ) access_role = proto.Field( - proto.MESSAGE, number=3, oneof="authentication_method", message="AwsAccessRole", + proto.MESSAGE, + number=3, + oneof="authentication_method", + message="AwsAccessRole", ) @@ -323,9 +421,18 @@ class AwsCrossAccountRole(proto.Message): https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html """ - iam_role_id = proto.Field(proto.STRING, number=1,) - iam_user_id = proto.Field(proto.STRING, number=2,) - external_id = proto.Field(proto.STRING, number=3,) + iam_role_id = proto.Field( + proto.STRING, + number=1, + ) + iam_user_id = proto.Field( + proto.STRING, + number=2, + ) + external_id = proto.Field( + proto.STRING, + number=3, + ) class AwsAccessRole(proto.Message): @@ -343,8 +450,14 @@ class AwsAccessRole(proto.Message): be used to access the user's AWS IAM Role. """ - iam_role_id = proto.Field(proto.STRING, number=1,) - identity = proto.Field(proto.STRING, number=2,) + iam_role_id = proto.Field( + proto.STRING, + number=1, + ) + identity = proto.Field( + proto.STRING, + number=2, + ) class CloudResourceProperties(proto.Message): @@ -368,7 +481,10 @@ class CloudResourceProperties(proto.Message): @gcp-sa-bigquery-cloudresource.iam.gserviceaccount.com """ - service_account_id = proto.Field(proto.STRING, number=1,) + service_account_id = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py index 103641c..83c4af1 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_get_iam_policy(): @@ -32,7 +33,7 @@ async def sample_get_iam_policy(): client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py index 5568bbd..e61b212 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_sync] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): @@ -32,7 +33,7 @@ def sample_get_iam_policy(): client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py index 2112e51..03e9026 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_set_iam_policy(): @@ -32,7 +33,7 @@ async def sample_set_iam_policy(): client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py index cba122c..220b5ea 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_sync] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): @@ -32,7 +33,7 @@ def sample_set_iam_policy(): client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py index d1c686c..c7efbfc 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_TestIamPermissions_async] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ async def sample_test_iam_permissions(): client = bigquery_connection_v1.ConnectionServiceAsyncClient() # Initialize request argument(s) - request = bigquery_connection_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py index cbb2aa8..b5d5b67 100644 --- a/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py +++ b/samples/generated_samples/bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py @@ -25,6 +25,7 @@ # [START bigqueryconnection_v1_generated_ConnectionService_TestIamPermissions_sync] from google.cloud import bigquery_connection_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ def sample_test_iam_permissions(): client = bigquery_connection_v1.ConnectionServiceClient() # Initialize request argument(s) - request = bigquery_connection_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/snippet_metadata_bigquery connection_v1.json b/samples/generated_samples/snippet_metadata_bigquery connection_v1.json index e5f0f7d..61fd4e7 100644 --- a/samples/generated_samples/snippet_metadata_bigquery connection_v1.json +++ b/samples/generated_samples/snippet_metadata_bigquery connection_v1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.bigquery.connection.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-bigquery-connection" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.create_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "CreateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.CreateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection", + "type": "google.cloud.bigquery_connection_v1.types.Connection" + }, + { + "name": "connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "create_connection" }, + "description": "Sample for CreateConnection", "file": "bigqueryconnection_v1_generated_connection_service_create_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_CreateConnection_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_create_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.create_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "CreateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.CreateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection", + "type": "google.cloud.bigquery_connection_v1.types.Connection" + }, + { + "name": "connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "create_connection" }, + "description": "Sample for CreateConnection", "file": "bigqueryconnection_v1_generated_connection_service_create_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_CreateConnection_sync", "segments": [ { @@ -87,19 +184,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_create_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.delete_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.DeleteConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "DeleteConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_connection" }, + "description": "Sample for DeleteConnection", "file": "bigqueryconnection_v1_generated_connection_service_delete_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_async", "segments": [ { @@ -130,18 +262,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_delete_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.delete_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.DeleteConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "DeleteConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_connection" }, + "description": "Sample for DeleteConnection", "file": "bigqueryconnection_v1_generated_connection_service_delete_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_DeleteConnection_sync", "segments": [ { @@ -172,19 +339,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_delete_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.get_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.GetConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "GetConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.GetConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "get_connection" }, + "description": "Sample for GetConnection", "file": "bigqueryconnection_v1_generated_connection_service_get_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_GetConnection_async", "segments": [ { @@ -217,18 +420,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_get_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.get_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.GetConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "GetConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.GetConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "get_connection" }, + "description": "Sample for GetConnection", "file": "bigqueryconnection_v1_generated_connection_service_get_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_GetConnection_sync", "segments": [ { @@ -261,108 +500,216 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_get_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.get_iam_policy", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.GetIamPolicy", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_get_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.get_iam_policy", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.GetIamPolicy", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_GetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.list_connections", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.ListConnections", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "ListConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.ListConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.services.connection_service.pagers.ListConnectionsAsyncPager", + "shortName": "list_connections" }, + "description": "Sample for ListConnections", "file": "bigqueryconnection_v1_generated_connection_service_list_connections_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_ListConnections_async", "segments": [ { @@ -395,18 +742,54 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_list_connections_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.list_connections", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.ListConnections", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "ListConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.ListConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.services.connection_service.pagers.ListConnectionsPager", + "shortName": "list_connections" }, + "description": "Sample for ListConnections", "file": "bigqueryconnection_v1_generated_connection_service_list_connections_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_ListConnections_sync", "segments": [ { @@ -439,197 +822,393 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_list_connections_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.set_iam_policy", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.SetIamPolicy", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_set_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.set_iam_policy", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.SetIamPolicy", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_SetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_set_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.test_iam_permissions", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.TestIamPermissions", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "permissions", + "type": "Sequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_TestIamPermissions_async", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_test_iam_permissions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.test_iam_permissions", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.TestIamPermissions", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "permissions", + "type": "Sequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_TestIamPermissions_sync", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_test_iam_permissions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient", + "shortName": "ConnectionServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceAsyncClient.update_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "UpdateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "connection", + "type": "google.cloud.bigquery_connection_v1.types.Connection" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "update_connection" }, + "description": "Sample for UpdateConnection", "file": "bigqueryconnection_v1_generated_connection_service_update_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_UpdateConnection_async", "segments": [ { @@ -662,18 +1241,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_update_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient", + "shortName": "ConnectionServiceClient" + }, + "fullName": "google.cloud.bigquery_connection_v1.ConnectionServiceClient.update_connection", "method": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection", "service": { + "fullName": "google.cloud.bigquery.connection.v1.ConnectionService", "shortName": "ConnectionService" }, "shortName": "UpdateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "connection", + "type": "google.cloud.bigquery_connection_v1.types.Connection" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_connection_v1.types.Connection", + "shortName": "update_connection" }, + "description": "Sample for UpdateConnection", "file": "bigqueryconnection_v1_generated_connection_service_update_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigqueryconnection_v1_generated_ConnectionService_UpdateConnection_sync", "segments": [ { @@ -706,7 +1329,8 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigqueryconnection_v1_generated_connection_service_update_connection_sync.py" } ] } diff --git a/samples/snippets/conftest.py b/samples/snippets/conftest.py index 8e39714..eca2a7f 100644 --- a/samples/snippets/conftest.py +++ b/samples/snippets/conftest.py @@ -19,15 +19,35 @@ @pytest.fixture(scope="session") -def project_id() -> str: - return os.environ["GOOGLE_CLOUD_PROJECT"] +def connection_client() -> connection_service.ConnectionServiceClient: + return connection_service.ConnectionServiceClient() @pytest.fixture(scope="session") -def connection_client() -> connection_service.ConnectionServiceClient: - return connection_service.ConnectionServiceClient() +def project_id() -> str: + return os.environ["GOOGLE_CLOUD_PROJECT"] @pytest.fixture(scope="session") def location() -> str: return "US" + + +@pytest.fixture(scope="session") +def database() -> str: + return os.environ["MYSQL_DATABASE"] + + +@pytest.fixture(scope="session") +def cloud_sql_conn_name() -> str: + return os.environ["MYSQL_INSTANCE"] + + +@pytest.fixture(scope="session") +def mysql_username() -> str: + return os.environ["MYSQL_USER"] + + +@pytest.fixture(scope="session") +def mysql_password() -> str: + return os.environ["MYSQL_PASSWORD"] diff --git a/samples/snippets/create_mysql_connection.py b/samples/snippets/create_mysql_connection.py new file mode 100644 index 0000000..a71c967 --- /dev/null +++ b/samples/snippets/create_mysql_connection.py @@ -0,0 +1,64 @@ +# Copyright 2021 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. + +# [START bigqueryconnection_create_connection] +from google.cloud import bigquery_connection_v1 as bq_connection + +"""This sample shows how to create a BigQuery connection with a Cloud SQL for MySQL database""" + + +def main() -> None: + # TODO(developer): Set all variables for your Cloud SQL for MySQL connection. + project_id = "your-project-id" # set project_id + location = "US" # set location + # See: https://cloud.google.com/bigquery/docs/locations for a list of + # available locations. + database = "my-database" # set database name + username = "my-username" # set database username + password = "my-password" # set database password + cloud_sql_conn_name = "" # set the name of your connection + + cloud_sql_credential = bq_connection.CloudSqlCredential( + { + "username": username, + "password": password, + } + ) + cloud_sql_properties = bq_connection.CloudSqlProperties( + { + "type_": bq_connection.CloudSqlProperties.DatabaseType.MYSQL, + "database": database, + "instance_id": cloud_sql_conn_name, + "credential": cloud_sql_credential, + } + ) + create_mysql_connection(project_id, location, cloud_sql_properties) + + +def create_mysql_connection( + project_id: str, + location: str, + cloud_sql_properties: bq_connection.CloudSqlProperties, +) -> None: + connection = bq_connection.types.Connection({"cloud_sql": cloud_sql_properties}) + client = bq_connection.ConnectionServiceClient() + parent = client.common_location_path(project_id, location) + request = bq_connection.CreateConnectionRequest( + {"parent": parent, "connection": connection} + ) + response = client.create_connection(request) + print(f"Created connection successfully: {response.name}") + + +# [END bigqueryconnection_create_connection] diff --git a/samples/snippets/create_mysql_connection_test.py b/samples/snippets/create_mysql_connection_test.py new file mode 100644 index 0000000..9eda07d --- /dev/null +++ b/samples/snippets/create_mysql_connection_test.py @@ -0,0 +1,90 @@ +# Copyright 2021 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. + +import google.api_core.exceptions +from google.cloud import bigquery_connection_v1 as bq_connection +from google.cloud.bigquery_connection_v1.services import connection_service +import pytest +import test_utils.prefixer + +from . import create_mysql_connection + +connection_prefixer = test_utils.prefixer.Prefixer("py-bq-r", "snippets", separator="-") + + +@pytest.fixture(scope="session") +def location_path( + connection_client: connection_service.ConnectionServiceClient(), + project_id: str, + location: str, +) -> str: + return connection_client.common_location_path(project_id, location) + + +@pytest.fixture(scope="module", autouse=True) +def cleanup_connection( + connection_client: connection_service.ConnectionServiceClient, location_path: str +) -> None: + for connection in connection_client.list_connections(parent=location_path): + connection_id = connection.name.split("/")[-1] + if connection_prefixer.should_cleanup(connection_id): + connection_client.delete_connection(name=connection.name) + + +@pytest.fixture(scope="session") +def connection_id( + connection_client: connection_service.ConnectionServiceClient, + project_id: str, + location: str, +) -> str: + id_ = connection_prefixer.create_prefix() + yield id_ + + connection_name = connection_client.connection_path(project_id, location, id_) + try: + connection_client.delete_connection(name=connection_name) + except google.api_core.exceptions.NotFound: + pass + + +def test_create_mysql_connection( + capsys: pytest.CaptureFixture, + mysql_username: str, + mysql_password: str, + database: str, + cloud_sql_conn_name: str, + project_id: str, + location: str, +) -> None: + cloud_sql_credential = bq_connection.CloudSqlCredential( + { + "username": mysql_username, + "password": mysql_password, + } + ) + cloud_sql_properties = bq_connection.CloudSqlProperties( + { + "type_": bq_connection.CloudSqlProperties.DatabaseType.MYSQL, + "database": database, + "instance_id": cloud_sql_conn_name, + "credential": cloud_sql_credential, + } + ) + create_mysql_connection.create_mysql_connection( + project_id=project_id, + location=location, + cloud_sql_properties=cloud_sql_properties, + ) + out, _ = capsys.readouterr() + assert "Created connection successfully:" in out diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 85f5836..3b3ffa5 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -22,14 +22,14 @@ import nox - # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING # DO NOT EDIT THIS FILE EVER! # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +168,33 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # @@ -253,7 +274,7 @@ def py(session: nox.sessions.Session) -> None: def _get_repo_root() -> Optional[str]: - """ Returns the root folder of the project. """ + """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()) for i in range(10): diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 1f422a0..c3ab9e0 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.0.1 +pytest==7.1.2 google-cloud-testutils==1.3.1 \ No newline at end of file diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 9b6b9a1..1bd8e9f 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-bigquery-connection==1.3.4 \ No newline at end of file +google-cloud-bigquery-connection==1.4.0 \ No newline at end of file diff --git a/scripts/fixup_bigquery_connection_v1_keywords.py b/scripts/fixup_bigquery_connection_v1_keywords.py index 4faa6a7..8330017 100644 --- a/scripts/fixup_bigquery_connection_v1_keywords.py +++ b/scripts/fixup_bigquery_connection_v1_keywords.py @@ -44,7 +44,7 @@ class bigquery_connectionCallTransformer(cst.CSTTransformer): 'get_connection': ('name', ), 'get_iam_policy': ('resource', 'options', ), 'list_connections': ('parent', 'page_size', 'page_token', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy', 'update_mask', ), 'test_iam_permissions': ('resource', 'permissions', ), 'update_connection': ('name', 'connection', 'update_mask', ), } diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 9c0bb43..83ee3b9 100644 --- a/setup.py +++ b/setup.py @@ -17,9 +17,10 @@ import io import os + import setuptools # type: ignore -version = "1.4.0" +version = "1.5.0" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -49,7 +50,7 @@ # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "proto-plus >= 1.15.0", - "grpc-google-iam-v1 >= 0.12.3, < 0.13.0dev", + "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", ), python_requires=">=3.6", classifiers=[ diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index fca766f..ca8aeff 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,4 +7,4 @@ # Then this file should have foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 -grpc-google-iam-v1==0.12.3 +grpc-google-iam-v1==0.12.4 diff --git a/testing/test-env.tmpl.sh b/testing/test-env.tmpl.sh new file mode 100644 index 0000000..67962ef --- /dev/null +++ b/testing/test-env.tmpl.sh @@ -0,0 +1,110 @@ +# Copyright 2022 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 +# +# 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. + +# Environment variables for system tests. +export GOOGLE_CLOUD_PROJECT=your-project-id +export GCP_PROJECT=$GOOGLE_CLOUD_PROJECT +export FIRESTORE_PROJECT= + +export CLOUD_STORAGE_BUCKET=$GOOGLE_CLOUD_PROJECT +export REQUESTER_PAYS_TEST_BUCKET="${CLOUD_STORAGE_BUCKET}-requester-pays-test" +export API_KEY= +export BIGTABLE_CLUSTER=bigtable-test +export BIGTABLE_ZONE=us-central1-c +export BIGTABLE_INSTANCE= +export SPANNER_INSTANCE= +export COMPOSER_LOCATION=us-central1 +export COMPOSER_ENVIRONMENT= +export COMPOSER2_ENVIRONMENT= +# Webserver for COMPOSER2_ENVIRONMENT +export COMPOSER2_WEB_SERVER_URL= +export CLOUD_KMS_KEY= + +export MYSQL_INSTANCE= +export MYSQL_INSTANCE_ID= +export MYSQL_INSTANCE_LOCATION= +export MYSQL_USER= +export MYSQL_PASSWORD= +export MYSQL_DATABASE= +export MYSQL_HOST=localhost:3306 +export POSTGRES_INSTANCE= +export POSTGRES_USER= +export POSTGRES_PASSWORD= +export POSTGRES_DATABASE= +export POSTGRES_HOST=localhost:5432 +export SQLSERVER_INSTANCE= +export SQLSERVER_USER= +export SQLSERVER_PASSWORD= +export SQLSERVER_DATABASE= +export SQLSERVER_HOST=127.0.0.1:1433 +export DB_SOCKET_DIR= + +export KG_API_KEY= +export SLACK_TEST_SIGNATURE= +export SLACK_SECRET= +export FUNCTIONS_TOPIC= + +# Service account for HMAC samples +export HMAC_KEY_TEST_SERVICE_ACCOUNT= + +# Environment variables for App Engine Flexible system tests. +export GA_TRACKING_ID= +export SQLALCHEMY_DATABASE_URI=sqlite:// +export PUBSUB_TOPIC=gae-mvm-pubsub-topic +export PUBSUB_VERIFICATION_TOKEN=1234abc + +# Secret Manager Test Vars +export GCLOUD_SECRETS_SERVICE_ACCOUNT= + +# Automl +# A centralized project is used to remove duplicate work across all 7 languages +# and reduce the management of these resources. +# https://docs.google.com/document/d/1-E7zTNqBm9ex7XIOhzMHCupwKWieyMKgAVwrRK5JTVY +export AUTOML_PROJECT_ID= + +export ENTITY_EXTRACTION_DATASET_ID= +export ENTITY_EXTRACTION_MODEL_ID= + +export SENTIMENT_ANALYSIS_DATASET_ID= +export SENTIMENT_ANALYSIS_MODEL_ID= + +export TEXT_CLASSIFICATION_DATASET_ID= +export TEXT_CLASSIFICATION_MODEL_ID= + +export TRANSLATION_DATASET_ID= +export TRANSLATION_MODEL_ID= + +export VISION_CLASSIFICATION_DATASET_ID= +export VISION_CLASSIFICATION_MODEL_ID= + +export OBJECT_DETECTION_DATASET_ID= +# AutoML model takes 8-24 hours to create, having predefined +# and centralized models remove duplicate work across all languages. +export OBJECT_DETECTION_MODEL_ID= + +# For git operations in the test driver(testing/run_tests.sh). +# These are optional, but for avoiding flakes in Kokoro builds. +export GITHUB_ACCESS_TOKEN= +export GITHUB_USERNAME= + +# Cloud Run +# For run/idp example, a Firebase IDP token +export IDP_KEY= +# For run/filesystem +export IP_ADDRESS= +export CONNECTOR= + +# Dialogflow examples. +export SMART_REPLY_MODEL= +export SMART_REPLY_ALLOWLIST= \ No newline at end of file diff --git a/tests/system.py b/tests/system.py index 10c4b38..b18a93e 100644 --- a/tests/system.py +++ b/tests/system.py @@ -15,6 +15,7 @@ # limitations under the License. import os + import pytest from google.cloud import bigquery_connection diff --git a/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py b/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py index af9c959..4cb846b 100644 --- a/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py +++ b/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py @@ -13,41 +13,35 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.bigquery_connection_v1.services.connection_service import ( - ConnectionServiceAsyncClient, -) -from google.cloud.bigquery_connection_v1.services.connection_service import ( - ConnectionServiceClient, -) -from google.cloud.bigquery_connection_v1.services.connection_service import pagers -from google.cloud.bigquery_connection_v1.services.connection_service import transports -from google.cloud.bigquery_connection_v1.types import connection -from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import options_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore from google.type import expr_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.bigquery_connection_v1.services.connection_service import ( + ConnectionServiceAsyncClient, + ConnectionServiceClient, + pagers, + transports, +) +from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection +from google.cloud.bigquery_connection_v1.types import connection def client_cert_source_callback(): @@ -96,20 +90,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ConnectionServiceClient, ConnectionServiceAsyncClient,] + "client_class,transport_name", + [ + (ConnectionServiceClient, "grpc"), + (ConnectionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_connection_service_client_from_service_account_info(client_class): +def test_connection_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigqueryconnection.googleapis.com:443" + assert client.transport._host == ("bigqueryconnection.googleapis.com:443") @pytest.mark.parametrize( @@ -138,23 +138,33 @@ def test_connection_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ConnectionServiceClient, ConnectionServiceAsyncClient,] + "client_class,transport_name", + [ + (ConnectionServiceClient, "grpc"), + (ConnectionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_connection_service_client_from_service_account_file(client_class): +def test_connection_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigqueryconnection.googleapis.com:443" + assert client.transport._host == ("bigqueryconnection.googleapis.com:443") def test_connection_service_client_get_transport_class(): @@ -512,7 +522,9 @@ def test_connection_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -656,11 +668,16 @@ def test_connection_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [gcbc_connection.CreateConnectionRequest, dict,] + "request_type", + [ + gcbc_connection.CreateConnectionRequest, + dict, + ], ) def test_create_connection(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -704,7 +721,8 @@ def test_create_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -723,7 +741,8 @@ async def test_create_connection_async( request_type=gcbc_connection.CreateConnectionRequest, ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -768,13 +787,15 @@ async def test_create_connection_async_from_dict(): def test_create_connection_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcbc_connection.CreateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -790,7 +811,10 @@ def test_create_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -803,7 +827,7 @@ async def test_create_connection_field_headers_async(): # a field header. Set these to a non-empty value. request = gcbc_connection.CreateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -821,11 +845,16 @@ async def test_create_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_connection_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -857,7 +886,9 @@ def test_create_connection_flattened(): def test_create_connection_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -926,10 +957,17 @@ async def test_create_connection_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [connection.GetConnectionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + connection.GetConnectionRequest, + dict, + ], +) def test_get_connection(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -969,7 +1007,8 @@ def test_get_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -985,7 +1024,8 @@ async def test_get_connection_async( transport: str = "grpc_asyncio", request_type=connection.GetConnectionRequest ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1028,13 +1068,15 @@ async def test_get_connection_async_from_dict(): def test_get_connection_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = connection.GetConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_connection), "__call__") as call: @@ -1048,7 +1090,10 @@ def test_get_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1061,7 +1106,7 @@ async def test_get_connection_field_headers_async(): # a field header. Set these to a non-empty value. request = connection.GetConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_connection), "__call__") as call: @@ -1077,11 +1122,16 @@ async def test_get_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_connection_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_connection), "__call__") as call: @@ -1089,7 +1139,9 @@ def test_get_connection_flattened(): call.return_value = connection.Connection() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_connection(name="name_value",) + client.get_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1101,13 +1153,16 @@ def test_get_connection_flattened(): def test_get_connection_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_connection( - connection.GetConnectionRequest(), name="name_value", + connection.GetConnectionRequest(), + name="name_value", ) @@ -1127,7 +1182,9 @@ async def test_get_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_connection(name="name_value",) + response = await client.get_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1148,14 +1205,22 @@ async def test_get_connection_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_connection( - connection.GetConnectionRequest(), name="name_value", + connection.GetConnectionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [connection.ListConnectionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + connection.ListConnectionsRequest, + dict, + ], +) def test_list_connections(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1184,7 +1249,8 @@ def test_list_connections_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1200,7 +1266,8 @@ async def test_list_connections_async( transport: str = "grpc_asyncio", request_type=connection.ListConnectionsRequest ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1211,7 +1278,9 @@ async def test_list_connections_async( with mock.patch.object(type(client.transport.list_connections), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - connection.ListConnectionsResponse(next_page_token="next_page_token_value",) + connection.ListConnectionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_connections(request) @@ -1231,13 +1300,15 @@ async def test_list_connections_async_from_dict(): def test_list_connections_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = connection.ListConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_connections), "__call__") as call: @@ -1251,7 +1322,10 @@ def test_list_connections_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1264,7 +1338,7 @@ async def test_list_connections_field_headers_async(): # a field header. Set these to a non-empty value. request = connection.ListConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_connections), "__call__") as call: @@ -1280,11 +1354,16 @@ async def test_list_connections_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_connections_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_connections), "__call__") as call: @@ -1292,7 +1371,9 @@ def test_list_connections_flattened(): call.return_value = connection.ListConnectionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_connections(parent="parent_value",) + client.list_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1304,13 +1385,16 @@ def test_list_connections_flattened(): def test_list_connections_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_connections( - connection.ListConnectionsRequest(), parent="parent_value", + connection.ListConnectionsRequest(), + parent="parent_value", ) @@ -1330,7 +1414,9 @@ async def test_list_connections_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_connections(parent="parent_value",) + response = await client.list_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1351,13 +1437,15 @@ async def test_list_connections_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_connections( - connection.ListConnectionsRequest(), parent="parent_value", + connection.ListConnectionsRequest(), + parent="parent_value", ) def test_list_connections_pager(transport_name: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1372,12 +1460,21 @@ def test_list_connections_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - connection.ListConnectionsResponse(connections=[], next_page_token="def",), connection.ListConnectionsResponse( - connections=[connection.Connection(),], next_page_token="ghi", + connections=[], + next_page_token="def", ), connection.ListConnectionsResponse( - connections=[connection.Connection(), connection.Connection(),], + connections=[ + connection.Connection(), + ], + next_page_token="ghi", + ), + connection.ListConnectionsResponse( + connections=[ + connection.Connection(), + connection.Connection(), + ], ), RuntimeError, ) @@ -1390,14 +1487,15 @@ def test_list_connections_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, connection.Connection) for i in results) def test_list_connections_pages(transport_name: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1412,12 +1510,21 @@ def test_list_connections_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - connection.ListConnectionsResponse(connections=[], next_page_token="def",), connection.ListConnectionsResponse( - connections=[connection.Connection(),], next_page_token="ghi", + connections=[], + next_page_token="def", + ), + connection.ListConnectionsResponse( + connections=[ + connection.Connection(), + ], + next_page_token="ghi", ), connection.ListConnectionsResponse( - connections=[connection.Connection(), connection.Connection(),], + connections=[ + connection.Connection(), + connection.Connection(), + ], ), RuntimeError, ) @@ -1446,19 +1553,30 @@ async def test_list_connections_async_pager(): ], next_page_token="abc", ), - connection.ListConnectionsResponse(connections=[], next_page_token="def",), connection.ListConnectionsResponse( - connections=[connection.Connection(),], next_page_token="ghi", + connections=[], + next_page_token="def", ), connection.ListConnectionsResponse( - connections=[connection.Connection(), connection.Connection(),], + connections=[ + connection.Connection(), + ], + next_page_token="ghi", + ), + connection.ListConnectionsResponse( + connections=[ + connection.Connection(), + connection.Connection(), + ], ), RuntimeError, ) - async_pager = await client.list_connections(request={},) + async_pager = await client.list_connections( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1485,28 +1603,44 @@ async def test_list_connections_async_pages(): ], next_page_token="abc", ), - connection.ListConnectionsResponse(connections=[], next_page_token="def",), connection.ListConnectionsResponse( - connections=[connection.Connection(),], next_page_token="ghi", + connections=[], + next_page_token="def", ), connection.ListConnectionsResponse( - connections=[connection.Connection(), connection.Connection(),], + connections=[ + connection.Connection(), + ], + next_page_token="ghi", + ), + connection.ListConnectionsResponse( + connections=[ + connection.Connection(), + connection.Connection(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_connections(request={})).pages: + async for page_ in ( + await client.list_connections(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [gcbc_connection.UpdateConnectionRequest, dict,] + "request_type", + [ + gcbc_connection.UpdateConnectionRequest, + dict, + ], ) def test_update_connection(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1550,7 +1684,8 @@ def test_update_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1569,7 +1704,8 @@ async def test_update_connection_async( request_type=gcbc_connection.UpdateConnectionRequest, ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1614,13 +1750,15 @@ async def test_update_connection_async_from_dict(): def test_update_connection_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcbc_connection.UpdateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1636,7 +1774,10 @@ def test_update_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1649,7 +1790,7 @@ async def test_update_connection_field_headers_async(): # a field header. Set these to a non-empty value. request = gcbc_connection.UpdateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1667,11 +1808,16 @@ async def test_update_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_update_connection_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1703,7 +1849,9 @@ def test_update_connection_flattened(): def test_update_connection_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1772,10 +1920,17 @@ async def test_update_connection_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [connection.DeleteConnectionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + connection.DeleteConnectionRequest, + dict, + ], +) def test_delete_connection(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1803,7 +1958,8 @@ def test_delete_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1821,7 +1977,8 @@ async def test_delete_connection_async( transport: str = "grpc_asyncio", request_type=connection.DeleteConnectionRequest ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1851,13 +2008,15 @@ async def test_delete_connection_async_from_dict(): def test_delete_connection_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = connection.DeleteConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1873,7 +2032,10 @@ def test_delete_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1886,7 +2048,7 @@ async def test_delete_connection_field_headers_async(): # a field header. Set these to a non-empty value. request = connection.DeleteConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1902,11 +2064,16 @@ async def test_delete_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_connection_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1916,7 +2083,9 @@ def test_delete_connection_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_connection(name="name_value",) + client.delete_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1928,13 +2097,16 @@ def test_delete_connection_flattened(): def test_delete_connection_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_connection( - connection.DeleteConnectionRequest(), name="name_value", + connection.DeleteConnectionRequest(), + name="name_value", ) @@ -1954,7 +2126,9 @@ async def test_delete_connection_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_connection(name="name_value",) + response = await client.delete_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1975,14 +2149,22 @@ async def test_delete_connection_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_connection( - connection.DeleteConnectionRequest(), name="name_value", + connection.DeleteConnectionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1992,7 +2174,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -2010,7 +2195,8 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2026,7 +2212,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2037,7 +2224,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -2058,13 +2248,15 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2078,7 +2270,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2091,7 +2286,7 @@ async def test_get_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2105,11 +2300,16 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2124,7 +2324,9 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2132,7 +2334,9 @@ def test_get_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_iam_policy(resource="resource_value",) + client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2144,13 +2348,16 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) @@ -2168,7 +2375,9 @@ async def test_get_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_iam_policy(resource="resource_value",) + response = await client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2189,14 +2398,22 @@ async def test_get_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2206,7 +2423,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -2224,7 +2444,8 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2240,7 +2461,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2251,7 +2473,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -2272,13 +2497,15 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2292,7 +2519,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2305,7 +2535,7 @@ async def test_set_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2319,11 +2549,16 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2332,13 +2567,16 @@ def test_set_iam_policy_from_dict_foreign(): request={ "resource": "resource_value", "policy": policy_pb2.Policy(version=774), + "update_mask": field_mask_pb2.FieldMask(paths=["paths_value"]), } ) call.assert_called() def test_set_iam_policy_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2346,7 +2584,9 @@ def test_set_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.set_iam_policy(resource="resource_value",) + client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2358,13 +2598,16 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @@ -2382,7 +2625,9 @@ async def test_set_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.set_iam_policy(resource="resource_value",) + response = await client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2403,16 +2648,22 @@ async def test_set_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2443,7 +2694,8 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2462,7 +2714,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2497,13 +2750,15 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2519,7 +2774,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2532,7 +2790,7 @@ async def test_test_iam_permissions_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2550,11 +2808,16 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.test_iam_permissions), "__call__" @@ -2571,7 +2834,9 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2582,7 +2847,8 @@ def test_test_iam_permissions_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -2598,7 +2864,9 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2629,7 +2897,8 @@ async def test_test_iam_permissions_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -2667,7 +2936,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2687,7 +2957,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ConnectionServiceClient(client_options=options, transport=transport,) + client = ConnectionServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2703,7 +2976,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ConnectionServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2746,10 +3020,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ConnectionServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ConnectionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ConnectionServiceGrpcTransport,) + client = ConnectionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ConnectionServiceGrpcTransport, + ) def test_connection_service_base_transport_error(): @@ -2790,6 +3082,14 @@ def test_connection_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_connection_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2801,7 +3101,8 @@ def test_connection_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ConnectionServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2946,24 +3247,40 @@ def test_connection_service_grpc_transport_client_cert_source_for_mtls(transport ) -def test_connection_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_connection_service_host_no_port(transport_name): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigqueryconnection.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "bigqueryconnection.googleapis.com:443" + assert client.transport._host == ("bigqueryconnection.googleapis.com:443") -def test_connection_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_connection_service_host_with_port(transport_name): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigqueryconnection.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "bigqueryconnection.googleapis.com:8000" + assert client.transport._host == ("bigqueryconnection.googleapis.com:8000") def test_connection_service_grpc_transport_channel(): @@ -2971,7 +3288,8 @@ def test_connection_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ConnectionServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2983,7 +3301,8 @@ def test_connection_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ConnectionServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3094,8 +3413,12 @@ def test_connection_path(): project = "squid" location = "clam" connection = "whelk" - expected = "projects/{project}/locations/{location}/connections/{connection}".format( - project=project, location=location, connection=connection, + expected = ( + "projects/{project}/locations/{location}/connections/{connection}".format( + project=project, + location=location, + connection=connection, + ) ) actual = ConnectionServiceClient.connection_path(project, location, connection) assert expected == actual @@ -3136,7 +3459,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ConnectionServiceClient.common_folder_path(folder) assert expected == actual @@ -3154,7 +3479,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ConnectionServiceClient.common_organization_path(organization) assert expected == actual @@ -3172,7 +3499,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ConnectionServiceClient.common_project_path(project) assert expected == actual @@ -3192,7 +3521,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ConnectionServiceClient.common_location_path(project, location) assert expected == actual @@ -3217,7 +3547,8 @@ def test_client_with_default_client_info(): transports.ConnectionServiceTransport, "_prep_wrapped_messages" ) as prep: client = ConnectionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3226,7 +3557,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ConnectionServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3234,7 +3566,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ConnectionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"