From e953f26ed41a16654bd56939ece7617984a6717c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 00:04:31 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#132) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .../.github/.OwlBot.lock.yaml | 2 +- packages/google-cloud-gke-hub/docs/conf.py | 5 +- .../types/configmanagement.py | 393 ++++++-- .../types/multiclusteringress.py | 10 +- .../services/gke_hub/async_client.py | 91 +- .../gkehub_v1/services/gke_hub/client.py | 156 ++- .../services/gke_hub/transports/base.py | 50 +- .../services/gke_hub/transports/grpc.py | 3 +- .../google/cloud/gkehub_v1/types/feature.py | 88 +- .../cloud/gkehub_v1/types/membership.py | 185 +++- .../google/cloud/gkehub_v1/types/service.py | 289 ++++-- .../async_client.py | 65 +- .../gke_hub_membership_service/client.py | 118 ++- .../transports/base.py | 30 +- .../transports/grpc.py | 3 +- .../cloud/gkehub_v1beta1/types/membership.py | 492 +++++++-- packages/google-cloud-gke-hub/noxfile.py | 9 +- .../unit/gapic/gkehub_v1/test_gke_hub.py | 933 +++++++++++++----- .../test_gke_hub_membership_service.py | 418 ++++++-- 19 files changed, 2625 insertions(+), 715 deletions(-) diff --git a/packages/google-cloud-gke-hub/.github/.OwlBot.lock.yaml b/packages/google-cloud-gke-hub/.github/.OwlBot.lock.yaml index 44c78f7cc12d..87dd00611576 100644 --- a/packages/google-cloud-gke-hub/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-gke-hub/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/packages/google-cloud-gke-hub/docs/conf.py b/packages/google-cloud-gke-hub/docs/conf.py index e6a076b26c4c..128ca9ca2132 100644 --- a/packages/google-cloud-gke-hub/docs/conf.py +++ b/packages/google-cloud-gke-hub/docs/conf.py @@ -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/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/configmanagement_v1/types/configmanagement.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/configmanagement_v1/types/configmanagement.py index d1d7e6989157..69321919b81b 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/configmanagement_v1/types/configmanagement.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/configmanagement_v1/types/configmanagement.py @@ -83,15 +83,34 @@ class MembershipState(proto.Message): Hierarchy Controller status """ - cluster_name = proto.Field(proto.STRING, number=1,) - membership_spec = proto.Field(proto.MESSAGE, number=2, message="MembershipSpec",) - operator_state = proto.Field(proto.MESSAGE, number=3, message="OperatorState",) - config_sync_state = proto.Field(proto.MESSAGE, number=4, message="ConfigSyncState",) + cluster_name = proto.Field( + proto.STRING, + number=1, + ) + membership_spec = proto.Field( + proto.MESSAGE, + number=2, + message="MembershipSpec", + ) + operator_state = proto.Field( + proto.MESSAGE, + number=3, + message="OperatorState", + ) + config_sync_state = proto.Field( + proto.MESSAGE, + number=4, + message="ConfigSyncState", + ) policy_controller_state = proto.Field( - proto.MESSAGE, number=5, message="PolicyControllerState", + proto.MESSAGE, + number=5, + message="PolicyControllerState", ) hierarchy_controller_state = proto.Field( - proto.MESSAGE, number=7, message="HierarchyControllerState", + proto.MESSAGE, + number=7, + message="HierarchyControllerState", ) @@ -112,14 +131,25 @@ class MembershipSpec(proto.Message): Version of ACM installed. """ - config_sync = proto.Field(proto.MESSAGE, number=1, message="ConfigSync",) + config_sync = proto.Field( + proto.MESSAGE, + number=1, + message="ConfigSync", + ) policy_controller = proto.Field( - proto.MESSAGE, number=2, message="PolicyController", + proto.MESSAGE, + number=2, + message="PolicyController", ) hierarchy_controller = proto.Field( - proto.MESSAGE, number=4, message="HierarchyControllerConfig", + proto.MESSAGE, + number=4, + message="HierarchyControllerConfig", + ) + version = proto.Field( + proto.STRING, + number=10, ) - version = proto.Field(proto.STRING, number=10,) class ConfigSync(proto.Message): @@ -133,8 +163,15 @@ class ConfigSync(proto.Message): in “hierarchical” or “unstructured” mode. """ - git = proto.Field(proto.MESSAGE, number=7, message="GitConfig",) - source_format = proto.Field(proto.STRING, number=8,) + git = proto.Field( + proto.MESSAGE, + number=7, + message="GitConfig", + ) + source_format = proto.Field( + proto.STRING, + number=8, + ) class GitConfig(proto.Message): @@ -168,14 +205,38 @@ class GitConfig(proto.Message): is gcpServiceAccount. """ - sync_repo = proto.Field(proto.STRING, number=1,) - sync_branch = proto.Field(proto.STRING, number=2,) - policy_dir = proto.Field(proto.STRING, number=3,) - sync_wait_secs = proto.Field(proto.INT64, number=4,) - sync_rev = proto.Field(proto.STRING, number=5,) - secret_type = proto.Field(proto.STRING, number=6,) - https_proxy = proto.Field(proto.STRING, number=7,) - gcp_service_account_email = proto.Field(proto.STRING, number=8,) + sync_repo = proto.Field( + proto.STRING, + number=1, + ) + sync_branch = proto.Field( + proto.STRING, + number=2, + ) + policy_dir = proto.Field( + proto.STRING, + number=3, + ) + sync_wait_secs = proto.Field( + proto.INT64, + number=4, + ) + sync_rev = proto.Field( + proto.STRING, + number=5, + ) + secret_type = proto.Field( + proto.STRING, + number=6, + ) + https_proxy = proto.Field( + proto.STRING, + number=7, + ) + gcp_service_account_email = proto.Field( + proto.STRING, + number=8, + ) class PolicyController(proto.Message): @@ -211,12 +272,32 @@ class PolicyController(proto.Message): Logs all denies and dry run failures. """ - enabled = proto.Field(proto.BOOL, number=1,) - template_library_installed = proto.Field(proto.BOOL, number=2, optional=True,) - audit_interval_seconds = proto.Field(proto.INT64, number=3, optional=True,) - exemptable_namespaces = proto.RepeatedField(proto.STRING, number=4,) - referential_rules_enabled = proto.Field(proto.BOOL, number=5,) - log_denies_enabled = proto.Field(proto.BOOL, number=6,) + enabled = proto.Field( + proto.BOOL, + number=1, + ) + template_library_installed = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + audit_interval_seconds = proto.Field( + proto.INT64, + number=3, + optional=True, + ) + exemptable_namespaces = proto.RepeatedField( + proto.STRING, + number=4, + ) + referential_rules_enabled = proto.Field( + proto.BOOL, + number=5, + ) + log_denies_enabled = proto.Field( + proto.BOOL, + number=6, + ) class HierarchyControllerConfig(proto.Message): @@ -234,9 +315,18 @@ class HierarchyControllerConfig(proto.Message): enabled in this cluster. """ - enabled = proto.Field(proto.BOOL, number=1,) - enable_pod_tree_labels = proto.Field(proto.BOOL, number=2,) - enable_hierarchical_resource_quota = proto.Field(proto.BOOL, number=3,) + enabled = proto.Field( + proto.BOOL, + number=1, + ) + enable_pod_tree_labels = proto.Field( + proto.BOOL, + number=2, + ) + enable_hierarchical_resource_quota = proto.Field( + proto.BOOL, + number=3, + ) class HierarchyControllerDeploymentState(proto.Message): @@ -251,8 +341,16 @@ class HierarchyControllerDeploymentState(proto.Message): extension (e.g. v0.7.0-hc.1) """ - hnc = proto.Field(proto.ENUM, number=1, enum="DeploymentState",) - extension = proto.Field(proto.ENUM, number=2, enum="DeploymentState",) + hnc = proto.Field( + proto.ENUM, + number=1, + enum="DeploymentState", + ) + extension = proto.Field( + proto.ENUM, + number=2, + enum="DeploymentState", + ) class HierarchyControllerVersion(proto.Message): @@ -265,8 +363,14 @@ class HierarchyControllerVersion(proto.Message): Version for Hierarchy Controller extension """ - hnc = proto.Field(proto.STRING, number=1,) - extension = proto.Field(proto.STRING, number=2,) + hnc = proto.Field( + proto.STRING, + number=1, + ) + extension = proto.Field( + proto.STRING, + number=2, + ) class HierarchyControllerState(proto.Message): @@ -280,10 +384,14 @@ class HierarchyControllerState(proto.Message): """ version = proto.Field( - proto.MESSAGE, number=1, message="HierarchyControllerVersion", + proto.MESSAGE, + number=1, + message="HierarchyControllerVersion", ) state = proto.Field( - proto.MESSAGE, number=2, message="HierarchyControllerDeploymentState", + proto.MESSAGE, + number=2, + message="HierarchyControllerDeploymentState", ) @@ -299,9 +407,20 @@ class OperatorState(proto.Message): Install errors. """ - version = proto.Field(proto.STRING, number=1,) - deployment_state = proto.Field(proto.ENUM, number=2, enum="DeploymentState",) - errors = proto.RepeatedField(proto.MESSAGE, number=3, message="InstallError",) + version = proto.Field( + proto.STRING, + number=1, + ) + deployment_state = proto.Field( + proto.ENUM, + number=2, + enum="DeploymentState", + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="InstallError", + ) class InstallError(proto.Message): @@ -313,7 +432,10 @@ class InstallError(proto.Message): message """ - error_message = proto.Field(proto.STRING, number=1,) + error_message = proto.Field( + proto.STRING, + number=1, + ) class ConfigSyncState(proto.Message): @@ -331,11 +453,21 @@ class ConfigSyncState(proto.Message): configs to a cluster """ - version = proto.Field(proto.MESSAGE, number=1, message="ConfigSyncVersion",) + version = proto.Field( + proto.MESSAGE, + number=1, + message="ConfigSyncVersion", + ) deployment_state = proto.Field( - proto.MESSAGE, number=2, message="ConfigSyncDeploymentState", + proto.MESSAGE, + number=2, + message="ConfigSyncDeploymentState", + ) + sync_state = proto.Field( + proto.MESSAGE, + number=3, + message="SyncState", ) - sync_state = proto.Field(proto.MESSAGE, number=3, message="SyncState",) class ConfigSyncVersion(proto.Message): @@ -359,12 +491,30 @@ class ConfigSyncVersion(proto.Message): in root-reconciler pod """ - importer = proto.Field(proto.STRING, number=1,) - syncer = proto.Field(proto.STRING, number=2,) - git_sync = proto.Field(proto.STRING, number=3,) - monitor = proto.Field(proto.STRING, number=4,) - reconciler_manager = proto.Field(proto.STRING, number=5,) - root_reconciler = proto.Field(proto.STRING, number=6,) + importer = proto.Field( + proto.STRING, + number=1, + ) + syncer = proto.Field( + proto.STRING, + number=2, + ) + git_sync = proto.Field( + proto.STRING, + number=3, + ) + monitor = proto.Field( + proto.STRING, + number=4, + ) + reconciler_manager = proto.Field( + proto.STRING, + number=5, + ) + root_reconciler = proto.Field( + proto.STRING, + number=6, + ) class ConfigSyncDeploymentState(proto.Message): @@ -385,12 +535,36 @@ class ConfigSyncDeploymentState(proto.Message): Deployment state of root-reconciler """ - importer = proto.Field(proto.ENUM, number=1, enum="DeploymentState",) - syncer = proto.Field(proto.ENUM, number=2, enum="DeploymentState",) - git_sync = proto.Field(proto.ENUM, number=3, enum="DeploymentState",) - monitor = proto.Field(proto.ENUM, number=4, enum="DeploymentState",) - reconciler_manager = proto.Field(proto.ENUM, number=5, enum="DeploymentState",) - root_reconciler = proto.Field(proto.ENUM, number=6, enum="DeploymentState",) + importer = proto.Field( + proto.ENUM, + number=1, + enum="DeploymentState", + ) + syncer = proto.Field( + proto.ENUM, + number=2, + enum="DeploymentState", + ) + git_sync = proto.Field( + proto.ENUM, + number=3, + enum="DeploymentState", + ) + monitor = proto.Field( + proto.ENUM, + number=4, + enum="DeploymentState", + ) + reconciler_manager = proto.Field( + proto.ENUM, + number=5, + enum="DeploymentState", + ) + root_reconciler = proto.Field( + proto.ENUM, + number=6, + enum="DeploymentState", + ) class SyncState(proto.Message): @@ -433,15 +607,37 @@ class SyncCode(proto.Enum): UNAUTHORIZED = 6 UNREACHABLE = 7 - source_token = proto.Field(proto.STRING, number=1,) - import_token = proto.Field(proto.STRING, number=2,) - sync_token = proto.Field(proto.STRING, number=3,) - last_sync = proto.Field(proto.STRING, number=4,) + source_token = proto.Field( + proto.STRING, + number=1, + ) + import_token = proto.Field( + proto.STRING, + number=2, + ) + sync_token = proto.Field( + proto.STRING, + number=3, + ) + last_sync = proto.Field( + proto.STRING, + number=4, + ) last_sync_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + code = proto.Field( + proto.ENUM, + number=5, + enum=SyncCode, + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=6, + message="SyncError", ) - code = proto.Field(proto.ENUM, number=5, enum=SyncCode,) - errors = proto.RepeatedField(proto.MESSAGE, number=6, message="SyncError",) class SyncError(proto.Message): @@ -458,10 +654,18 @@ class SyncError(proto.Message): error, if any """ - code = proto.Field(proto.STRING, number=1,) - error_message = proto.Field(proto.STRING, number=2,) + code = proto.Field( + proto.STRING, + number=1, + ) + error_message = proto.Field( + proto.STRING, + number=2, + ) error_resources = proto.RepeatedField( - proto.MESSAGE, number=3, message="ErrorResource", + proto.MESSAGE, + number=3, + message="ErrorResource", ) @@ -483,10 +687,23 @@ class ErrorResource(proto.Message): causing an error """ - source_path = proto.Field(proto.STRING, number=1,) - resource_name = proto.Field(proto.STRING, number=2,) - resource_namespace = proto.Field(proto.STRING, number=3,) - resource_gvk = proto.Field(proto.MESSAGE, number=4, message="GroupVersionKind",) + source_path = proto.Field( + proto.STRING, + number=1, + ) + resource_name = proto.Field( + proto.STRING, + number=2, + ) + resource_namespace = proto.Field( + proto.STRING, + number=3, + ) + resource_gvk = proto.Field( + proto.MESSAGE, + number=4, + message="GroupVersionKind", + ) class GroupVersionKind(proto.Message): @@ -501,9 +718,18 @@ class GroupVersionKind(proto.Message): Kubernetes Kind """ - group = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.STRING, number=2,) - kind = proto.Field(proto.STRING, number=3,) + group = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.STRING, + number=2, + ) + kind = proto.Field( + proto.STRING, + number=3, + ) class PolicyControllerState(proto.Message): @@ -518,9 +744,15 @@ class PolicyControllerState(proto.Message): installation. """ - version = proto.Field(proto.MESSAGE, number=1, message="PolicyControllerVersion",) + version = proto.Field( + proto.MESSAGE, + number=1, + message="PolicyControllerVersion", + ) deployment_state = proto.Field( - proto.MESSAGE, number=2, message="GatekeeperDeploymentState", + proto.MESSAGE, + number=2, + message="GatekeeperDeploymentState", ) @@ -533,7 +765,10 @@ class PolicyControllerVersion(proto.Message): ACM version, git tag, build number. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) class GatekeeperDeploymentState(proto.Message): @@ -547,9 +782,15 @@ class GatekeeperDeploymentState(proto.Message): """ gatekeeper_controller_manager_state = proto.Field( - proto.ENUM, number=1, enum="DeploymentState", + proto.ENUM, + number=1, + enum="DeploymentState", + ) + gatekeeper_audit = proto.Field( + proto.ENUM, + number=2, + enum="DeploymentState", ) - gatekeeper_audit = proto.Field(proto.ENUM, number=2, enum="DeploymentState",) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/multiclusteringress_v1/types/multiclusteringress.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/multiclusteringress_v1/types/multiclusteringress.py index 7919dbdff5f6..0fe2e29f2472 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/multiclusteringress_v1/types/multiclusteringress.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/multiclusteringress_v1/types/multiclusteringress.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.gkehub.multiclusteringress.v1", manifest={"FeatureSpec",}, + package="google.cloud.gkehub.multiclusteringress.v1", + manifest={ + "FeatureSpec", + }, ) @@ -32,7 +35,10 @@ class FeatureSpec(proto.Message): ``projects/foo-proj/locations/global/memberships/bar`` """ - config_membership = proto.Field(proto.STRING, number=1,) + config_membership = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/async_client.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/async_client.py index 4be1ddd83e92..f43cd4ad4d2d 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/async_client.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/async_client.py @@ -304,12 +304,20 @@ def sample_list_memberships(): ) # 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.ListMembershipsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -403,12 +411,20 @@ def sample_list_features(): ) # 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.ListFeaturesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -499,7 +515,12 @@ def sample_get_membership(): ) # 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 @@ -588,7 +609,12 @@ def sample_get_feature(): ) # 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 @@ -720,7 +746,12 @@ def sample_create_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -841,7 +872,12 @@ def sample_create_feature(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -962,7 +998,12 @@ def sample_delete_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1076,7 +1117,12 @@ def sample_delete_feature(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1206,7 +1252,12 @@ def sample_update_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1335,7 +1386,12 @@ def sample_update_feature(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1417,7 +1473,12 @@ def sample_generate_connect_manifest(): ) # 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 @@ -1431,7 +1492,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/client.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/client.py index 04d0fc6695b9..6268d5eb0c04 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/client.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/client.py @@ -60,7 +60,10 @@ class GkeHubClientMeta(type): _transport_registry["grpc"] = GkeHubGrpcTransport _transport_registry["grpc_asyncio"] = GkeHubGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[GkeHubTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[GkeHubTransport]: """Returns an appropriate transport class. Args: @@ -179,10 +182,16 @@ def transport(self) -> GkeHubTransport: return self._transport @staticmethod - def feature_path(project: str, location: str, feature: str,) -> str: + def feature_path( + project: str, + location: str, + feature: str, + ) -> str: """Returns a fully-qualified feature string.""" return "projects/{project}/locations/{location}/features/{feature}".format( - project=project, location=location, feature=feature, + project=project, + location=location, + feature=feature, ) @staticmethod @@ -195,10 +204,18 @@ def parse_feature_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def membership_path(project: str, location: str, membership: str,) -> str: + def membership_path( + project: str, + location: str, + membership: str, + ) -> str: """Returns a fully-qualified membership string.""" - return "projects/{project}/locations/{location}/memberships/{membership}".format( - project=project, location=location, membership=membership, + return ( + "projects/{project}/locations/{location}/memberships/{membership}".format( + project=project, + location=location, + membership=membership, + ) ) @staticmethod @@ -211,7 +228,9 @@ def parse_membership_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, @@ -224,9 +243,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]: @@ -235,9 +258,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]: @@ -246,9 +273,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]: @@ -257,10 +288,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 @@ -523,12 +558,20 @@ def sample_list_memberships(): ) # 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.ListMembershipsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -622,12 +665,20 @@ def sample_list_features(): ) # 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.ListFeaturesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -718,7 +769,12 @@ def sample_get_membership(): ) # 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 @@ -807,7 +863,12 @@ def sample_get_feature(): ) # 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 @@ -939,7 +1000,12 @@ def sample_create_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1060,7 +1126,12 @@ def sample_create_feature(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1181,7 +1252,12 @@ def sample_delete_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1295,7 +1371,12 @@ def sample_delete_feature(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1425,7 +1506,12 @@ def sample_update_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1554,7 +1640,12 @@ def sample_update_feature(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1639,7 +1730,12 @@ def sample_generate_connect_manifest(): ) # 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 @@ -1660,7 +1756,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/base.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/base.py index b8227e1c7386..0b999acda7d6 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/base.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/base.py @@ -33,7 +33,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,34 +125,54 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_memberships: gapic_v1.method.wrap_method( - self.list_memberships, default_timeout=None, client_info=client_info, + self.list_memberships, + default_timeout=None, + client_info=client_info, ), self.list_features: gapic_v1.method.wrap_method( - self.list_features, default_timeout=None, client_info=client_info, + self.list_features, + default_timeout=None, + client_info=client_info, ), self.get_membership: gapic_v1.method.wrap_method( - self.get_membership, default_timeout=None, client_info=client_info, + self.get_membership, + default_timeout=None, + client_info=client_info, ), self.get_feature: gapic_v1.method.wrap_method( - self.get_feature, default_timeout=None, client_info=client_info, + self.get_feature, + default_timeout=None, + client_info=client_info, ), self.create_membership: gapic_v1.method.wrap_method( - self.create_membership, default_timeout=None, client_info=client_info, + self.create_membership, + default_timeout=None, + client_info=client_info, ), self.create_feature: gapic_v1.method.wrap_method( - self.create_feature, default_timeout=None, client_info=client_info, + self.create_feature, + default_timeout=None, + client_info=client_info, ), self.delete_membership: gapic_v1.method.wrap_method( - self.delete_membership, default_timeout=None, client_info=client_info, + self.delete_membership, + default_timeout=None, + client_info=client_info, ), self.delete_feature: gapic_v1.method.wrap_method( - self.delete_feature, default_timeout=None, client_info=client_info, + self.delete_feature, + default_timeout=None, + client_info=client_info, ), self.update_membership: gapic_v1.method.wrap_method( - self.update_membership, default_timeout=None, client_info=client_info, + self.update_membership, + default_timeout=None, + client_info=client_info, ), self.update_feature: gapic_v1.method.wrap_method( - self.update_feature, default_timeout=None, client_info=client_info, + self.update_feature, + default_timeout=None, + client_info=client_info, ), self.generate_connect_manifest: gapic_v1.method.wrap_method( self.generate_connect_manifest, @@ -162,9 +184,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() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/grpc.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/grpc.py index eb83d1952ccc..07d10b6e058e 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/grpc.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/services/gke_hub/transports/grpc.py @@ -242,8 +242,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 diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/feature.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/feature.py index 514e5020fa3c..a06f1ebb3952 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/feature.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/feature.py @@ -97,23 +97,56 @@ class Feature(proto.Message): deleted. """ - name = proto.Field(proto.STRING, number=1,) - labels = proto.MapField(proto.STRING, proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=2, + ) resource_state = proto.Field( - proto.MESSAGE, number=3, message="FeatureResourceState", + proto.MESSAGE, + number=3, + message="FeatureResourceState", + ) + spec = proto.Field( + proto.MESSAGE, + number=4, + message="CommonFeatureSpec", ) - spec = proto.Field(proto.MESSAGE, number=4, message="CommonFeatureSpec",) membership_specs = proto.MapField( - proto.STRING, proto.MESSAGE, number=5, message="MembershipFeatureSpec", + proto.STRING, + proto.MESSAGE, + number=5, + message="MembershipFeatureSpec", + ) + state = proto.Field( + proto.MESSAGE, + number=6, + message="CommonFeatureState", ) - state = proto.Field(proto.MESSAGE, number=6, message="CommonFeatureState",) membership_states = proto.MapField( - proto.STRING, proto.MESSAGE, number=7, message="MembershipFeatureState", + proto.STRING, + proto.MESSAGE, + number=7, + message="MembershipFeatureState", + ) + create_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, ) - create_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,) delete_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, ) @@ -137,7 +170,11 @@ class State(proto.Enum): UPDATING = 4 SERVICE_UPDATING = 5 - state = proto.Field(proto.ENUM, number=1, enum=State,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) class FeatureState(proto.Message): @@ -166,9 +203,20 @@ class Code(proto.Enum): WARNING = 2 ERROR = 3 - code = proto.Field(proto.ENUM, number=1, enum=Code,) - description = proto.Field(proto.STRING, number=2,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + code = proto.Field( + proto.ENUM, + number=1, + enum=Code, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class CommonFeatureSpec(proto.Message): @@ -201,7 +249,11 @@ class CommonFeatureState(proto.Message): Feature in this Hub. """ - state = proto.Field(proto.MESSAGE, number=1, message="FeatureState",) + state = proto.Field( + proto.MESSAGE, + number=1, + message="FeatureState", + ) class MembershipFeatureSpec(proto.Message): @@ -249,7 +301,11 @@ class MembershipFeatureState(proto.Message): oneof="feature_state", message=configmanagement_v1.MembershipState, ) - state = proto.Field(proto.MESSAGE, number=1, message="FeatureState",) + state = proto.Field( + proto.MESSAGE, + number=1, + message="FeatureState", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/membership.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/membership.py index ac2887b29ea2..69604de20bd3 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/membership.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/membership.py @@ -112,21 +112,62 @@ class Membership(proto.Message): """ endpoint = proto.Field( - proto.MESSAGE, number=4, oneof="type", message="MembershipEndpoint", - ) - name = proto.Field(proto.STRING, number=1,) - labels = proto.MapField(proto.STRING, proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - state = proto.Field(proto.MESSAGE, number=5, message="MembershipState",) - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - delete_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - external_id = proto.Field(proto.STRING, number=9,) + proto.MESSAGE, + number=4, + oneof="type", + message="MembershipEndpoint", + ) + name = proto.Field( + proto.STRING, + number=1, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + state = proto.Field( + proto.MESSAGE, + number=5, + message="MembershipState", + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + delete_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + external_id = proto.Field( + proto.STRING, + number=9, + ) last_connection_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + unique_id = proto.Field( + proto.STRING, + number=11, + ) + authority = proto.Field( + proto.MESSAGE, + number=12, + message="Authority", ) - unique_id = proto.Field(proto.STRING, number=11,) - authority = proto.Field(proto.MESSAGE, number=12, message="Authority",) class MembershipEndpoint(proto.Message): @@ -153,12 +194,20 @@ class MembershipEndpoint(proto.Message): Features. """ - gke_cluster = proto.Field(proto.MESSAGE, number=1, message="GkeCluster",) + gke_cluster = proto.Field( + proto.MESSAGE, + number=1, + message="GkeCluster", + ) kubernetes_metadata = proto.Field( - proto.MESSAGE, number=2, message="KubernetesMetadata", + proto.MESSAGE, + number=2, + message="KubernetesMetadata", ) kubernetes_resource = proto.Field( - proto.MESSAGE, number=3, message="KubernetesResource", + proto.MESSAGE, + number=3, + message="KubernetesResource", ) @@ -207,14 +256,25 @@ class KubernetesResource(proto.Message): generation. """ - membership_cr_manifest = proto.Field(proto.STRING, number=1,) + membership_cr_manifest = proto.Field( + proto.STRING, + number=1, + ) membership_resources = proto.RepeatedField( - proto.MESSAGE, number=2, message="ResourceManifest", + proto.MESSAGE, + number=2, + message="ResourceManifest", ) connect_resources = proto.RepeatedField( - proto.MESSAGE, number=3, message="ResourceManifest", + proto.MESSAGE, + number=3, + message="ResourceManifest", + ) + resource_options = proto.Field( + proto.MESSAGE, + number=4, + message="ResourceOptions", ) - resource_options = proto.Field(proto.MESSAGE, number=4, message="ResourceOptions",) class ResourceOptions(proto.Message): @@ -239,9 +299,18 @@ class ResourceOptions(proto.Message): ``apiextensions/v1beta1`` or\ ``apiextensions/v1``. """ - connect_version = proto.Field(proto.STRING, number=1,) - v1beta1_crd = proto.Field(proto.BOOL, number=2,) - k8s_version = proto.Field(proto.STRING, number=3,) + connect_version = proto.Field( + proto.STRING, + number=1, + ) + v1beta1_crd = proto.Field( + proto.BOOL, + number=2, + ) + k8s_version = proto.Field( + proto.STRING, + number=3, + ) class ResourceManifest(proto.Message): @@ -260,8 +329,14 @@ class ResourceManifest(proto.Message): resource in a cluster. """ - manifest = proto.Field(proto.STRING, number=1,) - cluster_scoped = proto.Field(proto.BOOL, number=2,) + manifest = proto.Field( + proto.STRING, + number=1, + ) + cluster_scoped = proto.Field( + proto.BOOL, + number=2, + ) class GkeCluster(proto.Message): @@ -275,7 +350,10 @@ class GkeCluster(proto.Message): Zonal clusters are also supported. """ - resource_link = proto.Field(proto.STRING, number=1,) + resource_link = proto.Field( + proto.STRING, + number=1, + ) class KubernetesMetadata(proto.Message): @@ -309,13 +387,30 @@ class KubernetesMetadata(proto.Message): updated internally for API consumers. """ - kubernetes_api_server_version = proto.Field(proto.STRING, number=1,) - node_provider_id = proto.Field(proto.STRING, number=2,) - node_count = proto.Field(proto.INT32, number=3,) - vcpu_count = proto.Field(proto.INT32, number=4,) - memory_mb = proto.Field(proto.INT32, number=5,) + kubernetes_api_server_version = proto.Field( + proto.STRING, + number=1, + ) + node_provider_id = proto.Field( + proto.STRING, + number=2, + ) + node_count = proto.Field( + proto.INT32, + number=3, + ) + vcpu_count = proto.Field( + proto.INT32, + number=4, + ) + memory_mb = proto.Field( + proto.INT32, + number=5, + ) update_time = proto.Field( - proto.MESSAGE, number=100, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=100, + message=timestamp_pb2.Timestamp, ) @@ -337,7 +432,11 @@ class Code(proto.Enum): UPDATING = 4 SERVICE_UPDATING = 5 - code = proto.Field(proto.ENUM, number=1, enum=Code,) + code = proto.Field( + proto.ENUM, + number=1, + enum=Code, + ) class Authority(proto.Message): @@ -382,10 +481,22 @@ class Authority(proto.Message): using this field. """ - issuer = proto.Field(proto.STRING, number=1,) - workload_identity_pool = proto.Field(proto.STRING, number=2,) - identity_provider = proto.Field(proto.STRING, number=3,) - oidc_jwks = proto.Field(proto.BYTES, number=4,) + issuer = proto.Field( + proto.STRING, + number=1, + ) + workload_identity_pool = proto.Field( + proto.STRING, + number=2, + ) + identity_provider = proto.Field( + proto.STRING, + number=3, + ) + oidc_jwks = proto.Field( + proto.BYTES, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/service.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/service.py index d5937d94df49..9729a61aa5f6 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/service.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1/types/service.py @@ -92,11 +92,26 @@ class ListMembershipsRequest(proto.Message): https://google.aip.dev/132#ordering. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListMembershipsResponse(proto.Message): @@ -119,10 +134,18 @@ def raw_page(self): return self resources = proto.RepeatedField( - proto.MESSAGE, number=1, message=membership.Membership, + proto.MESSAGE, + number=1, + message=membership.Membership, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetMembershipRequest(proto.Message): @@ -134,7 +157,10 @@ class GetMembershipRequest(proto.Message): ``projects/*/locations/*/memberships/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateMembershipRequest(proto.Message): @@ -180,10 +206,23 @@ class CreateMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - membership_id = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message=membership.Membership,) - request_id = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + membership_id = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message=membership.Membership, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class DeleteMembershipRequest(proto.Message): @@ -213,8 +252,14 @@ class DeleteMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class UpdateMembershipRequest(proto.Message): @@ -255,12 +300,24 @@ class UpdateMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message=membership.Membership, + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - resource = proto.Field(proto.MESSAGE, number=3, message=membership.Membership,) - request_id = proto.Field(proto.STRING, number=4,) class GenerateConnectManifestRequest(proto.Message): @@ -300,13 +357,34 @@ class GenerateConnectManifestRequest(proto.Message): the registry, if not public. """ - name = proto.Field(proto.STRING, number=1,) - namespace = proto.Field(proto.STRING, number=2,) - proxy = proto.Field(proto.BYTES, number=3,) - version = proto.Field(proto.STRING, number=4,) - is_upgrade = proto.Field(proto.BOOL, number=5,) - registry = proto.Field(proto.STRING, number=6,) - image_pull_secret_content = proto.Field(proto.BYTES, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + namespace = proto.Field( + proto.STRING, + number=2, + ) + proxy = proto.Field( + proto.BYTES, + number=3, + ) + version = proto.Field( + proto.STRING, + number=4, + ) + is_upgrade = proto.Field( + proto.BOOL, + number=5, + ) + registry = proto.Field( + proto.STRING, + number=6, + ) + image_pull_secret_content = proto.Field( + proto.BYTES, + number=7, + ) class GenerateConnectManifestResponse(proto.Message): @@ -321,7 +399,9 @@ class GenerateConnectManifestResponse(proto.Message): """ manifest = proto.RepeatedField( - proto.MESSAGE, number=1, message="ConnectAgentResource", + proto.MESSAGE, + number=1, + message="ConnectAgentResource", ) @@ -336,8 +416,15 @@ class ConnectAgentResource(proto.Message): YAML manifest of the resource. """ - type_ = proto.Field(proto.MESSAGE, number=1, message="TypeMeta",) - manifest = proto.Field(proto.STRING, number=2,) + type_ = proto.Field( + proto.MESSAGE, + number=1, + message="TypeMeta", + ) + manifest = proto.Field( + proto.STRING, + number=2, + ) class TypeMeta(proto.Message): @@ -351,8 +438,14 @@ class TypeMeta(proto.Message): APIVersion of the resource (e.g. v1). """ - kind = proto.Field(proto.STRING, number=1,) - api_version = proto.Field(proto.STRING, number=2,) + kind = proto.Field( + proto.STRING, + number=1, + ) + api_version = proto.Field( + proto.STRING, + number=2, + ) class ListFeaturesRequest(proto.Message): @@ -397,11 +490,26 @@ class ListFeaturesRequest(proto.Message): https://google.aip.dev/132#ordering. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListFeaturesResponse(proto.Message): @@ -420,8 +528,15 @@ class ListFeaturesResponse(proto.Message): def raw_page(self): return self - resources = proto.RepeatedField(proto.MESSAGE, number=1, message=feature.Feature,) - next_page_token = proto.Field(proto.STRING, number=2,) + resources = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=feature.Feature, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetFeatureRequest(proto.Message): @@ -433,7 +548,10 @@ class GetFeatureRequest(proto.Message): ``projects/*/locations/*/features/*`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateFeatureRequest(proto.Message): @@ -468,10 +586,23 @@ class CreateFeatureRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - feature_id = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message=feature.Feature,) - request_id = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + feature_id = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message=feature.Feature, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class DeleteFeatureRequest(proto.Message): @@ -506,9 +637,18 @@ class DeleteFeatureRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) - request_id = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) class UpdateFeatureRequest(proto.Message): @@ -549,12 +689,24 @@ class UpdateFeatureRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message=feature.Feature, + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - resource = proto.Field(proto.MESSAGE, number=3, message=feature.Feature,) - request_id = proto.Field(proto.STRING, number=4,) class OperationMetadata(proto.Message): @@ -587,13 +739,36 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - status_detail = proto.Field(proto.STRING, number=5,) - cancel_requested = proto.Field(proto.BOOL, number=6,) - api_version = proto.Field(proto.STRING, number=7,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_detail = proto.Field( + proto.STRING, + number=5, + ) + cancel_requested = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/async_client.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/async_client.py index 29c1814f7f4e..53672b25ec14 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/async_client.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/async_client.py @@ -314,12 +314,20 @@ def sample_list_memberships(): ) # 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.ListMembershipsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -410,7 +418,12 @@ def sample_get_membership(): ) # 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 @@ -542,7 +555,12 @@ def sample_create_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -663,7 +681,12 @@ def sample_delete_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -796,7 +819,12 @@ def sample_update_membership(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -878,7 +906,12 @@ def sample_generate_connect_manifest(): ) # 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 @@ -950,7 +983,12 @@ def sample_validate_exclusivity(): ) # 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 @@ -1033,7 +1071,12 @@ def sample_generate_exclusivity_manifest(): ) # 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 @@ -1047,7 +1090,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/client.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/client.py index fed4ef62f5b7..18ed636791ab 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/client.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/client.py @@ -62,7 +62,8 @@ class GkeHubMembershipServiceClientMeta(type): _transport_registry["grpc_asyncio"] = GkeHubMembershipServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[GkeHubMembershipServiceTransport]: """Returns an appropriate transport class. @@ -177,10 +178,18 @@ def transport(self) -> GkeHubMembershipServiceTransport: return self._transport @staticmethod - def membership_path(project: str, location: str, membership: str,) -> str: + def membership_path( + project: str, + location: str, + membership: str, + ) -> str: """Returns a fully-qualified membership string.""" - return "projects/{project}/locations/{location}/memberships/{membership}".format( - project=project, location=location, membership=membership, + return ( + "projects/{project}/locations/{location}/memberships/{membership}".format( + project=project, + location=location, + membership=membership, + ) ) @staticmethod @@ -193,7 +202,9 @@ def parse_membership_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, @@ -206,9 +217,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]: @@ -217,9 +232,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]: @@ -228,9 +247,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]: @@ -239,10 +262,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 @@ -506,12 +533,20 @@ def sample_list_memberships(): ) # 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.ListMembershipsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -602,7 +637,12 @@ def sample_get_membership(): ) # 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 @@ -734,7 +774,12 @@ def sample_create_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -855,7 +900,12 @@ def sample_delete_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -988,7 +1038,12 @@ def sample_update_membership(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1073,7 +1128,12 @@ def sample_generate_connect_manifest(): ) # 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 @@ -1146,7 +1206,12 @@ def sample_validate_exclusivity(): ) # 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 @@ -1232,7 +1297,12 @@ def sample_generate_exclusivity_manifest(): ) # 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 @@ -1253,7 +1323,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/base.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/base.py index f9bb1f67769f..f955911520cd 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/base.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-gke-hub",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-gke-hub", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -121,19 +123,29 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_memberships: gapic_v1.method.wrap_method( - self.list_memberships, default_timeout=None, client_info=client_info, + self.list_memberships, + default_timeout=None, + client_info=client_info, ), self.get_membership: gapic_v1.method.wrap_method( - self.get_membership, default_timeout=None, client_info=client_info, + self.get_membership, + default_timeout=None, + client_info=client_info, ), self.create_membership: gapic_v1.method.wrap_method( - self.create_membership, default_timeout=None, client_info=client_info, + self.create_membership, + default_timeout=None, + client_info=client_info, ), self.delete_membership: gapic_v1.method.wrap_method( - self.delete_membership, default_timeout=None, client_info=client_info, + self.delete_membership, + default_timeout=None, + client_info=client_info, ), self.update_membership: gapic_v1.method.wrap_method( - self.update_membership, default_timeout=None, client_info=client_info, + self.update_membership, + default_timeout=None, + client_info=client_info, ), self.generate_connect_manifest: gapic_v1.method.wrap_method( self.generate_connect_manifest, @@ -155,9 +167,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() diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py index 20b2b9ff91f2..18354c1d4e80 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py @@ -235,8 +235,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 diff --git a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/types/membership.py b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/types/membership.py index 69350db8aa2c..36230c641c59 100644 --- a/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/types/membership.py +++ b/packages/google-cloud-gke-hub/google/cloud/gkehub_v1beta1/types/membership.py @@ -145,23 +145,68 @@ class InfrastructureType(proto.Enum): ON_PREM = 1 MULTI_CLOUD = 2 - name = proto.Field(proto.STRING, number=1,) - labels = proto.MapField(proto.STRING, proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) endpoint = proto.Field( - proto.MESSAGE, number=4, oneof="type", message="MembershipEndpoint", - ) - state = proto.Field(proto.MESSAGE, number=5, message="MembershipState",) - authority = proto.Field(proto.MESSAGE, number=9, message="Authority",) - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - delete_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - external_id = proto.Field(proto.STRING, number=10,) + proto.MESSAGE, + number=4, + oneof="type", + message="MembershipEndpoint", + ) + state = proto.Field( + proto.MESSAGE, + number=5, + message="MembershipState", + ) + authority = proto.Field( + proto.MESSAGE, + number=9, + message="Authority", + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + delete_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + external_id = proto.Field( + proto.STRING, + number=10, + ) last_connection_time = proto.Field( - proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=11, + message=timestamp_pb2.Timestamp, + ) + unique_id = proto.Field( + proto.STRING, + number=12, + ) + infrastructure_type = proto.Field( + proto.ENUM, + number=13, + enum=InfrastructureType, ) - unique_id = proto.Field(proto.STRING, number=12,) - infrastructure_type = proto.Field(proto.ENUM, number=13, enum=InfrastructureType,) class MembershipEndpoint(proto.Message): @@ -208,19 +253,32 @@ class MembershipEndpoint(proto.Message): """ gke_cluster = proto.Field( - proto.MESSAGE, number=4, oneof="type", message="GkeCluster", + proto.MESSAGE, + number=4, + oneof="type", + message="GkeCluster", ) on_prem_cluster = proto.Field( - proto.MESSAGE, number=7, oneof="type", message="OnPremCluster", + proto.MESSAGE, + number=7, + oneof="type", + message="OnPremCluster", ) multi_cloud_cluster = proto.Field( - proto.MESSAGE, number=8, oneof="type", message="MultiCloudCluster", + proto.MESSAGE, + number=8, + oneof="type", + message="MultiCloudCluster", ) kubernetes_metadata = proto.Field( - proto.MESSAGE, number=5, message="KubernetesMetadata", + proto.MESSAGE, + number=5, + message="KubernetesMetadata", ) kubernetes_resource = proto.Field( - proto.MESSAGE, number=6, message="KubernetesResource", + proto.MESSAGE, + number=6, + message="KubernetesResource", ) @@ -269,14 +327,25 @@ class KubernetesResource(proto.Message): generation. """ - membership_cr_manifest = proto.Field(proto.STRING, number=1,) + membership_cr_manifest = proto.Field( + proto.STRING, + number=1, + ) membership_resources = proto.RepeatedField( - proto.MESSAGE, number=2, message="ResourceManifest", + proto.MESSAGE, + number=2, + message="ResourceManifest", ) connect_resources = proto.RepeatedField( - proto.MESSAGE, number=3, message="ResourceManifest", + proto.MESSAGE, + number=3, + message="ResourceManifest", + ) + resource_options = proto.Field( + proto.MESSAGE, + number=4, + message="ResourceOptions", ) - resource_options = proto.Field(proto.MESSAGE, number=4, message="ResourceOptions",) class ResourceOptions(proto.Message): @@ -301,9 +370,18 @@ class ResourceOptions(proto.Message): ``apiextensions/v1beta1`` or\ ``apiextensions/v1``. """ - connect_version = proto.Field(proto.STRING, number=1,) - v1beta1_crd = proto.Field(proto.BOOL, number=2,) - k8s_version = proto.Field(proto.STRING, number=3,) + connect_version = proto.Field( + proto.STRING, + number=1, + ) + v1beta1_crd = proto.Field( + proto.BOOL, + number=2, + ) + k8s_version = proto.Field( + proto.STRING, + number=3, + ) class ResourceManifest(proto.Message): @@ -322,8 +400,14 @@ class ResourceManifest(proto.Message): resource in a cluster. """ - manifest = proto.Field(proto.STRING, number=1,) - cluster_scoped = proto.Field(proto.BOOL, number=2,) + manifest = proto.Field( + proto.STRING, + number=1, + ) + cluster_scoped = proto.Field( + proto.BOOL, + number=2, + ) class GkeCluster(proto.Message): @@ -340,8 +424,14 @@ class GkeCluster(proto.Message): the GKE cluster no longer exists in the GKE Control Plane. """ - resource_link = proto.Field(proto.STRING, number=1,) - cluster_missing = proto.Field(proto.BOOL, number=3,) + resource_link = proto.Field( + proto.STRING, + number=1, + ) + cluster_missing = proto.Field( + proto.BOOL, + number=3, + ) class OnPremCluster(proto.Message): @@ -364,9 +454,18 @@ class OnPremCluster(proto.Message): cluster. """ - resource_link = proto.Field(proto.STRING, number=1,) - cluster_missing = proto.Field(proto.BOOL, number=2,) - admin_cluster = proto.Field(proto.BOOL, number=3,) + resource_link = proto.Field( + proto.STRING, + number=1, + ) + cluster_missing = proto.Field( + proto.BOOL, + number=2, + ) + admin_cluster = proto.Field( + proto.BOOL, + number=3, + ) class MultiCloudCluster(proto.Message): @@ -386,8 +485,14 @@ class MultiCloudCluster(proto.Message): Multi-Cloud cluster no longer exists. """ - resource_link = proto.Field(proto.STRING, number=1,) - cluster_missing = proto.Field(proto.BOOL, number=2,) + resource_link = proto.Field( + proto.STRING, + number=1, + ) + cluster_missing = proto.Field( + proto.BOOL, + number=2, + ) class KubernetesMetadata(proto.Message): @@ -421,13 +526,30 @@ class KubernetesMetadata(proto.Message): updated internally for API consumers. """ - kubernetes_api_server_version = proto.Field(proto.STRING, number=1,) - node_provider_id = proto.Field(proto.STRING, number=2,) - node_count = proto.Field(proto.INT32, number=3,) - vcpu_count = proto.Field(proto.INT32, number=4,) - memory_mb = proto.Field(proto.INT32, number=5,) + kubernetes_api_server_version = proto.Field( + proto.STRING, + number=1, + ) + node_provider_id = proto.Field( + proto.STRING, + number=2, + ) + node_count = proto.Field( + proto.INT32, + number=3, + ) + vcpu_count = proto.Field( + proto.INT32, + number=4, + ) + memory_mb = proto.Field( + proto.INT32, + number=5, + ) update_time = proto.Field( - proto.MESSAGE, number=100, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=100, + message=timestamp_pb2.Timestamp, ) @@ -473,10 +595,22 @@ class Authority(proto.Message): using this field. """ - issuer = proto.Field(proto.STRING, number=1,) - workload_identity_pool = proto.Field(proto.STRING, number=2,) - identity_provider = proto.Field(proto.STRING, number=3,) - oidc_jwks = proto.Field(proto.BYTES, number=4,) + issuer = proto.Field( + proto.STRING, + number=1, + ) + workload_identity_pool = proto.Field( + proto.STRING, + number=2, + ) + identity_provider = proto.Field( + proto.STRING, + number=3, + ) + oidc_jwks = proto.Field( + proto.BYTES, + number=4, + ) class MembershipState(proto.Message): @@ -501,9 +635,20 @@ class Code(proto.Enum): UPDATING = 4 SERVICE_UPDATING = 5 - code = proto.Field(proto.ENUM, number=1, enum=Code,) - description = proto.Field(proto.STRING, number=2,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + code = proto.Field( + proto.ENUM, + number=1, + enum=Code, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class ListMembershipsRequest(proto.Message): @@ -554,11 +699,26 @@ class ListMembershipsRequest(proto.Message): https://google.aip.dev/132#ordering. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListMembershipsResponse(proto.Message): @@ -581,9 +741,19 @@ class ListMembershipsResponse(proto.Message): def raw_page(self): return self - resources = proto.RepeatedField(proto.MESSAGE, number=1, message="Membership",) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) + resources = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Membership", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) class GetMembershipRequest(proto.Message): @@ -596,7 +766,10 @@ class GetMembershipRequest(proto.Message): ``projects/*/locations/*/memberships/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateMembershipRequest(proto.Message): @@ -643,10 +816,23 @@ class CreateMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - membership_id = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message="Membership",) - request_id = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + membership_id = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message="Membership", + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class DeleteMembershipRequest(proto.Message): @@ -677,8 +863,14 @@ class DeleteMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class UpdateMembershipRequest(proto.Message): @@ -721,12 +913,24 @@ class UpdateMembershipRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message="Membership", + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - resource = proto.Field(proto.MESSAGE, number=3, message="Membership",) - request_id = proto.Field(proto.STRING, number=4,) class GenerateConnectManifestRequest(proto.Message): @@ -756,12 +960,31 @@ class GenerateConnectManifestRequest(proto.Message): the registry, if not public. """ - name = proto.Field(proto.STRING, number=1,) - connect_agent = proto.Field(proto.MESSAGE, number=2, message="ConnectAgent",) - version = proto.Field(proto.STRING, number=3,) - is_upgrade = proto.Field(proto.BOOL, number=4,) - registry = proto.Field(proto.STRING, number=5,) - image_pull_secret_content = proto.Field(proto.BYTES, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + connect_agent = proto.Field( + proto.MESSAGE, + number=2, + message="ConnectAgent", + ) + version = proto.Field( + proto.STRING, + number=3, + ) + is_upgrade = proto.Field( + proto.BOOL, + number=4, + ) + registry = proto.Field( + proto.STRING, + number=5, + ) + image_pull_secret_content = proto.Field( + proto.BYTES, + number=6, + ) class GenerateConnectManifestResponse(proto.Message): @@ -776,7 +999,9 @@ class GenerateConnectManifestResponse(proto.Message): """ manifest = proto.RepeatedField( - proto.MESSAGE, number=1, message="ConnectAgentResource", + proto.MESSAGE, + number=1, + message="ConnectAgentResource", ) @@ -791,8 +1016,15 @@ class ConnectAgentResource(proto.Message): YAML manifest of the resource. """ - type_ = proto.Field(proto.MESSAGE, number=1, message="TypeMeta",) - manifest = proto.Field(proto.STRING, number=2,) + type_ = proto.Field( + proto.MESSAGE, + number=1, + message="TypeMeta", + ) + manifest = proto.Field( + proto.STRING, + number=2, + ) class TypeMeta(proto.Message): @@ -806,8 +1038,14 @@ class TypeMeta(proto.Message): APIVersion of the resource (e.g. v1). """ - kind = proto.Field(proto.STRING, number=1,) - api_version = proto.Field(proto.STRING, number=2,) + kind = proto.Field( + proto.STRING, + number=1, + ) + api_version = proto.Field( + proto.STRING, + number=2, + ) class ConnectAgent(proto.Message): @@ -832,9 +1070,18 @@ class ConnectAgent(proto.Message): must be granted with an additional IAM binding. """ - name = proto.Field(proto.STRING, number=1,) - proxy = proto.Field(proto.BYTES, number=2,) - namespace = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + proxy = proto.Field( + proto.BYTES, + number=2, + ) + namespace = proto.Field( + proto.STRING, + number=3, + ) class ValidateExclusivityRequest(proto.Message): @@ -856,9 +1103,18 @@ class ValidateExclusivityRequest(proto.Message): CreateMembership call with the same name. """ - parent = proto.Field(proto.STRING, number=1,) - cr_manifest = proto.Field(proto.STRING, number=2,) - intended_membership = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + cr_manifest = proto.Field( + proto.STRING, + number=2, + ) + intended_membership = proto.Field( + proto.STRING, + number=3, + ) class ValidateExclusivityResponse(proto.Message): @@ -877,7 +1133,11 @@ class ValidateExclusivityResponse(proto.Message): more information. """ - status = proto.Field(proto.MESSAGE, number=1, message=status_pb2.Status,) + status = proto.Field( + proto.MESSAGE, + number=1, + message=status_pb2.Status, + ) class GenerateExclusivityManifestRequest(proto.Message): @@ -898,9 +1158,18 @@ class GenerateExclusivityManifestRequest(proto.Message): the resource does not exist. """ - name = proto.Field(proto.STRING, number=1,) - crd_manifest = proto.Field(proto.STRING, number=2,) - cr_manifest = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + crd_manifest = proto.Field( + proto.STRING, + number=2, + ) + cr_manifest = proto.Field( + proto.STRING, + number=3, + ) class GenerateExclusivityManifestResponse(proto.Message): @@ -919,8 +1188,14 @@ class GenerateExclusivityManifestResponse(proto.Message): Empty if no update needs to be applied. """ - crd_manifest = proto.Field(proto.STRING, number=1,) - cr_manifest = proto.Field(proto.STRING, number=2,) + crd_manifest = proto.Field( + proto.STRING, + number=1, + ) + cr_manifest = proto.Field( + proto.STRING, + number=2, + ) class OperationMetadata(proto.Message): @@ -953,13 +1228,36 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - status_detail = proto.Field(proto.STRING, number=5,) - cancel_requested = proto.Field(proto.BOOL, number=6,) - api_version = proto.Field(proto.STRING, number=7,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_detail = proto.Field( + proto.STRING, + number=5, + ) + cancel_requested = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-gke-hub/noxfile.py b/packages/google-cloud-gke-hub/noxfile.py index 2a2001c49998..3addb4ed9431 100644 --- a/packages/google-cloud-gke-hub/noxfile.py +++ b/packages/google-cloud-gke-hub/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py index 038b1d82cb83..0e31271067b8 100644 --- a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py +++ b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py @@ -89,7 +89,13 @@ def test__get_default_mtls_endpoint(): assert GkeHubClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [GkeHubClient, GkeHubAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + GkeHubClient, + GkeHubAsyncClient, + ], +) def test_gke_hub_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -127,7 +133,13 @@ def test_gke_hub_client_service_account_always_use_jwt(transport_class, transpor use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [GkeHubClient, GkeHubAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + GkeHubClient, + GkeHubAsyncClient, + ], +) def test_gke_hub_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -466,7 +478,9 @@ def test_gke_hub_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) @@ -594,10 +608,17 @@ def test_gke_hub_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.ListMembershipsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListMembershipsRequest, + dict, + ], +) def test_list_memberships(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -608,7 +629,8 @@ def test_list_memberships(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_memberships), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.ListMembershipsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_memberships(request) @@ -627,7 +649,8 @@ def test_list_memberships_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -643,7 +666,8 @@ async def test_list_memberships_async( transport: str = "grpc_asyncio", request_type=service.ListMembershipsRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -678,7 +702,9 @@ async def test_list_memberships_async_from_dict(): def test_list_memberships_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -698,12 +724,17 @@ def test_list_memberships_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 async def test_list_memberships_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -725,11 +756,16 @@ async def test_list_memberships_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_memberships_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_memberships), "__call__") as call: @@ -737,7 +773,9 @@ def test_list_memberships_flattened(): call.return_value = service.ListMembershipsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_memberships(parent="parent_value",) + client.list_memberships( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -749,19 +787,24 @@ def test_list_memberships_flattened(): def test_list_memberships_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_memberships( - service.ListMembershipsRequest(), parent="parent_value", + service.ListMembershipsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_memberships_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_memberships), "__call__") as call: @@ -773,7 +816,9 @@ async def test_list_memberships_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_memberships(parent="parent_value",) + response = await client.list_memberships( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -786,19 +831,23 @@ async def test_list_memberships_flattened_async(): @pytest.mark.asyncio async def test_list_memberships_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_memberships( - service.ListMembershipsRequest(), parent="parent_value", + service.ListMembershipsRequest(), + parent="parent_value", ) def test_list_memberships_pager(transport_name: str = "grpc"): client = GkeHubClient( - 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. @@ -813,12 +862,21 @@ def test_list_memberships_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListMembershipsResponse(resources=[], next_page_token="def",), service.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), service.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + service.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -838,7 +896,8 @@ def test_list_memberships_pager(transport_name: str = "grpc"): def test_list_memberships_pages(transport_name: str = "grpc"): client = GkeHubClient( - 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. @@ -853,12 +912,21 @@ def test_list_memberships_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListMembershipsResponse(resources=[], next_page_token="def",), service.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), service.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + service.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -869,7 +937,9 @@ def test_list_memberships_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_memberships_async_pager(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -885,16 +955,27 @@ async def test_list_memberships_async_pager(): ], next_page_token="abc", ), - service.ListMembershipsResponse(resources=[], next_page_token="def",), service.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), service.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + service.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) - async_pager = await client.list_memberships(request={},) + async_pager = await client.list_memberships( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -906,7 +987,9 @@ async def test_list_memberships_async_pager(): @pytest.mark.asyncio async def test_list_memberships_async_pages(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -922,12 +1005,21 @@ async def test_list_memberships_async_pages(): ], next_page_token="abc", ), - service.ListMembershipsResponse(resources=[], next_page_token="def",), service.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", + ), + service.ListMembershipsResponse( + resources=[ + membership.Membership(), + ], + next_page_token="ghi", ), service.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -938,10 +1030,17 @@ async def test_list_memberships_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.ListFeaturesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListFeaturesRequest, + dict, + ], +) def test_list_features(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -970,7 +1069,8 @@ def test_list_features_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -986,7 +1086,8 @@ async def test_list_features_async( transport: str = "grpc_asyncio", request_type=service.ListFeaturesRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -997,7 +1098,9 @@ async def test_list_features_async( with mock.patch.object(type(client.transport.list_features), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.ListFeaturesResponse(next_page_token="next_page_token_value",) + service.ListFeaturesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_features(request) @@ -1017,7 +1120,9 @@ async def test_list_features_async_from_dict(): def test_list_features_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -1037,12 +1142,17 @@ def test_list_features_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 async def test_list_features_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -1064,11 +1174,16 @@ async def test_list_features_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_features_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_features), "__call__") as call: @@ -1076,7 +1191,9 @@ def test_list_features_flattened(): call.return_value = service.ListFeaturesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_features(parent="parent_value",) + client.list_features( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1088,19 +1205,24 @@ def test_list_features_flattened(): def test_list_features_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_features( - service.ListFeaturesRequest(), parent="parent_value", + service.ListFeaturesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_features_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_features), "__call__") as call: @@ -1112,7 +1234,9 @@ async def test_list_features_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_features(parent="parent_value",) + response = await client.list_features( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1125,19 +1249,23 @@ async def test_list_features_flattened_async(): @pytest.mark.asyncio async def test_list_features_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_features( - service.ListFeaturesRequest(), parent="parent_value", + service.ListFeaturesRequest(), + parent="parent_value", ) def test_list_features_pager(transport_name: str = "grpc"): client = GkeHubClient( - 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. @@ -1145,15 +1273,28 @@ def test_list_features_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + feature.Feature(), + ], next_page_token="abc", ), - service.ListFeaturesResponse(resources=[], next_page_token="def",), service.ListFeaturesResponse( - resources=[feature.Feature(),], next_page_token="ghi", + resources=[], + next_page_token="def", + ), + service.ListFeaturesResponse( + resources=[ + feature.Feature(), + ], + next_page_token="ghi", ), service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + ], ), RuntimeError, ) @@ -1173,7 +1314,8 @@ def test_list_features_pager(transport_name: str = "grpc"): def test_list_features_pages(transport_name: str = "grpc"): client = GkeHubClient( - 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. @@ -1181,15 +1323,28 @@ def test_list_features_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + feature.Feature(), + ], next_page_token="abc", ), - service.ListFeaturesResponse(resources=[], next_page_token="def",), service.ListFeaturesResponse( - resources=[feature.Feature(),], next_page_token="ghi", + resources=[], + next_page_token="def", + ), + service.ListFeaturesResponse( + resources=[ + feature.Feature(), + ], + next_page_token="ghi", ), service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + ], ), RuntimeError, ) @@ -1200,7 +1355,9 @@ def test_list_features_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_features_async_pager(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1209,19 +1366,34 @@ async def test_list_features_async_pager(): # Set the response to a series of pages. call.side_effect = ( service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + feature.Feature(), + ], next_page_token="abc", ), - service.ListFeaturesResponse(resources=[], next_page_token="def",), service.ListFeaturesResponse( - resources=[feature.Feature(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + ], + next_page_token="ghi", + ), + service.ListFeaturesResponse( + resources=[ + feature.Feature(), + feature.Feature(), + ], ), RuntimeError, ) - async_pager = await client.list_features(request={},) + async_pager = await client.list_features( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1233,7 +1405,9 @@ async def test_list_features_async_pager(): @pytest.mark.asyncio async def test_list_features_async_pages(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1242,15 +1416,28 @@ async def test_list_features_async_pages(): # Set the response to a series of pages. call.side_effect = ( service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + feature.Feature(), + ], next_page_token="abc", ), - service.ListFeaturesResponse(resources=[], next_page_token="def",), service.ListFeaturesResponse( - resources=[feature.Feature(),], next_page_token="ghi", + resources=[], + next_page_token="def", + ), + service.ListFeaturesResponse( + resources=[ + feature.Feature(), + ], + next_page_token="ghi", ), service.ListFeaturesResponse( - resources=[feature.Feature(), feature.Feature(),], + resources=[ + feature.Feature(), + feature.Feature(), + ], ), RuntimeError, ) @@ -1261,10 +1448,17 @@ async def test_list_features_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.GetMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetMembershipRequest, + dict, + ], +) def test_get_membership(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1302,7 +1496,8 @@ def test_get_membership_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1318,7 +1513,8 @@ async def test_get_membership_async( transport: str = "grpc_asyncio", request_type=service.GetMembershipRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1357,7 +1553,9 @@ async def test_get_membership_async_from_dict(): def test_get_membership_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -1377,12 +1575,17 @@ def test_get_membership_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 async def test_get_membership_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -1404,11 +1607,16 @@ async def test_get_membership_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_membership_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_membership), "__call__") as call: @@ -1416,7 +1624,9 @@ def test_get_membership_flattened(): call.return_value = membership.Membership() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_membership(name="name_value",) + client.get_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1428,19 +1638,24 @@ def test_get_membership_flattened(): def test_get_membership_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_membership( - service.GetMembershipRequest(), name="name_value", + service.GetMembershipRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_membership_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_membership), "__call__") as call: @@ -1452,7 +1667,9 @@ async def test_get_membership_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_membership(name="name_value",) + response = await client.get_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1465,20 +1682,30 @@ async def test_get_membership_flattened_async(): @pytest.mark.asyncio async def test_get_membership_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_membership( - service.GetMembershipRequest(), name="name_value", + service.GetMembershipRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.GetFeatureRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetFeatureRequest, + dict, + ], +) def test_get_feature(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1488,7 +1715,9 @@ def test_get_feature(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_feature), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = feature.Feature(name="name_value",) + call.return_value = feature.Feature( + name="name_value", + ) response = client.get_feature(request) # Establish that the underlying gRPC stub method was called. @@ -1505,7 +1734,8 @@ def test_get_feature_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1521,7 +1751,8 @@ async def test_get_feature_async( transport: str = "grpc_asyncio", request_type=service.GetFeatureRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1532,7 +1763,9 @@ async def test_get_feature_async( with mock.patch.object(type(client.transport.get_feature), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - feature.Feature(name="name_value",) + feature.Feature( + name="name_value", + ) ) response = await client.get_feature(request) @@ -1552,7 +1785,9 @@ async def test_get_feature_async_from_dict(): def test_get_feature_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -1572,12 +1807,17 @@ def test_get_feature_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 async def test_get_feature_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -1597,11 +1837,16 @@ async def test_get_feature_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_feature_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feature), "__call__") as call: @@ -1609,7 +1854,9 @@ def test_get_feature_flattened(): call.return_value = feature.Feature() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_feature(name="name_value",) + client.get_feature( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1621,19 +1868,24 @@ def test_get_feature_flattened(): def test_get_feature_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_feature( - service.GetFeatureRequest(), name="name_value", + service.GetFeatureRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_feature_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feature), "__call__") as call: @@ -1643,7 +1895,9 @@ async def test_get_feature_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(feature.Feature()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_feature(name="name_value",) + response = await client.get_feature( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1656,20 +1910,30 @@ async def test_get_feature_flattened_async(): @pytest.mark.asyncio async def test_get_feature_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_feature( - service.GetFeatureRequest(), name="name_value", + service.GetFeatureRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.CreateMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateMembershipRequest, + dict, + ], +) def test_create_membership(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1697,7 +1961,8 @@ def test_create_membership_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1715,7 +1980,8 @@ async def test_create_membership_async( transport: str = "grpc_asyncio", request_type=service.CreateMembershipRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1747,7 +2013,9 @@ async def test_create_membership_async_from_dict(): def test_create_membership_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -1769,12 +2037,17 @@ def test_create_membership_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 async def test_create_membership_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -1798,11 +2071,16 @@ async def test_create_membership_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_membership_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1844,7 +2122,9 @@ def test_create_membership_flattened(): def test_create_membership_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1865,7 +2145,9 @@ def test_create_membership_flattened_error(): @pytest.mark.asyncio async def test_create_membership_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1912,7 +2194,9 @@ async def test_create_membership_flattened_async(): @pytest.mark.asyncio async def test_create_membership_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1931,10 +2215,17 @@ async def test_create_membership_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.CreateFeatureRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateFeatureRequest, + dict, + ], +) def test_create_feature(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1960,7 +2251,8 @@ def test_create_feature_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1976,7 +2268,8 @@ async def test_create_feature_async( transport: str = "grpc_asyncio", request_type=service.CreateFeatureRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2006,7 +2299,9 @@ async def test_create_feature_async_from_dict(): def test_create_feature_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -2026,12 +2321,17 @@ def test_create_feature_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 async def test_create_feature_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -2053,11 +2353,16 @@ async def test_create_feature_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_feature_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feature), "__call__") as call: @@ -2087,7 +2392,9 @@ def test_create_feature_flattened(): def test_create_feature_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2102,7 +2409,9 @@ def test_create_feature_flattened_error(): @pytest.mark.asyncio async def test_create_feature_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feature), "__call__") as call: @@ -2137,7 +2446,9 @@ async def test_create_feature_flattened_async(): @pytest.mark.asyncio async def test_create_feature_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2150,10 +2461,17 @@ async def test_create_feature_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.DeleteMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteMembershipRequest, + dict, + ], +) def test_delete_membership(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2181,7 +2499,8 @@ def test_delete_membership_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2199,7 +2518,8 @@ async def test_delete_membership_async( transport: str = "grpc_asyncio", request_type=service.DeleteMembershipRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2231,7 +2551,9 @@ async def test_delete_membership_async_from_dict(): def test_delete_membership_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -2253,12 +2575,17 @@ def test_delete_membership_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 async def test_delete_membership_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -2282,11 +2609,16 @@ async def test_delete_membership_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_membership_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2296,7 +2628,9 @@ def test_delete_membership_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_membership(name="name_value",) + client.delete_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2308,19 +2642,24 @@ def test_delete_membership_flattened(): def test_delete_membership_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_membership( - service.DeleteMembershipRequest(), name="name_value", + service.DeleteMembershipRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_membership_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2334,7 +2673,9 @@ async def test_delete_membership_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_membership(name="name_value",) + response = await client.delete_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2347,20 +2688,30 @@ async def test_delete_membership_flattened_async(): @pytest.mark.asyncio async def test_delete_membership_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_membership( - service.DeleteMembershipRequest(), name="name_value", + service.DeleteMembershipRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.DeleteFeatureRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteFeatureRequest, + dict, + ], +) def test_delete_feature(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2386,7 +2737,8 @@ def test_delete_feature_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2402,7 +2754,8 @@ async def test_delete_feature_async( transport: str = "grpc_asyncio", request_type=service.DeleteFeatureRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2432,7 +2785,9 @@ async def test_delete_feature_async_from_dict(): def test_delete_feature_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -2452,12 +2807,17 @@ def test_delete_feature_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 async def test_delete_feature_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -2479,11 +2839,16 @@ async def test_delete_feature_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_feature_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feature), "__call__") as call: @@ -2491,7 +2856,9 @@ def test_delete_feature_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_feature(name="name_value",) + client.delete_feature( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2503,19 +2870,24 @@ def test_delete_feature_flattened(): def test_delete_feature_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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_feature( - service.DeleteFeatureRequest(), name="name_value", + service.DeleteFeatureRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_feature_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feature), "__call__") as call: @@ -2527,7 +2899,9 @@ async def test_delete_feature_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_feature(name="name_value",) + response = await client.delete_feature( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2540,20 +2914,30 @@ async def test_delete_feature_flattened_async(): @pytest.mark.asyncio async def test_delete_feature_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_feature( - service.DeleteFeatureRequest(), name="name_value", + service.DeleteFeatureRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdateMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateMembershipRequest, + dict, + ], +) def test_update_membership(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2581,7 +2965,8 @@ def test_update_membership_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2599,7 +2984,8 @@ async def test_update_membership_async( transport: str = "grpc_asyncio", request_type=service.UpdateMembershipRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2631,7 +3017,9 @@ async def test_update_membership_async_from_dict(): def test_update_membership_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -2653,12 +3041,17 @@ def test_update_membership_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 async def test_update_membership_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -2682,11 +3075,16 @@ async def test_update_membership_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_membership_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2728,7 +3126,9 @@ def test_update_membership_flattened(): def test_update_membership_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2749,7 +3149,9 @@ def test_update_membership_flattened_error(): @pytest.mark.asyncio async def test_update_membership_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2796,7 +3198,9 @@ async def test_update_membership_flattened_async(): @pytest.mark.asyncio async def test_update_membership_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2815,10 +3219,17 @@ async def test_update_membership_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.UpdateFeatureRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateFeatureRequest, + dict, + ], +) def test_update_feature(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2844,7 +3255,8 @@ def test_update_feature_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2860,7 +3272,8 @@ async def test_update_feature_async( transport: str = "grpc_asyncio", request_type=service.UpdateFeatureRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2890,7 +3303,9 @@ async def test_update_feature_async_from_dict(): def test_update_feature_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -2910,12 +3325,17 @@ def test_update_feature_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 async def test_update_feature_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -2937,11 +3357,16 @@ async def test_update_feature_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_feature_flattened(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feature), "__call__") as call: @@ -2971,7 +3396,9 @@ def test_update_feature_flattened(): def test_update_feature_flattened_error(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2986,7 +3413,9 @@ def test_update_feature_flattened_error(): @pytest.mark.asyncio async def test_update_feature_flattened_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feature), "__call__") as call: @@ -3021,7 +3450,9 @@ async def test_update_feature_flattened_async(): @pytest.mark.asyncio async def test_update_feature_flattened_error_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3035,11 +3466,16 @@ async def test_update_feature_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [service.GenerateConnectManifestRequest, dict,] + "request_type", + [ + service.GenerateConnectManifestRequest, + dict, + ], ) def test_generate_connect_manifest(request_type, transport: str = "grpc"): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3067,7 +3503,8 @@ def test_generate_connect_manifest_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 = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3085,7 +3522,8 @@ async def test_generate_connect_manifest_async( transport: str = "grpc_asyncio", request_type=service.GenerateConnectManifestRequest ): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3117,7 +3555,9 @@ async def test_generate_connect_manifest_async_from_dict(): def test_generate_connect_manifest_field_headers(): - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubClient( + 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. @@ -3139,12 +3579,17 @@ def test_generate_connect_manifest_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 async def test_generate_connect_manifest_field_headers_async(): - client = GkeHubAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = GkeHubAsyncClient( + 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. @@ -3168,7 +3613,10 @@ async def test_generate_connect_manifest_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_credentials_transport_error(): @@ -3178,7 +3626,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GkeHubClient( - 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. @@ -3198,7 +3647,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = GkeHubClient(client_options=options, transport=transport,) + client = GkeHubClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3214,7 +3666,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GkeHubClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3244,7 +3697,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.GkeHubGrpcTransport, transports.GkeHubGrpcAsyncIOTransport,], + [ + transports.GkeHubGrpcTransport, + transports.GkeHubGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3256,8 +3712,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.GkeHubGrpcTransport,) + client = GkeHubClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.GkeHubGrpcTransport, + ) def test_gke_hub_base_transport_error(): @@ -3317,7 +3778,8 @@ def test_gke_hub_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GkeHubTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3352,7 +3814,10 @@ def test_gke_hub_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.GkeHubGrpcTransport, transports.GkeHubGrpcAsyncIOTransport,], + [ + transports.GkeHubGrpcTransport, + transports.GkeHubGrpcAsyncIOTransport, + ], ) def test_gke_hub_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -3469,7 +3934,8 @@ def test_gke_hub_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.GkeHubGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3481,7 +3947,8 @@ def test_gke_hub_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.GkeHubGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3582,12 +4049,16 @@ def test_gke_hub_transport_channel_mtls_with_adc(transport_class): def test_gke_hub_grpc_lro_client(): client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3595,12 +4066,16 @@ def test_gke_hub_grpc_lro_client(): def test_gke_hub_grpc_lro_async_client(): client = GkeHubAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3611,7 +4086,9 @@ def test_feature_path(): location = "clam" feature = "whelk" expected = "projects/{project}/locations/{location}/features/{feature}".format( - project=project, location=location, feature=feature, + project=project, + location=location, + feature=feature, ) actual = GkeHubClient.feature_path(project, location, feature) assert expected == actual @@ -3634,8 +4111,12 @@ def test_membership_path(): project = "cuttlefish" location = "mussel" membership = "winkle" - expected = "projects/{project}/locations/{location}/memberships/{membership}".format( - project=project, location=location, membership=membership, + expected = ( + "projects/{project}/locations/{location}/memberships/{membership}".format( + project=project, + location=location, + membership=membership, + ) ) actual = GkeHubClient.membership_path(project, location, membership) assert expected == actual @@ -3676,7 +4157,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GkeHubClient.common_folder_path(folder) assert expected == actual @@ -3694,7 +4177,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GkeHubClient.common_organization_path(organization) assert expected == actual @@ -3712,7 +4197,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GkeHubClient.common_project_path(project) assert expected == actual @@ -3732,7 +4219,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GkeHubClient.common_location_path(project, location) assert expected == actual @@ -3757,7 +4245,8 @@ def test_client_with_default_client_info(): transports.GkeHubTransport, "_prep_wrapped_messages" ) as prep: client = GkeHubClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3766,7 +4255,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GkeHubClient.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) @@ -3774,7 +4264,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = GkeHubAsyncClient( - 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" diff --git a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py index 6243aea12cc6..1584155fb878 100644 --- a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py +++ b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py @@ -98,7 +98,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [GkeHubMembershipServiceClient, GkeHubMembershipServiceAsyncClient,] + "client_class", + [ + GkeHubMembershipServiceClient, + GkeHubMembershipServiceAsyncClient, + ], ) def test_gke_hub_membership_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -140,7 +144,11 @@ def test_gke_hub_membership_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [GkeHubMembershipServiceClient, GkeHubMembershipServiceAsyncClient,] + "client_class", + [ + GkeHubMembershipServiceClient, + GkeHubMembershipServiceAsyncClient, + ], ) def test_gke_hub_membership_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -524,7 +532,9 @@ def test_gke_hub_membership_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) @@ -664,10 +674,17 @@ def test_gke_hub_membership_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [membership.ListMembershipsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.ListMembershipsRequest, + dict, + ], +) def test_list_memberships(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -678,7 +695,8 @@ def test_list_memberships(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_memberships), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = membership.ListMembershipsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_memberships(request) @@ -697,7 +715,8 @@ def test_list_memberships_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -713,7 +732,8 @@ async def test_list_memberships_async( transport: str = "grpc_asyncio", request_type=membership.ListMembershipsRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -770,7 +790,10 @@ def test_list_memberships_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 @@ -799,7 +822,10 @@ async def test_list_memberships_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_memberships_flattened(): @@ -813,7 +839,9 @@ def test_list_memberships_flattened(): call.return_value = membership.ListMembershipsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_memberships(parent="parent_value",) + client.list_memberships( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -833,7 +861,8 @@ def test_list_memberships_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_memberships( - membership.ListMembershipsRequest(), parent="parent_value", + membership.ListMembershipsRequest(), + parent="parent_value", ) @@ -853,7 +882,9 @@ async def test_list_memberships_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_memberships(parent="parent_value",) + response = await client.list_memberships( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -874,13 +905,15 @@ async def test_list_memberships_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_memberships( - membership.ListMembershipsRequest(), parent="parent_value", + membership.ListMembershipsRequest(), + parent="parent_value", ) def test_list_memberships_pager(transport_name: str = "grpc"): client = GkeHubMembershipServiceClient( - 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. @@ -895,12 +928,21 @@ def test_list_memberships_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - membership.ListMembershipsResponse(resources=[], next_page_token="def",), membership.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), membership.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + membership.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -920,7 +962,8 @@ def test_list_memberships_pager(transport_name: str = "grpc"): def test_list_memberships_pages(transport_name: str = "grpc"): client = GkeHubMembershipServiceClient( - 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. @@ -935,12 +978,21 @@ def test_list_memberships_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - membership.ListMembershipsResponse(resources=[], next_page_token="def",), membership.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), membership.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + membership.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -969,16 +1021,27 @@ async def test_list_memberships_async_pager(): ], next_page_token="abc", ), - membership.ListMembershipsResponse(resources=[], next_page_token="def",), membership.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), membership.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + membership.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) - async_pager = await client.list_memberships(request={},) + async_pager = await client.list_memberships( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1008,12 +1071,21 @@ async def test_list_memberships_async_pages(): ], next_page_token="abc", ), - membership.ListMembershipsResponse(resources=[], next_page_token="def",), membership.ListMembershipsResponse( - resources=[membership.Membership(),], next_page_token="ghi", + resources=[], + next_page_token="def", ), membership.ListMembershipsResponse( - resources=[membership.Membership(), membership.Membership(),], + resources=[ + membership.Membership(), + ], + next_page_token="ghi", + ), + membership.ListMembershipsResponse( + resources=[ + membership.Membership(), + membership.Membership(), + ], ), RuntimeError, ) @@ -1024,10 +1096,17 @@ async def test_list_memberships_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [membership.GetMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.GetMembershipRequest, + dict, + ], +) def test_get_membership(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1069,7 +1148,8 @@ def test_get_membership_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1085,7 +1165,8 @@ async def test_get_membership_async( transport: str = "grpc_asyncio", request_type=membership.GetMembershipRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1150,7 +1231,10 @@ def test_get_membership_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 @@ -1179,7 +1263,10 @@ async def test_get_membership_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_membership_flattened(): @@ -1193,7 +1280,9 @@ def test_get_membership_flattened(): call.return_value = membership.Membership() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_membership(name="name_value",) + client.get_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1213,7 +1302,8 @@ def test_get_membership_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_membership( - membership.GetMembershipRequest(), name="name_value", + membership.GetMembershipRequest(), + name="name_value", ) @@ -1233,7 +1323,9 @@ async def test_get_membership_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_membership(name="name_value",) + response = await client.get_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1254,14 +1346,22 @@ async def test_get_membership_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_membership( - membership.GetMembershipRequest(), name="name_value", + membership.GetMembershipRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [membership.CreateMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.CreateMembershipRequest, + dict, + ], +) def test_create_membership(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1289,7 +1389,8 @@ def test_create_membership_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1307,7 +1408,8 @@ async def test_create_membership_async( transport: str = "grpc_asyncio", request_type=membership.CreateMembershipRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1363,7 +1465,10 @@ def test_create_membership_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 @@ -1394,7 +1499,10 @@ async def test_create_membership_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_membership_flattened(): @@ -1503,10 +1611,17 @@ async def test_create_membership_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [membership.DeleteMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.DeleteMembershipRequest, + dict, + ], +) def test_delete_membership(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1534,7 +1649,8 @@ def test_delete_membership_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1552,7 +1668,8 @@ async def test_delete_membership_async( transport: str = "grpc_asyncio", request_type=membership.DeleteMembershipRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1608,7 +1725,10 @@ def test_delete_membership_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 @@ -1639,7 +1759,10 @@ async def test_delete_membership_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_membership_flattened(): @@ -1655,7 +1778,9 @@ def test_delete_membership_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_membership(name="name_value",) + client.delete_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1675,7 +1800,8 @@ def test_delete_membership_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_membership( - membership.DeleteMembershipRequest(), name="name_value", + membership.DeleteMembershipRequest(), + name="name_value", ) @@ -1697,7 +1823,9 @@ async def test_delete_membership_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_membership(name="name_value",) + response = await client.delete_membership( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1718,14 +1846,22 @@ async def test_delete_membership_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_membership( - membership.DeleteMembershipRequest(), name="name_value", + membership.DeleteMembershipRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [membership.UpdateMembershipRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.UpdateMembershipRequest, + dict, + ], +) def test_update_membership(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1753,7 +1889,8 @@ def test_update_membership_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1771,7 +1908,8 @@ async def test_update_membership_async( transport: str = "grpc_asyncio", request_type=membership.UpdateMembershipRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1827,7 +1965,10 @@ def test_update_membership_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 @@ -1858,7 +1999,10 @@ async def test_update_membership_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_membership_flattened(): @@ -1968,11 +2112,16 @@ async def test_update_membership_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [membership.GenerateConnectManifestRequest, dict,] + "request_type", + [ + membership.GenerateConnectManifestRequest, + dict, + ], ) def test_generate_connect_manifest(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2000,7 +2149,8 @@ def test_generate_connect_manifest_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2019,7 +2169,8 @@ async def test_generate_connect_manifest_async( request_type=membership.GenerateConnectManifestRequest, ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2075,7 +2226,10 @@ def test_generate_connect_manifest_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 @@ -2106,13 +2260,23 @@ async def test_generate_connect_manifest_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"] -@pytest.mark.parametrize("request_type", [membership.ValidateExclusivityRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + membership.ValidateExclusivityRequest, + dict, + ], +) def test_validate_exclusivity(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2140,7 +2304,8 @@ def test_validate_exclusivity_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2158,7 +2323,8 @@ async def test_validate_exclusivity_async( transport: str = "grpc_asyncio", request_type=membership.ValidateExclusivityRequest ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2214,7 +2380,10 @@ def test_validate_exclusivity_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 @@ -2245,15 +2414,23 @@ async def test_validate_exclusivity_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"] @pytest.mark.parametrize( - "request_type", [membership.GenerateExclusivityManifestRequest, dict,] + "request_type", + [ + membership.GenerateExclusivityManifestRequest, + dict, + ], ) def test_generate_exclusivity_manifest(request_type, transport: str = "grpc"): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2266,7 +2443,8 @@ def test_generate_exclusivity_manifest(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = membership.GenerateExclusivityManifestResponse( - crd_manifest="crd_manifest_value", cr_manifest="cr_manifest_value", + crd_manifest="crd_manifest_value", + cr_manifest="cr_manifest_value", ) response = client.generate_exclusivity_manifest(request) @@ -2285,7 +2463,8 @@ def test_generate_exclusivity_manifest_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 = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2304,7 +2483,8 @@ async def test_generate_exclusivity_manifest_async( request_type=membership.GenerateExclusivityManifestRequest, ): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2318,7 +2498,8 @@ async def test_generate_exclusivity_manifest_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( membership.GenerateExclusivityManifestResponse( - crd_manifest="crd_manifest_value", cr_manifest="cr_manifest_value", + crd_manifest="crd_manifest_value", + cr_manifest="cr_manifest_value", ) ) response = await client.generate_exclusivity_manifest(request) @@ -2364,7 +2545,10 @@ def test_generate_exclusivity_manifest_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 @@ -2395,7 +2579,10 @@ async def test_generate_exclusivity_manifest_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_credentials_transport_error(): @@ -2405,7 +2592,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GkeHubMembershipServiceClient( - 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. @@ -2426,7 +2614,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = GkeHubMembershipServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2443,7 +2632,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GkeHubMembershipServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2492,7 +2682,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.GkeHubMembershipServiceGrpcTransport, + client.transport, + transports.GkeHubMembershipServiceGrpcTransport, ) @@ -2550,7 +2741,8 @@ def test_gke_hub_membership_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GkeHubMembershipServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2712,7 +2904,8 @@ def test_gke_hub_membership_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.GkeHubMembershipServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2724,7 +2917,8 @@ def test_gke_hub_membership_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.GkeHubMembershipServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2833,12 +3027,16 @@ def test_gke_hub_membership_service_transport_channel_mtls_with_adc(transport_cl def test_gke_hub_membership_service_grpc_lro_client(): client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2846,12 +3044,16 @@ def test_gke_hub_membership_service_grpc_lro_client(): def test_gke_hub_membership_service_grpc_lro_async_client(): client = GkeHubMembershipServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2861,8 +3063,12 @@ def test_membership_path(): project = "squid" location = "clam" membership = "whelk" - expected = "projects/{project}/locations/{location}/memberships/{membership}".format( - project=project, location=location, membership=membership, + expected = ( + "projects/{project}/locations/{location}/memberships/{membership}".format( + project=project, + location=location, + membership=membership, + ) ) actual = GkeHubMembershipServiceClient.membership_path( project, location, membership @@ -2905,7 +3111,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 = GkeHubMembershipServiceClient.common_folder_path(folder) assert expected == actual @@ -2923,7 +3131,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 = GkeHubMembershipServiceClient.common_organization_path(organization) assert expected == actual @@ -2941,7 +3151,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 = GkeHubMembershipServiceClient.common_project_path(project) assert expected == actual @@ -2961,7 +3173,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 = GkeHubMembershipServiceClient.common_location_path(project, location) assert expected == actual @@ -2986,7 +3199,8 @@ def test_client_with_default_client_info(): transports.GkeHubMembershipServiceTransport, "_prep_wrapped_messages" ) as prep: client = GkeHubMembershipServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2995,7 +3209,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GkeHubMembershipServiceClient.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) @@ -3003,7 +3218,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = GkeHubMembershipServiceAsyncClient( - 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"