diff --git a/google/cloud/run_v2/services/revisions/async_client.py b/google/cloud/run_v2/services/revisions/async_client.py index 3455cb5..1f4e6cc 100644 --- a/google/cloud/run_v2/services/revisions/async_client.py +++ b/google/cloud/run_v2/services/revisions/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -325,7 +325,6 @@ async def list_revisions( r"""List Revisions from a given Service, or from a given location. - .. code-block:: python from google.cloud import run_v2 diff --git a/google/cloud/run_v2/services/revisions/client.py b/google/cloud/run_v2/services/revisions/client.py index 56e7433..378aa58 100644 --- a/google/cloud/run_v2/services/revisions/client.py +++ b/google/cloud/run_v2/services/revisions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -652,7 +652,6 @@ def list_revisions( r"""List Revisions from a given Service, or from a given location. - .. code-block:: python from google.cloud import run_v2 diff --git a/google/cloud/run_v2/services/revisions/transports/base.py b/google/cloud/run_v2/services/revisions/transports/base.py index 063378e..af36691 100644 --- a/google/cloud/run_v2/services/revisions/transports/base.py +++ b/google/cloud/run_v2/services/revisions/transports/base.py @@ -82,6 +82,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" @@ -182,5 +183,9 @@ def delete_revision( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("RevisionsTransport",) diff --git a/google/cloud/run_v2/services/revisions/transports/grpc.py b/google/cloud/run_v2/services/revisions/transports/grpc.py index 1f9bbd5..0755113 100644 --- a/google/cloud/run_v2/services/revisions/transports/grpc.py +++ b/google/cloud/run_v2/services/revisions/transports/grpc.py @@ -326,5 +326,9 @@ def delete_revision( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("RevisionsGrpcTransport",) diff --git a/google/cloud/run_v2/services/services/async_client.py b/google/cloud/run_v2/services/services/async_client.py index c229069..5ba28db 100644 --- a/google/cloud/run_v2/services/services/async_client.py +++ b/google/cloud/run_v2/services/services/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -230,7 +230,6 @@ async def create_service( r"""Creates a new Service in a given project and location. - .. code-block:: python from google.cloud import run_v2 @@ -443,7 +442,7 @@ def sample_get_service(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=10.0, ), @@ -554,7 +553,7 @@ def sample_list_services(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=10.0, ), @@ -722,7 +721,6 @@ async def delete_service( This will cause the Service to stop serving traffic and will delete all revisions. - .. code-block:: python from google.cloud import run_v2 @@ -839,7 +837,6 @@ async def get_iam_policy( for the given Cloud Run Service. This result does not include any inherited policies. - .. code-block:: python from google.cloud import run_v2 @@ -871,21 +868,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": [ @@ -900,17 +902,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 - @@ -921,11 +923,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. @@ -970,7 +973,6 @@ async def set_iam_policy( r"""Sets the IAM Access control policy for the specified Service. Overwrites any existing policy. - .. code-block:: python from google.cloud import run_v2 @@ -1002,21 +1004,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": [ @@ -1031,17 +1038,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 - @@ -1052,11 +1059,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. @@ -1103,7 +1111,6 @@ async def test_iam_permissions( There are no permissions required for making this API call. - .. code-block:: python from google.cloud import run_v2 diff --git a/google/cloud/run_v2/services/services/client.py b/google/cloud/run_v2/services/services/client.py index 2e52170..21522ed 100644 --- a/google/cloud/run_v2/services/services/client.py +++ b/google/cloud/run_v2/services/services/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -559,7 +559,6 @@ def create_service( r"""Creates a new Service in a given project and location. - .. code-block:: python from google.cloud import run_v2 @@ -1033,7 +1032,6 @@ def delete_service( This will cause the Service to stop serving traffic and will delete all revisions. - .. code-block:: python from google.cloud import run_v2 @@ -1150,7 +1148,6 @@ def get_iam_policy( for the given Cloud Run Service. This result does not include any inherited policies. - .. code-block:: python from google.cloud import run_v2 @@ -1182,21 +1179,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": [ @@ -1211,17 +1213,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 - @@ -1232,11 +1234,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. @@ -1280,7 +1283,6 @@ def set_iam_policy( r"""Sets the IAM Access control policy for the specified Service. Overwrites any existing policy. - .. code-block:: python from google.cloud import run_v2 @@ -1312,21 +1314,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": [ @@ -1341,17 +1348,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 - @@ -1362,11 +1369,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. @@ -1412,7 +1420,6 @@ def test_iam_permissions( There are no permissions required for making this API call. - .. code-block:: python from google.cloud import run_v2 diff --git a/google/cloud/run_v2/services/services/transports/base.py b/google/cloud/run_v2/services/services/transports/base.py index fb9473e..79866ea 100644 --- a/google/cloud/run_v2/services/services/transports/base.py +++ b/google/cloud/run_v2/services/services/transports/base.py @@ -85,6 +85,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" @@ -137,7 +138,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=10.0, ), @@ -151,7 +152,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=10.0, ), @@ -273,5 +274,9 @@ def test_iam_permissions( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ServicesTransport",) diff --git a/google/cloud/run_v2/services/services/transports/grpc.py b/google/cloud/run_v2/services/services/transports/grpc.py index e77332d..0c0daf0 100644 --- a/google/cloud/run_v2/services/services/transports/grpc.py +++ b/google/cloud/run_v2/services/services/transports/grpc.py @@ -468,5 +468,9 @@ def test_iam_permissions( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ServicesGrpcTransport",) diff --git a/google/cloud/run_v2/types/__init__.py b/google/cloud/run_v2/types/__init__.py index 4ab6c3f..5a6b804 100644 --- a/google/cloud/run_v2/types/__init__.py +++ b/google/cloud/run_v2/types/__init__.py @@ -13,7 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .condition import Condition +from .condition import ( + Condition, +) from .k8s_min import ( CloudSqlInstance, Container, @@ -34,7 +36,9 @@ ListRevisionsResponse, Revision, ) -from .revision_template import RevisionTemplate +from .revision_template import ( + RevisionTemplate, +) from .service import ( CreateServiceRequest, DeleteServiceRequest, diff --git a/google/cloud/run_v2/types/k8s_min.py b/google/cloud/run_v2/types/k8s_min.py index 2ed4a37..e1be020 100644 --- a/google/cloud/run_v2/types/k8s_min.py +++ b/google/cloud/run_v2/types/k8s_min.py @@ -133,7 +133,7 @@ class ResourceRequirements(proto.Message): requirements. Attributes: - limits (Sequence[google.cloud.run_v2.types.ResourceRequirements.LimitsEntry]): + limits (Mapping[str, str]): Only memory and CPU are supported. Note: The only supported values for CPU are '1', '2', and '4'. Setting 4 CPU requires at least 2Gi of diff --git a/google/cloud/run_v2/types/revision.py b/google/cloud/run_v2/types/revision.py index dd2f6d0..d0670ec 100644 --- a/google/cloud/run_v2/types/revision.py +++ b/google/cloud/run_v2/types/revision.py @@ -169,7 +169,7 @@ class Revision(proto.Message): Output only. A number that monotonically increases every time the user modifies the desired state. - labels (Sequence[google.cloud.run_v2.types.Revision.LabelsEntry]): + labels (Mapping[str, str]): KRM-style labels for the resource. User-provided labels are shared with Google's billing system, so they can be used to filter, @@ -183,7 +183,7 @@ class Revision(proto.Message): 'run.googleapis.com' or 'serving.knative.dev' namespaces. Those labels are read-only, and user changes will not be preserved. - annotations (Sequence[google.cloud.run_v2.types.Revision.AnnotationsEntry]): + annotations (Mapping[str, str]): KRM-style annotations for the resource. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The creation time. diff --git a/google/cloud/run_v2/types/revision_template.py b/google/cloud/run_v2/types/revision_template.py index 22066b2..a526b82 100644 --- a/google/cloud/run_v2/types/revision_template.py +++ b/google/cloud/run_v2/types/revision_template.py @@ -37,9 +37,9 @@ class RevisionTemplate(proto.Message): The unique name for the revision. If this field is omitted, it will be automatically generated based on the Service name. - labels (Sequence[google.cloud.run_v2.types.RevisionTemplate.LabelsEntry]): + labels (Mapping[str, str]): KRM-style labels for the resource. - annotations (Sequence[google.cloud.run_v2.types.RevisionTemplate.AnnotationsEntry]): + annotations (Mapping[str, str]): KRM-style annotations for the resource. scaling (google.cloud.run_v2.types.RevisionScaling): Scaling settings for this Revision. diff --git a/google/cloud/run_v2/types/service.py b/google/cloud/run_v2/types/service.py index bd8e1dd..3a77ee4 100644 --- a/google/cloud/run_v2/types/service.py +++ b/google/cloud/run_v2/types/service.py @@ -258,7 +258,7 @@ class Service(proto.Message): Output only. A number that monotonically increases every time the user modifies the desired state. - labels (Sequence[google.cloud.run_v2.types.Service.LabelsEntry]): + labels (Mapping[str, str]): Map of string keys and values that can be used to organize and categorize objects. User-provided labels are shared with Google's @@ -273,7 +273,7 @@ class Service(proto.Message): 'run.googleapis.com' or 'serving.knative.dev' namespaces. Those labels are read-only, and user changes will not be preserved. - annotations (Sequence[google.cloud.run_v2.types.Service.AnnotationsEntry]): + annotations (Mapping[str, str]): Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved diff --git a/scripts/fixup_run_v2_keywords.py b/scripts/fixup_run_v2_keywords.py index 18d2094..aef6ae6 100644 --- a/scripts/fixup_run_v2_keywords.py +++ b/scripts/fixup_run_v2_keywords.py @@ -47,7 +47,7 @@ class runCallTransformer(cst.CSTTransformer): 'get_service': ('name', ), 'list_revisions': ('parent', 'page_size', 'page_token', 'show_deleted', ), 'list_services': ('parent', 'page_size', 'page_token', 'show_deleted', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy', 'update_mask', ), 'test_iam_permissions': ('resource', 'permissions', ), 'update_service': ('service', 'update_mask', 'validate_only', 'allow_missing', ), } diff --git a/setup.py b/setup.py index dd11da3..0d667ac 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "proto-plus >= 1.15.0", "googleapis-common-protos >= 1.56.0", - "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", + "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index c1b4ea6..a0c021a 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,4 +7,4 @@ google-api-core==1.31.5 proto-plus==1.15.0 googleapis-common-protos==1.56.0 -grpc-google-iam-v1==0.12.3 +grpc-google-iam-v1==0.12.4 diff --git a/tests/unit/gapic/run_v2/test_revisions.py b/tests/unit/gapic/run_v2/test_revisions.py index a6a9c7c..7a67476 100644 --- a/tests/unit/gapic/run_v2/test_revisions.py +++ b/tests/unit/gapic/run_v2/test_revisions.py @@ -1652,6 +1652,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = RevisionsClient.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 = RevisionsClient( @@ -1701,6 +1714,14 @@ def test_revisions_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_revisions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file diff --git a/tests/unit/gapic/run_v2/test_services.py b/tests/unit/gapic/run_v2/test_services.py index 788855a..79098db 100644 --- a/tests/unit/gapic/run_v2/test_services.py +++ b/tests/unit/gapic/run_v2/test_services.py @@ -2378,6 +2378,7 @@ 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() @@ -2654,6 +2655,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ServicesClient.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 = ServicesClient( @@ -2708,6 +2722,14 @@ def test_services_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_services_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file