From 081581c54a3862c0f118b2607f83ca8f383ed772 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:56:14 +0000 Subject: [PATCH 01/18] chore(python): use black==22.3.0 (#129) 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 +- docs/conf.py | 5 +- .../async_client.py | 52 ++- .../binauthz_management_service_v1/client.py | 107 ++++- .../transports/base.py | 10 +- .../transports/grpc.py | 3 +- .../services/system_policy_v1/async_client.py | 7 +- .../services/system_policy_v1/client.py | 56 ++- .../system_policy_v1/transports/base.py | 10 +- .../system_policy_v1/transports/grpc.py | 3 +- .../validation_helper_v1/async_client.py | 7 +- .../services/validation_helper_v1/client.py | 46 +- .../validation_helper_v1/transports/base.py | 6 +- .../validation_helper_v1/transports/grpc.py | 3 +- .../binaryauthorization_v1/types/resources.py | 135 ++++-- .../binaryauthorization_v1/types/service.py | 102 ++++- .../async_client.py | 52 ++- .../client.py | 107 ++++- .../transports/base.py | 10 +- .../transports/grpc.py | 3 +- .../system_policy_v1_beta1/async_client.py | 7 +- .../services/system_policy_v1_beta1/client.py | 54 ++- .../system_policy_v1_beta1/transports/base.py | 10 +- .../system_policy_v1_beta1/transports/grpc.py | 3 +- .../types/continuous_validation_logging.py | 37 +- .../types/resources.py | 135 ++++-- .../types/service.py | 72 ++- noxfile.py | 9 +- .../test_binauthz_management_service_v1.py | 418 +++++++++++++----- .../test_system_policy_v1.py | 126 ++++-- .../test_validation_helper_v1.py | 90 +++- ...st_binauthz_management_service_v1_beta1.py | 408 ++++++++++++----- .../test_system_policy_v1_beta1.py | 110 +++-- 33 files changed, 1686 insertions(+), 519 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..87dd006 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.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/docs/conf.py b/docs/conf.py index 3e51f11..3551c21 100644 --- a/docs/conf.py +++ b/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/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index 87a44fb..ce37151 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -333,7 +333,12 @@ def sample_get_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -451,7 +456,12 @@ def sample_update_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -581,7 +591,12 @@ def sample_create_attestor(): ) # 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 @@ -688,7 +703,12 @@ def sample_get_attestor(): ) # 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 @@ -804,7 +824,12 @@ def sample_update_attestor(): ) # 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 @@ -912,12 +937,20 @@ def sample_list_attestors(): ) # 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.ListAttestorsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1016,7 +1049,10 @@ def sample_delete_attestor(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py index bf06a79..806177d 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py @@ -62,7 +62,8 @@ class BinauthzManagementServiceV1ClientMeta(type): ] = BinauthzManagementServiceV1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BinauthzManagementServiceV1Transport]: """Returns an appropriate transport class. @@ -177,10 +178,14 @@ def transport(self) -> BinauthzManagementServiceV1Transport: return self._transport @staticmethod - def attestor_path(project: str, attestor: str,) -> str: + def attestor_path( + project: str, + attestor: str, + ) -> str: """Returns a fully-qualified attestor string.""" return "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) @staticmethod @@ -190,9 +195,13 @@ def parse_attestor_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -201,7 +210,9 @@ def parse_policy_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, @@ -214,9 +225,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]: @@ -225,9 +240,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]: @@ -236,9 +255,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]: @@ -247,10 +270,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 @@ -521,7 +548,12 @@ def sample_get_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -629,7 +661,12 @@ def sample_update_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -759,7 +796,12 @@ def sample_create_attestor(): ) # 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 @@ -856,7 +898,12 @@ def sample_get_attestor(): ) # 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 @@ -962,7 +1009,12 @@ def sample_update_attestor(): ) # 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 @@ -1060,12 +1112,20 @@ def sample_list_attestors(): ) # 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.ListAttestorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1154,7 +1214,10 @@ def sample_delete_attestor(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py index 8ca9c25..335e67b 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py @@ -153,7 +153,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_attestor: gapic_v1.method.wrap_method( - self.create_attestor, default_timeout=600.0, client_info=client_info, + self.create_attestor, + default_timeout=600.0, + client_info=client_info, ), self.get_attestor: gapic_v1.method.wrap_method( self.get_attestor, @@ -220,9 +222,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/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py index aaa204c..e390357 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py @@ -232,8 +232,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/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index 13997b9..51c8d66 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -291,7 +291,12 @@ def sample_get_system_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py index e8f4d10..0d80e13 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py @@ -56,7 +56,10 @@ class SystemPolicyV1ClientMeta(type): _transport_registry["grpc"] = SystemPolicyV1GrpcTransport _transport_registry["grpc_asyncio"] = SystemPolicyV1GrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[SystemPolicyV1Transport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SystemPolicyV1Transport]: """Returns an appropriate transport class. Args: @@ -161,9 +164,13 @@ def transport(self) -> SystemPolicyV1Transport: return self._transport @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -172,7 +179,9 @@ def parse_policy_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, @@ -185,9 +194,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]: @@ -196,9 +209,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]: @@ -207,9 +224,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]: @@ -218,10 +239,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 @@ -483,7 +508,12 @@ def sample_get_system_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py index cdaedf4..89205be 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py @@ -122,16 +122,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get_system_policy: gapic_v1.method.wrap_method( - self.get_system_policy, default_timeout=None, client_info=client_info, + self.get_system_policy, + default_timeout=None, + client_info=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/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py index 7706211..0e0120e 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py @@ -225,8 +225,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/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 9858b14..4f8f5a5 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -267,7 +267,12 @@ def sample_validate_attestation_occurrence(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py index 554605d..df2e53f 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py @@ -55,7 +55,8 @@ class ValidationHelperV1ClientMeta(type): _transport_registry["grpc_asyncio"] = ValidationHelperV1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[ValidationHelperV1Transport]: """Returns an appropriate transport class. @@ -161,7 +162,9 @@ def transport(self) -> ValidationHelperV1Transport: return self._transport @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, @@ -174,9 +177,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]: @@ -185,9 +192,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]: @@ -196,9 +207,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]: @@ -207,10 +222,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 @@ -454,7 +473,12 @@ def sample_validate_attestation_occurrence(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py index 5268466..5a486f1 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py @@ -130,9 +130,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/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py index ef1c5f6..166513b 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py @@ -224,8 +224,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/google/cloud/binaryauthorization_v1/types/resources.py b/google/cloud/binaryauthorization_v1/types/resources.py index 7838f10..1b244c9 100644 --- a/google/cloud/binaryauthorization_v1/types/resources.py +++ b/google/cloud/binaryauthorization_v1/types/resources.py @@ -94,30 +94,58 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) global_policy_evaluation_mode = proto.Field( - proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, + proto.ENUM, + number=7, + enum=GlobalPolicyEvaluationMode, ) admission_whitelist_patterns = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", + proto.MESSAGE, + number=2, + message="AdmissionWhitelistPattern", ) cluster_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=3, + message="AdmissionRule", ) kubernetes_namespace_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=10, + message="AdmissionRule", ) kubernetes_service_account_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=8, + message="AdmissionRule", ) istio_service_identity_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=9, + message="AdmissionRule", ) default_admission_rule = proto.Field( - proto.MESSAGE, number=4, message="AdmissionRule", + proto.MESSAGE, + number=4, + message="AdmissionRule", + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class AdmissionWhitelistPattern(proto.Message): @@ -135,7 +163,10 @@ class AdmissionWhitelistPattern(proto.Message): wildcard which matches subdirectories of a given entry. """ - name_pattern = proto.Field(proto.STRING, number=1,) + name_pattern = proto.Field( + proto.STRING, + number=1, + ) class AdmissionRule(proto.Message): @@ -187,9 +218,20 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field(proto.ENUM, number=1, enum=EvaluationMode,) - require_attestations_by = proto.RepeatedField(proto.STRING, number=2,) - enforcement_mode = proto.Field(proto.ENUM, number=3, enum=EnforcementMode,) + evaluation_mode = proto.Field( + proto.ENUM, + number=1, + enum=EvaluationMode, + ) + require_attestations_by = proto.RepeatedField( + proto.STRING, + number=2, + ) + enforcement_mode = proto.Field( + proto.ENUM, + number=3, + enum=EnforcementMode, + ) class Attestor(proto.Message): @@ -219,12 +261,25 @@ class Attestor(proto.Message): updated. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) user_owned_grafeas_note = proto.Field( - proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedGrafeasNote", + proto.MESSAGE, + number=3, + oneof="attestor_type", + message="UserOwnedGrafeasNote", + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) class UserOwnedGrafeasNote(proto.Message): @@ -268,11 +323,19 @@ class UserOwnedGrafeasNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field(proto.STRING, number=1,) + note_reference = proto.Field( + proto.STRING, + number=1, + ) public_keys = proto.RepeatedField( - proto.MESSAGE, number=2, message="AttestorPublicKey", + proto.MESSAGE, + number=2, + message="AttestorPublicKey", + ) + delegation_service_account_email = proto.Field( + proto.STRING, + number=3, ) - delegation_service_account_email = proto.Field(proto.STRING, number=3,) class PkixPublicKey(proto.Message): @@ -319,8 +382,15 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field(proto.STRING, number=1,) - signature_algorithm = proto.Field(proto.ENUM, number=2, enum=SignatureAlgorithm,) + public_key_pem = proto.Field( + proto.STRING, + number=1, + ) + signature_algorithm = proto.Field( + proto.ENUM, + number=2, + enum=SignatureAlgorithm, + ) class AttestorPublicKey(proto.Message): @@ -370,13 +440,24 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + comment = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) ascii_armored_pgp_public_key = proto.Field( - proto.STRING, number=3, oneof="public_key", + proto.STRING, + number=3, + oneof="public_key", ) pkix_public_key = proto.Field( - proto.MESSAGE, number=5, oneof="public_key", message="PkixPublicKey", + proto.MESSAGE, + number=5, + oneof="public_key", + message="PkixPublicKey", ) diff --git a/google/cloud/binaryauthorization_v1/types/service.py b/google/cloud/binaryauthorization_v1/types/service.py index b1a8640..eaf253c 100644 --- a/google/cloud/binaryauthorization_v1/types/service.py +++ b/google/cloud/binaryauthorization_v1/types/service.py @@ -47,7 +47,10 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdatePolicyRequest(proto.Message): @@ -63,7 +66,11 @@ class UpdatePolicyRequest(proto.Message): ``projects/*/policy``. """ - policy = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,) + policy = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Policy, + ) class CreateAttestorRequest(proto.Message): @@ -86,9 +93,19 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field(proto.STRING, number=1,) - attestor_id = proto.Field(proto.STRING, number=2,) - attestor = proto.Field(proto.MESSAGE, number=3, message=resources.Attestor,) + parent = proto.Field( + proto.STRING, + number=1, + ) + attestor_id = proto.Field( + proto.STRING, + number=2, + ) + attestor = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Attestor, + ) class GetAttestorRequest(proto.Message): @@ -101,7 +118,10 @@ class GetAttestorRequest(proto.Message): retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateAttestorRequest(proto.Message): @@ -117,7 +137,11 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field(proto.MESSAGE, number=1, message=resources.Attestor,) + attestor = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) class ListAttestorsRequest(proto.Message): @@ -141,9 +165,18 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAttestorsResponse(proto.Message): @@ -166,9 +199,14 @@ def raw_page(self): return self attestors = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.Attestor, + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeleteAttestorRequest(proto.Message): @@ -181,7 +219,10 @@ class DeleteAttestorRequest(proto.Message): delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetSystemPolicyRequest(proto.Message): @@ -194,7 +235,10 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ValidateAttestationOccurrenceRequest(proto.Message): @@ -223,12 +267,23 @@ class ValidateAttestationOccurrenceRequest(proto.Message): [Occurrence][grafeas.v1.Occurrence]. """ - attestor = proto.Field(proto.STRING, number=1,) + attestor = proto.Field( + proto.STRING, + number=1, + ) attestation = proto.Field( - proto.MESSAGE, number=2, message=attestation.AttestationOccurrence, + proto.MESSAGE, + number=2, + message=attestation.AttestationOccurrence, + ) + occurrence_note = proto.Field( + proto.STRING, + number=3, + ) + occurrence_resource_uri = proto.Field( + proto.STRING, + number=4, ) - occurrence_note = proto.Field(proto.STRING, number=3,) - occurrence_resource_uri = proto.Field(proto.STRING, number=4,) class ValidateAttestationOccurrenceResponse(proto.Message): @@ -249,8 +304,15 @@ class Result(proto.Enum): VERIFIED = 1 ATTESTATION_NOT_VERIFIABLE = 2 - result = proto.Field(proto.ENUM, number=1, enum=Result,) - denial_reason = proto.Field(proto.STRING, number=2,) + result = proto.Field( + proto.ENUM, + number=1, + enum=Result, + ) + denial_reason = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 51eb8e0..8662108 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -343,7 +343,12 @@ def sample_get_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -462,7 +467,12 @@ def sample_update_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -593,7 +603,12 @@ def sample_create_attestor(): ) # 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 @@ -700,7 +715,12 @@ def sample_get_attestor(): ) # 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 @@ -816,7 +836,12 @@ def sample_update_attestor(): ) # 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 @@ -925,12 +950,20 @@ def sample_list_attestors(): ) # 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.ListAttestorsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1029,7 +1062,10 @@ def sample_delete_attestor(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py index 7e2a9fa..3d4f261 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py @@ -67,7 +67,8 @@ class BinauthzManagementServiceV1Beta1ClientMeta(type): ] = BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BinauthzManagementServiceV1Beta1Transport]: """Returns an appropriate transport class. @@ -182,10 +183,14 @@ def transport(self) -> BinauthzManagementServiceV1Beta1Transport: return self._transport @staticmethod - def attestor_path(project: str, attestor: str,) -> str: + def attestor_path( + project: str, + attestor: str, + ) -> str: """Returns a fully-qualified attestor string.""" return "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) @staticmethod @@ -195,9 +200,13 @@ def parse_attestor_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -206,7 +215,9 @@ def parse_policy_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, @@ -219,9 +230,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]: @@ -230,9 +245,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]: @@ -241,9 +260,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]: @@ -252,10 +275,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 @@ -529,7 +556,12 @@ def sample_get_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,7 +670,12 @@ def sample_update_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -769,7 +806,12 @@ def sample_create_attestor(): ) # 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 @@ -866,7 +908,12 @@ def sample_get_attestor(): ) # 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 @@ -972,7 +1019,12 @@ def sample_update_attestor(): ) # 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 @@ -1071,12 +1123,20 @@ def sample_list_attestors(): ) # 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.ListAttestorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1165,7 +1225,10 @@ def sample_delete_attestor(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py index dd724ae..5555449 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py @@ -153,7 +153,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_attestor: gapic_v1.method.wrap_method( - self.create_attestor, default_timeout=600.0, client_info=client_info, + self.create_attestor, + default_timeout=600.0, + client_info=client_info, ), self.get_attestor: gapic_v1.method.wrap_method( self.get_attestor, @@ -220,9 +222,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/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py index f89bb42..c9a0b6e 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py @@ -234,8 +234,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/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index c5319ae..ec901b0 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -293,7 +293,12 @@ def sample_get_system_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py index 9195fca..bd0f7a8 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py @@ -57,7 +57,8 @@ class SystemPolicyV1Beta1ClientMeta(type): _transport_registry["grpc_asyncio"] = SystemPolicyV1Beta1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SystemPolicyV1Beta1Transport]: """Returns an appropriate transport class. @@ -163,9 +164,13 @@ def transport(self) -> SystemPolicyV1Beta1Transport: return self._transport @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -174,7 +179,9 @@ def parse_policy_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, @@ -187,9 +194,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]: @@ -198,9 +209,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]: @@ -209,9 +224,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]: @@ -220,10 +239,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 @@ -486,7 +509,12 @@ def sample_get_system_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py index c770144..8db9662 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py @@ -122,16 +122,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get_system_policy: gapic_v1.method.wrap_method( - self.get_system_policy, default_timeout=None, client_info=client_info, + self.get_system_policy, + default_timeout=None, + client_info=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/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py index 0d5d12a..a77287f 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py @@ -225,8 +225,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/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py index d197207..f3a1f49 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py +++ b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py @@ -20,7 +20,9 @@ __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1beta1", - manifest={"ContinuousValidationEvent",}, + manifest={ + "ContinuousValidationEvent", + }, ) @@ -85,20 +87,33 @@ class AuditResult(proto.Enum): ALLOW = 1 DENY = 2 - image = proto.Field(proto.STRING, number=1,) + image = proto.Field( + proto.STRING, + number=1, + ) result = proto.Field( proto.ENUM, number=2, enum="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.AuditResult", ) - description = proto.Field(proto.STRING, number=3,) + description = proto.Field( + proto.STRING, + number=3, + ) - pod = proto.Field(proto.STRING, number=1,) + pod = proto.Field( + proto.STRING, + number=1, + ) deploy_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) end_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) verdict = proto.Field( proto.ENUM, @@ -120,7 +135,10 @@ class UnsupportedPolicyEvent(proto.Message): A description of the unsupported policy. """ - description = proto.Field(proto.STRING, number=1,) + description = proto.Field( + proto.STRING, + number=1, + ) pod_event = proto.Field( proto.MESSAGE, @@ -129,7 +147,10 @@ class UnsupportedPolicyEvent(proto.Message): message=ContinuousValidationPodEvent, ) unsupported_policy_event = proto.Field( - proto.MESSAGE, number=2, oneof="event_type", message=UnsupportedPolicyEvent, + proto.MESSAGE, + number=2, + oneof="event_type", + message=UnsupportedPolicyEvent, ) diff --git a/google/cloud/binaryauthorization_v1beta1/types/resources.py b/google/cloud/binaryauthorization_v1beta1/types/resources.py index 7b57bbc..5323d0b 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/resources.py +++ b/google/cloud/binaryauthorization_v1beta1/types/resources.py @@ -93,30 +93,58 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) global_policy_evaluation_mode = proto.Field( - proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, + proto.ENUM, + number=7, + enum=GlobalPolicyEvaluationMode, ) admission_whitelist_patterns = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", + proto.MESSAGE, + number=2, + message="AdmissionWhitelistPattern", ) cluster_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=3, + message="AdmissionRule", ) kubernetes_namespace_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=10, + message="AdmissionRule", ) kubernetes_service_account_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=8, + message="AdmissionRule", ) istio_service_identity_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=9, + message="AdmissionRule", ) default_admission_rule = proto.Field( - proto.MESSAGE, number=4, message="AdmissionRule", + proto.MESSAGE, + number=4, + message="AdmissionRule", + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class AdmissionWhitelistPattern(proto.Message): @@ -137,7 +165,10 @@ class AdmissionWhitelistPattern(proto.Message): i.e., ``gcr.io/nginx**`` matches ``gcr.io/nginx/image``. """ - name_pattern = proto.Field(proto.STRING, number=1,) + name_pattern = proto.Field( + proto.STRING, + number=1, + ) class AdmissionRule(proto.Message): @@ -189,9 +220,20 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field(proto.ENUM, number=1, enum=EvaluationMode,) - require_attestations_by = proto.RepeatedField(proto.STRING, number=2,) - enforcement_mode = proto.Field(proto.ENUM, number=3, enum=EnforcementMode,) + evaluation_mode = proto.Field( + proto.ENUM, + number=1, + enum=EvaluationMode, + ) + require_attestations_by = proto.RepeatedField( + proto.STRING, + number=2, + ) + enforcement_mode = proto.Field( + proto.ENUM, + number=3, + enum=EnforcementMode, + ) class Attestor(proto.Message): @@ -219,12 +261,25 @@ class Attestor(proto.Message): updated. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) user_owned_drydock_note = proto.Field( - proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedDrydockNote", + proto.MESSAGE, + number=3, + oneof="attestor_type", + message="UserOwnedDrydockNote", + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) class UserOwnedDrydockNote(proto.Message): @@ -268,11 +323,19 @@ class UserOwnedDrydockNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field(proto.STRING, number=1,) + note_reference = proto.Field( + proto.STRING, + number=1, + ) public_keys = proto.RepeatedField( - proto.MESSAGE, number=2, message="AttestorPublicKey", + proto.MESSAGE, + number=2, + message="AttestorPublicKey", + ) + delegation_service_account_email = proto.Field( + proto.STRING, + number=3, ) - delegation_service_account_email = proto.Field(proto.STRING, number=3,) class PkixPublicKey(proto.Message): @@ -319,8 +382,15 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field(proto.STRING, number=1,) - signature_algorithm = proto.Field(proto.ENUM, number=2, enum=SignatureAlgorithm,) + public_key_pem = proto.Field( + proto.STRING, + number=1, + ) + signature_algorithm = proto.Field( + proto.ENUM, + number=2, + enum=SignatureAlgorithm, + ) class AttestorPublicKey(proto.Message): @@ -370,13 +440,24 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + comment = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) ascii_armored_pgp_public_key = proto.Field( - proto.STRING, number=3, oneof="public_key", + proto.STRING, + number=3, + oneof="public_key", ) pkix_public_key = proto.Field( - proto.MESSAGE, number=5, oneof="public_key", message="PkixPublicKey", + proto.MESSAGE, + number=5, + oneof="public_key", + message="PkixPublicKey", ) diff --git a/google/cloud/binaryauthorization_v1beta1/types/service.py b/google/cloud/binaryauthorization_v1beta1/types/service.py index 44fb077..a2ea946 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/service.py +++ b/google/cloud/binaryauthorization_v1beta1/types/service.py @@ -44,7 +44,10 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdatePolicyRequest(proto.Message): @@ -60,7 +63,11 @@ class UpdatePolicyRequest(proto.Message): format ``projects/*/policy``. """ - policy = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,) + policy = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Policy, + ) class CreateAttestorRequest(proto.Message): @@ -83,9 +90,19 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field(proto.STRING, number=1,) - attestor_id = proto.Field(proto.STRING, number=2,) - attestor = proto.Field(proto.MESSAGE, number=3, message=resources.Attestor,) + parent = proto.Field( + proto.STRING, + number=1, + ) + attestor_id = proto.Field( + proto.STRING, + number=2, + ) + attestor = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Attestor, + ) class GetAttestorRequest(proto.Message): @@ -98,7 +115,10 @@ class GetAttestorRequest(proto.Message): to retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateAttestorRequest(proto.Message): @@ -114,7 +134,11 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field(proto.MESSAGE, number=1, message=resources.Attestor,) + attestor = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) class ListAttestorsRequest(proto.Message): @@ -138,9 +162,18 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAttestorsResponse(proto.Message): @@ -163,9 +196,14 @@ def raw_page(self): return self attestors = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.Attestor, + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeleteAttestorRequest(proto.Message): @@ -178,7 +216,10 @@ class DeleteAttestorRequest(proto.Message): to delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetSystemPolicyRequest(proto.Message): @@ -191,7 +232,10 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..3addb4e 100644 --- a/noxfile.py +++ b/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/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index d6b257b..f538d30 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -99,7 +99,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( "client_class", - [BinauthzManagementServiceV1Client, BinauthzManagementServiceV1AsyncClient,], + [ + BinauthzManagementServiceV1Client, + BinauthzManagementServiceV1AsyncClient, + ], ) def test_binauthz_management_service_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -142,7 +145,10 @@ def test_binauthz_management_service_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( "client_class", - [BinauthzManagementServiceV1Client, BinauthzManagementServiceV1AsyncClient,], + [ + BinauthzManagementServiceV1Client, + BinauthzManagementServiceV1AsyncClient, + ], ) def test_binauthz_management_service_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -531,7 +537,9 @@ def test_binauthz_management_service_v1_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) @@ -671,10 +679,17 @@ def test_binauthz_management_service_v1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest, + dict, + ], +) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -710,7 +725,8 @@ def test_get_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -726,7 +742,8 @@ async def test_get_policy_async( transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -788,7 +805,10 @@ def test_get_policy_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 @@ -815,7 +835,10 @@ async def test_get_policy_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_policy_flattened(): @@ -829,7 +852,9 @@ def test_get_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_policy(name="name_value",) + client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -849,7 +874,8 @@ def test_get_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) @@ -867,7 +893,9 @@ async def test_get_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_policy(name="name_value",) + response = await client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -888,14 +916,22 @@ async def test_get_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdatePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest, + dict, + ], +) def test_update_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -931,7 +967,8 @@ def test_update_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -947,7 +984,8 @@ async def test_update_policy_async( transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1009,7 +1047,10 @@ def test_update_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1036,7 +1077,10 @@ async def test_update_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] def test_update_policy_flattened(): @@ -1050,7 +1094,9 @@ def test_update_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_policy(policy=resources.Policy(name="name_value"),) + client.update_policy( + policy=resources.Policy(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1070,7 +1116,8 @@ def test_update_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) @@ -1111,14 +1158,22 @@ async def test_update_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) -@pytest.mark.parametrize("request_type", [service.CreateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest, + dict, + ], +) def test_create_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1152,7 +1207,8 @@ def test_create_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1168,7 +1224,8 @@ async def test_create_attestor_async( transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1179,7 +1236,10 @@ async def test_create_attestor_async( with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.create_attestor(request) @@ -1222,7 +1282,10 @@ def test_create_attestor_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 @@ -1249,7 +1312,10 @@ async def test_create_attestor_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_attestor_flattened(): @@ -1352,10 +1418,17 @@ async def test_create_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.GetAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest, + dict, + ], +) def test_get_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1389,7 +1462,8 @@ def test_get_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1405,7 +1479,8 @@ async def test_get_attestor_async( transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1416,7 +1491,10 @@ async def test_get_attestor_async( with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.get_attestor(request) @@ -1459,7 +1537,10 @@ def test_get_attestor_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 @@ -1486,7 +1567,10 @@ async def test_get_attestor_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_attestor_flattened(): @@ -1500,7 +1584,9 @@ def test_get_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_attestor(name="name_value",) + client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1520,7 +1606,8 @@ def test_get_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) @@ -1538,7 +1625,9 @@ async def test_get_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Attestor()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_attestor(name="name_value",) + response = await client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1559,14 +1648,22 @@ async def test_get_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest, + dict, + ], +) def test_update_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1600,7 +1697,8 @@ def test_update_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1616,7 +1714,8 @@ async def test_update_attestor_async( transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1627,7 +1726,10 @@ async def test_update_attestor_async( with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.update_attestor(request) @@ -1670,9 +1772,10 @@ def test_update_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1699,9 +1802,10 @@ async def test_update_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] def test_update_attestor_flattened(): @@ -1715,7 +1819,9 @@ def test_update_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_attestor(attestor=resources.Attestor(name="name_value"),) + client.update_attestor( + attestor=resources.Attestor(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1782,10 +1888,17 @@ async def test_update_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.ListAttestorsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest, + dict, + ], +) def test_list_attestors(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1814,7 +1927,8 @@ def test_list_attestors_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1830,7 +1944,8 @@ async def test_list_attestors_async( transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1841,7 +1956,9 @@ async def test_list_attestors_async( with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.ListAttestorsResponse(next_page_token="next_page_token_value",) + service.ListAttestorsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_attestors(request) @@ -1883,7 +2000,10 @@ def test_list_attestors_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 @@ -1912,7 +2032,10 @@ async def test_list_attestors_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_attestors_flattened(): @@ -1926,7 +2049,9 @@ def test_list_attestors_flattened(): call.return_value = service.ListAttestorsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_attestors(parent="parent_value",) + client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1946,7 +2071,8 @@ def test_list_attestors_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) @@ -1966,7 +2092,9 @@ async def test_list_attestors_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_attestors(parent="parent_value",) + response = await client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1987,13 +2115,15 @@ async def test_list_attestors_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) def test_list_attestors_pager(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Client( - 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. @@ -2008,12 +2138,21 @@ def test_list_attestors_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2033,7 +2172,8 @@ def test_list_attestors_pager(transport_name: str = "grpc"): def test_list_attestors_pages(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Client( - 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. @@ -2048,12 +2188,21 @@ def test_list_attestors_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2082,16 +2231,27 @@ async def test_list_attestors_async_pager(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) - async_pager = await client.list_attestors(request={},) + async_pager = await client.list_attestors( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2121,12 +2281,21 @@ async def test_list_attestors_async_pages(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2137,10 +2306,17 @@ async def test_list_attestors_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.DeleteAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest, + dict, + ], +) def test_delete_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2166,7 +2342,8 @@ def test_delete_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2182,7 +2359,8 @@ async def test_delete_attestor_async( transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2232,7 +2410,10 @@ def test_delete_attestor_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 @@ -2259,7 +2440,10 @@ async def test_delete_attestor_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_attestor_flattened(): @@ -2273,7 +2457,9 @@ def test_delete_attestor_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_attestor(name="name_value",) + client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2293,7 +2479,8 @@ def test_delete_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2311,7 +2498,9 @@ async def test_delete_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_attestor(name="name_value",) + response = await client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2332,7 +2521,8 @@ async def test_delete_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2343,7 +2533,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - 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. @@ -2364,7 +2555,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2381,7 +2573,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2430,7 +2623,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.BinauthzManagementServiceV1GrpcTransport, + client.transport, + transports.BinauthzManagementServiceV1GrpcTransport, ) @@ -2482,7 +2676,8 @@ def test_binauthz_management_service_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BinauthzManagementServiceV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2647,7 +2842,8 @@ def test_binauthz_management_service_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2659,7 +2855,8 @@ def test_binauthz_management_service_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2772,7 +2969,8 @@ def test_attestor_path(): project = "squid" attestor = "clam" expected = "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) actual = BinauthzManagementServiceV1Client.attestor_path(project, attestor) assert expected == actual @@ -2792,7 +2990,9 @@ def test_parse_attestor_path(): def test_policy_path(): project = "oyster" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = BinauthzManagementServiceV1Client.policy_path(project) assert expected == actual @@ -2832,7 +3032,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 = BinauthzManagementServiceV1Client.common_folder_path(folder) assert expected == actual @@ -2850,7 +3052,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 = BinauthzManagementServiceV1Client.common_organization_path(organization) assert expected == actual @@ -2868,7 +3072,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 = BinauthzManagementServiceV1Client.common_project_path(project) assert expected == actual @@ -2888,7 +3094,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 = BinauthzManagementServiceV1Client.common_location_path(project, location) assert expected == actual @@ -2913,7 +3120,8 @@ def test_client_with_default_client_info(): transports.BinauthzManagementServiceV1Transport, "_prep_wrapped_messages" ) as prep: client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2922,7 +3130,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BinauthzManagementServiceV1Client.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) @@ -2930,7 +3139,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BinauthzManagementServiceV1AsyncClient( - 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/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index dbfcc96..958d771 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -90,7 +90,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Client, SystemPolicyV1AsyncClient,] + "client_class", + [ + SystemPolicyV1Client, + SystemPolicyV1AsyncClient, + ], ) def test_system_policy_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -132,7 +136,11 @@ def test_system_policy_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Client, SystemPolicyV1AsyncClient,] + "client_class", + [ + SystemPolicyV1Client, + SystemPolicyV1AsyncClient, + ], ) def test_system_policy_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -496,7 +504,9 @@ def test_system_policy_v1_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) @@ -636,10 +646,17 @@ def test_system_policy_v1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest, + dict, + ], +) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -677,7 +694,8 @@ def test_get_system_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -695,7 +713,8 @@ async def test_get_system_policy_async( transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest ): client = SystemPolicyV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -737,7 +756,9 @@ async def test_get_system_policy_async_from_dict(): def test_get_system_policy_field_headers(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + 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. @@ -759,7 +780,10 @@ def test_get_system_policy_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 @@ -788,11 +812,16 @@ async def test_get_system_policy_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_system_policy_flattened(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -802,7 +831,9 @@ def test_get_system_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_system_policy(name="name_value",) + client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -814,13 +845,16 @@ def test_get_system_policy_flattened(): def test_get_system_policy_flattened_error(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + 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_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -840,7 +874,9 @@ async def test_get_system_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_system_policy(name="name_value",) + response = await client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -861,7 +897,8 @@ async def test_get_system_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -872,7 +909,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Client( - 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. @@ -892,7 +930,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SystemPolicyV1Client(client_options=options, transport=transport,) + client = SystemPolicyV1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -908,7 +949,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -953,8 +995,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.SystemPolicyV1GrpcTransport,) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.SystemPolicyV1GrpcTransport, + ) def test_system_policy_v1_base_transport_error(): @@ -997,7 +1044,8 @@ def test_system_policy_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SystemPolicyV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1155,7 +1203,8 @@ def test_system_policy_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1167,7 +1216,8 @@ def test_system_policy_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1276,7 +1326,9 @@ def test_system_policy_v1_transport_channel_mtls_with_adc(transport_class): def test_policy_path(): project = "squid" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = SystemPolicyV1Client.policy_path(project) assert expected == actual @@ -1314,7 +1366,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SystemPolicyV1Client.common_folder_path(folder) assert expected == actual @@ -1332,7 +1386,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SystemPolicyV1Client.common_organization_path(organization) assert expected == actual @@ -1350,7 +1406,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SystemPolicyV1Client.common_project_path(project) assert expected == actual @@ -1370,7 +1428,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SystemPolicyV1Client.common_location_path(project, location) assert expected == actual @@ -1395,7 +1454,8 @@ def test_client_with_default_client_info(): transports.SystemPolicyV1Transport, "_prep_wrapped_messages" ) as prep: client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1404,7 +1464,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SystemPolicyV1Client.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) @@ -1412,7 +1473,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SystemPolicyV1AsyncClient( - 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/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 4370b69..041cb23 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -91,7 +91,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ValidationHelperV1Client, ValidationHelperV1AsyncClient,] + "client_class", + [ + ValidationHelperV1Client, + ValidationHelperV1AsyncClient, + ], ) def test_validation_helper_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -133,7 +137,11 @@ def test_validation_helper_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ValidationHelperV1Client, ValidationHelperV1AsyncClient,] + "client_class", + [ + ValidationHelperV1Client, + ValidationHelperV1AsyncClient, + ], ) def test_validation_helper_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -507,7 +515,9 @@ def test_validation_helper_v1_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) @@ -648,11 +658,16 @@ def test_validation_helper_v1_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [service.ValidateAttestationOccurrenceRequest, dict,] + "request_type", + [ + service.ValidateAttestationOccurrenceRequest, + dict, + ], ) def test_validate_attestation_occurrence(request_type, transport: str = "grpc"): client = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -687,7 +702,8 @@ def test_validate_attestation_occurrence_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 = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -706,7 +722,8 @@ async def test_validate_attestation_occurrence_async( request_type=service.ValidateAttestationOccurrenceRequest, ): client = ValidationHelperV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -769,7 +786,10 @@ def test_validate_attestation_occurrence_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor=attestor/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "attestor=attestor/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -800,7 +820,10 @@ async def test_validate_attestation_occurrence_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor=attestor/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "attestor=attestor/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -810,7 +833,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ValidationHelperV1Client( - 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. @@ -830,7 +854,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ValidationHelperV1Client(client_options=options, transport=transport,) + client = ValidationHelperV1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -846,7 +873,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ValidationHelperV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -894,7 +922,10 @@ def test_transport_grpc_default(): client = ValidationHelperV1Client( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.ValidationHelperV1GrpcTransport,) + assert isinstance( + client.transport, + transports.ValidationHelperV1GrpcTransport, + ) def test_validation_helper_v1_base_transport_error(): @@ -937,7 +968,8 @@ def test_validation_helper_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ValidationHelperV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1097,7 +1129,8 @@ def test_validation_helper_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ValidationHelperV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1109,7 +1142,8 @@ def test_validation_helper_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ValidationHelperV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1238,7 +1272,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 = ValidationHelperV1Client.common_folder_path(folder) assert expected == actual @@ -1256,7 +1292,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 = ValidationHelperV1Client.common_organization_path(organization) assert expected == actual @@ -1274,7 +1312,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 = ValidationHelperV1Client.common_project_path(project) assert expected == actual @@ -1294,7 +1334,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 = ValidationHelperV1Client.common_location_path(project, location) assert expected == actual @@ -1319,7 +1360,8 @@ def test_client_with_default_client_info(): transports.ValidationHelperV1Transport, "_prep_wrapped_messages" ) as prep: client = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1328,7 +1370,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ValidationHelperV1Client.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) @@ -1336,7 +1379,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ValidationHelperV1AsyncClient( - 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/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index c826ae7..efa7d61 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -553,7 +553,9 @@ def test_binauthz_management_service_v1_beta1_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) @@ -693,10 +695,17 @@ def test_binauthz_management_service_v1_beta1_client_create_channel_credentials_ ) -@pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest, + dict, + ], +) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -732,7 +741,8 @@ def test_get_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -748,7 +758,8 @@ async def test_get_policy_async( transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -810,7 +821,10 @@ def test_get_policy_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 @@ -837,7 +851,10 @@ async def test_get_policy_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_policy_flattened(): @@ -851,7 +868,9 @@ def test_get_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_policy(name="name_value",) + client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -871,7 +890,8 @@ def test_get_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) @@ -889,7 +909,9 @@ async def test_get_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_policy(name="name_value",) + response = await client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -910,14 +932,22 @@ async def test_get_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdatePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest, + dict, + ], +) def test_update_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -953,7 +983,8 @@ def test_update_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -969,7 +1000,8 @@ async def test_update_policy_async( transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1031,7 +1063,10 @@ def test_update_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1058,7 +1093,10 @@ async def test_update_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] def test_update_policy_flattened(): @@ -1072,7 +1110,9 @@ def test_update_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_policy(policy=resources.Policy(name="name_value"),) + client.update_policy( + policy=resources.Policy(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1092,7 +1132,8 @@ def test_update_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) @@ -1133,14 +1174,22 @@ async def test_update_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) -@pytest.mark.parametrize("request_type", [service.CreateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest, + dict, + ], +) def test_create_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1174,7 +1223,8 @@ def test_create_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1190,7 +1240,8 @@ async def test_create_attestor_async( transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1201,7 +1252,10 @@ async def test_create_attestor_async( with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.create_attestor(request) @@ -1244,7 +1298,10 @@ def test_create_attestor_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 @@ -1271,7 +1328,10 @@ async def test_create_attestor_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_attestor_flattened(): @@ -1374,10 +1434,17 @@ async def test_create_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.GetAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest, + dict, + ], +) def test_get_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1411,7 +1478,8 @@ def test_get_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1427,7 +1495,8 @@ async def test_get_attestor_async( transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1438,7 +1507,10 @@ async def test_get_attestor_async( with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.get_attestor(request) @@ -1481,7 +1553,10 @@ def test_get_attestor_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 @@ -1508,7 +1583,10 @@ async def test_get_attestor_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_attestor_flattened(): @@ -1522,7 +1600,9 @@ def test_get_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_attestor(name="name_value",) + client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1542,7 +1622,8 @@ def test_get_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) @@ -1560,7 +1641,9 @@ async def test_get_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Attestor()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_attestor(name="name_value",) + response = await client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1581,14 +1664,22 @@ async def test_get_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest, + dict, + ], +) def test_update_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1622,7 +1713,8 @@ def test_update_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1638,7 +1730,8 @@ async def test_update_attestor_async( transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1649,7 +1742,10 @@ async def test_update_attestor_async( with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.update_attestor(request) @@ -1692,9 +1788,10 @@ def test_update_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1721,9 +1818,10 @@ async def test_update_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] def test_update_attestor_flattened(): @@ -1737,7 +1835,9 @@ def test_update_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_attestor(attestor=resources.Attestor(name="name_value"),) + client.update_attestor( + attestor=resources.Attestor(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1804,10 +1904,17 @@ async def test_update_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.ListAttestorsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest, + dict, + ], +) def test_list_attestors(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1836,7 +1943,8 @@ def test_list_attestors_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1852,7 +1960,8 @@ async def test_list_attestors_async( transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1863,7 +1972,9 @@ async def test_list_attestors_async( with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.ListAttestorsResponse(next_page_token="next_page_token_value",) + service.ListAttestorsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_attestors(request) @@ -1905,7 +2016,10 @@ def test_list_attestors_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 @@ -1934,7 +2048,10 @@ async def test_list_attestors_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_attestors_flattened(): @@ -1948,7 +2065,9 @@ def test_list_attestors_flattened(): call.return_value = service.ListAttestorsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_attestors(parent="parent_value",) + client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1968,7 +2087,8 @@ def test_list_attestors_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) @@ -1988,7 +2108,9 @@ async def test_list_attestors_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_attestors(parent="parent_value",) + response = await client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2009,13 +2131,15 @@ async def test_list_attestors_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) def test_list_attestors_pager(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - 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. @@ -2030,12 +2154,21 @@ def test_list_attestors_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2055,7 +2188,8 @@ def test_list_attestors_pager(transport_name: str = "grpc"): def test_list_attestors_pages(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - 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. @@ -2070,12 +2204,21 @@ def test_list_attestors_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2104,16 +2247,27 @@ async def test_list_attestors_async_pager(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) - async_pager = await client.list_attestors(request={},) + async_pager = await client.list_attestors( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2143,12 +2297,21 @@ async def test_list_attestors_async_pages(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2159,10 +2322,17 @@ async def test_list_attestors_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.DeleteAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest, + dict, + ], +) def test_delete_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2188,7 +2358,8 @@ def test_delete_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2204,7 +2375,8 @@ async def test_delete_attestor_async( transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2254,7 +2426,10 @@ def test_delete_attestor_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 @@ -2281,7 +2456,10 @@ async def test_delete_attestor_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_attestor_flattened(): @@ -2295,7 +2473,9 @@ def test_delete_attestor_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_attestor(name="name_value",) + client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2315,7 +2495,8 @@ def test_delete_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2333,7 +2514,9 @@ async def test_delete_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_attestor(name="name_value",) + response = await client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2354,7 +2537,8 @@ async def test_delete_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2365,7 +2549,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - 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. @@ -2386,7 +2571,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2403,7 +2589,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2452,7 +2639,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.BinauthzManagementServiceV1Beta1GrpcTransport, + client.transport, + transports.BinauthzManagementServiceV1Beta1GrpcTransport, ) @@ -2504,7 +2692,8 @@ def test_binauthz_management_service_v1_beta1_base_transport_with_credentials_fi Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BinauthzManagementServiceV1Beta1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2669,7 +2858,8 @@ def test_binauthz_management_service_v1_beta1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1Beta1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2681,7 +2871,8 @@ def test_binauthz_management_service_v1_beta1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2794,7 +2985,8 @@ def test_attestor_path(): project = "squid" attestor = "clam" expected = "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) actual = BinauthzManagementServiceV1Beta1Client.attestor_path(project, attestor) assert expected == actual @@ -2814,7 +3006,9 @@ def test_parse_attestor_path(): def test_policy_path(): project = "oyster" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = BinauthzManagementServiceV1Beta1Client.policy_path(project) assert expected == actual @@ -2858,7 +3052,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 = BinauthzManagementServiceV1Beta1Client.common_folder_path(folder) assert expected == actual @@ -2876,7 +3072,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 = BinauthzManagementServiceV1Beta1Client.common_organization_path( organization ) @@ -2896,7 +3094,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 = BinauthzManagementServiceV1Beta1Client.common_project_path(project) assert expected == actual @@ -2916,7 +3116,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 = BinauthzManagementServiceV1Beta1Client.common_location_path( project, location @@ -2943,7 +3144,8 @@ def test_client_with_default_client_info(): transports.BinauthzManagementServiceV1Beta1Transport, "_prep_wrapped_messages" ) as prep: client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2952,7 +3154,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BinauthzManagementServiceV1Beta1Client.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) @@ -2960,7 +3163,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BinauthzManagementServiceV1Beta1AsyncClient( - 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/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index 39d4ce9..a33fba8 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -93,7 +93,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Beta1Client, SystemPolicyV1Beta1AsyncClient,] + "client_class", + [ + SystemPolicyV1Beta1Client, + SystemPolicyV1Beta1AsyncClient, + ], ) def test_system_policy_v1_beta1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -135,7 +139,11 @@ def test_system_policy_v1_beta1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Beta1Client, SystemPolicyV1Beta1AsyncClient,] + "client_class", + [ + SystemPolicyV1Beta1Client, + SystemPolicyV1Beta1AsyncClient, + ], ) def test_system_policy_v1_beta1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -517,7 +525,9 @@ def test_system_policy_v1_beta1_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) @@ -657,10 +667,17 @@ def test_system_policy_v1_beta1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest, + dict, + ], +) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -698,7 +715,8 @@ def test_get_system_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -716,7 +734,8 @@ async def test_get_system_policy_async( transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest ): client = SystemPolicyV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -782,7 +801,10 @@ def test_get_system_policy_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 @@ -811,7 +833,10 @@ async def test_get_system_policy_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_system_policy_flattened(): @@ -827,7 +852,9 @@ def test_get_system_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_system_policy(name="name_value",) + client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -847,7 +874,8 @@ def test_get_system_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -867,7 +895,9 @@ async def test_get_system_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_system_policy(name="name_value",) + response = await client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -888,7 +918,8 @@ async def test_get_system_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -899,7 +930,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Beta1Client( - 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. @@ -919,7 +951,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SystemPolicyV1Beta1Client(client_options=options, transport=transport,) + client = SystemPolicyV1Beta1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -935,7 +970,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Beta1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -983,7 +1019,10 @@ def test_transport_grpc_default(): client = SystemPolicyV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.SystemPolicyV1Beta1GrpcTransport,) + assert isinstance( + client.transport, + transports.SystemPolicyV1Beta1GrpcTransport, + ) def test_system_policy_v1_beta1_base_transport_error(): @@ -1026,7 +1065,8 @@ def test_system_policy_v1_beta1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SystemPolicyV1Beta1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1186,7 +1226,8 @@ def test_system_policy_v1_beta1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1Beta1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1198,7 +1239,8 @@ def test_system_policy_v1_beta1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1Beta1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1307,7 +1349,9 @@ def test_system_policy_v1_beta1_transport_channel_mtls_with_adc(transport_class) def test_policy_path(): project = "squid" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = SystemPolicyV1Beta1Client.policy_path(project) assert expected == actual @@ -1345,7 +1389,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SystemPolicyV1Beta1Client.common_folder_path(folder) assert expected == actual @@ -1363,7 +1409,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SystemPolicyV1Beta1Client.common_organization_path(organization) assert expected == actual @@ -1381,7 +1429,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SystemPolicyV1Beta1Client.common_project_path(project) assert expected == actual @@ -1401,7 +1451,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SystemPolicyV1Beta1Client.common_location_path(project, location) assert expected == actual @@ -1426,7 +1477,8 @@ def test_client_with_default_client_info(): transports.SystemPolicyV1Beta1Transport, "_prep_wrapped_messages" ) as prep: client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1435,7 +1487,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SystemPolicyV1Beta1Client.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) @@ -1443,7 +1496,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SystemPolicyV1Beta1AsyncClient( - 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" From a8941058d0c464ac257f799339e94351386eb274 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:54:24 +0000 Subject: [PATCH 02/18] chore(python): add E231 to .flake8 ignore list (#130) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd006..9e0a935 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.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:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 6df9fb7dabd6c79c771aa99b82c910a1256f7144 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:14:12 +0000 Subject: [PATCH 03/18] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#131) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a935..22cc254 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From f8d463e42bdfd1c8eaf5c276ed576c677602b4f4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:08:25 +0000 Subject: [PATCH 04/18] chore(python): Enable size-label bot (#132) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254..58a0b15 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..09c8d73 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From d763d0942b4fbf770edf1255608e12ab05a7076d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:50:24 +0000 Subject: [PATCH 05/18] chore(python): refactor unit / system test dependency install (#133) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b15..fa57622 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 3addb4e..6ee5e8a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -81,23 +105,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -121,6 +163,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -143,13 +214,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From d4d21a6c4df850280e62c16ff29c32f1071befe6 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 5 Apr 2022 11:14:41 -0400 Subject: [PATCH 06/18] chore: allow releases on previous major versions (#134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: allow releases on previous major versions * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .github/release-please.yml | 6 ++++++ owlbot.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/owlbot.py b/owlbot.py index c230db9..4b3d533 100644 --- a/owlbot.py +++ b/owlbot.py @@ -77,4 +77,6 @@ excludes=[".coveragerc"], # the microgenerator has a good coveragerc file ) +python.configure_previous_major_version_branches() + s.shell.run(["nox", "-s", "blacken"], hide_output=False) From f01a4e19d3c8f6c4d4771b24e30e02d053b78f33 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 06:45:23 -0400 Subject: [PATCH 07/18] chore(python): add license header to auto-label.yaml (#135) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa57622..bc893c9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d73..41bff0b 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. requestsize: enabled: true From 0ee5aa727a90c59a865dd40942d9fccc875c0873 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 20:49:15 -0400 Subject: [PATCH 08/18] chore: use gapic-generator-python 0.65.1 (#139) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../async_client.py | 9 +- .../binauthz_management_service_v1/client.py | 9 +- .../transports/base.py | 5 + .../transports/grpc.py | 4 + .../services/system_policy_v1/async_client.py | 3 +- .../services/system_policy_v1/client.py | 3 +- .../system_policy_v1/transports/base.py | 5 + .../system_policy_v1/transports/grpc.py | 4 + .../validation_helper_v1/async_client.py | 3 +- .../services/validation_helper_v1/client.py | 3 +- .../validation_helper_v1/transports/base.py | 5 + .../validation_helper_v1/transports/grpc.py | 4 + .../binaryauthorization_v1/types/resources.py | 8 +- .../async_client.py | 9 +- .../client.py | 9 +- .../transports/base.py | 5 + .../transports/grpc.py | 4 + .../system_policy_v1_beta1/async_client.py | 3 +- .../services/system_policy_v1_beta1/client.py | 3 +- .../system_policy_v1_beta1/transports/base.py | 5 + .../system_policy_v1_beta1/transports/grpc.py | 4 + .../types/__init__.py | 4 +- .../types/resources.py | 8 +- ...ippet_metadata_binaryauthorization_v1.json | 736 +++++++++++++++++- ..._metadata_binaryauthorization_v1beta1.json | 664 +++++++++++++++- .../test_binauthz_management_service_v1.py | 85 +- .../test_system_policy_v1.py | 79 +- .../test_validation_helper_v1.py | 79 +- ...st_binauthz_management_service_v1_beta1.py | 83 +- .../test_system_policy_v1_beta1.py | 79 +- 30 files changed, 1714 insertions(+), 210 deletions(-) diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index ce37151..056549e 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -247,7 +247,6 @@ async def get_policy( [policy][google.cloud.binaryauthorization.v1.Policy] if the project does not have one. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -361,7 +360,6 @@ async def update_policy( NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -486,7 +484,6 @@ async def create_attestor( the [attestor][google.cloud.binaryauthorization.v1.Attestor] already exists. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -616,7 +613,6 @@ async def get_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -728,7 +724,6 @@ async def update_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -846,7 +841,6 @@ async def list_attestors( r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -971,7 +965,6 @@ async def delete_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py index 806177d..7d14224 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -472,7 +472,6 @@ def get_policy( [policy][google.cloud.binaryauthorization.v1.Policy] if the project does not have one. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -576,7 +575,6 @@ def update_policy( NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -691,7 +689,6 @@ def create_attestor( the [attestor][google.cloud.binaryauthorization.v1.Attestor] already exists. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -821,7 +818,6 @@ def get_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -923,7 +919,6 @@ def update_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -1031,7 +1026,6 @@ def list_attestors( r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 @@ -1146,7 +1140,6 @@ def delete_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py index 335e67b..aa75521 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py @@ -82,6 +82,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -290,5 +291,9 @@ def delete_attestor( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("BinauthzManagementServiceV1Transport",) diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py index e390357..1b9ed59 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py @@ -455,5 +455,9 @@ def delete_attestor( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("BinauthzManagementServiceV1GrpcTransport",) diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index 51c8d66..3784c1e 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -215,7 +215,6 @@ async def get_system_policy( r"""Gets the current system policy in the specified location. - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py index 0d80e13..abe2571 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -432,7 +432,6 @@ def get_system_policy( r"""Gets the current system policy in the specified location. - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py index 89205be..4b3b570 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py @@ -81,6 +81,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -146,5 +147,9 @@ def get_system_policy( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SystemPolicyV1Transport",) diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py index 0e0120e..95f18fc 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py @@ -258,5 +258,9 @@ def get_system_policy( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SystemPolicyV1GrpcTransport",) diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 4f8f5a5..54f8070 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -211,7 +211,6 @@ async def validate_attestation_occurrence( r"""Returns whether the given Attestation for the given image URI was signed by the given Attestor - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py index df2e53f..03b0f24 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -414,7 +414,6 @@ def validate_attestation_occurrence( r"""Returns whether the given Attestation for the given image URI was signed by the given Attestor - .. code-block:: python from google.cloud import binaryauthorization_v1 diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py index 5a486f1..54e3d84 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py @@ -80,6 +80,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -148,5 +149,9 @@ def validate_attestation_occurrence( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ValidationHelperV1Transport",) diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py index 166513b..5559008 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py @@ -263,5 +263,9 @@ def validate_attestation_occurrence( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ValidationHelperV1GrpcTransport",) diff --git a/google/cloud/binaryauthorization_v1/types/resources.py b/google/cloud/binaryauthorization_v1/types/resources.py index 1b244c9..9bbfb50 100644 --- a/google/cloud/binaryauthorization_v1/types/resources.py +++ b/google/cloud/binaryauthorization_v1/types/resources.py @@ -57,21 +57,21 @@ class Policy(proto.Message): permitted. This feature is typically used to exclude Google or third-party infrastructure images from Binary Authorization policies. - cluster_admission_rules (Sequence[google.cloud.binaryauthorization_v1.types.Policy.ClusterAdmissionRulesEntry]): + cluster_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-cluster admission rules. Cluster spec format: ``location.clusterId``. There can be at most one admission rule per cluster spec. A ``location`` is either a compute zone (e.g. us-central1-a) or a region (e.g. us-central1). For ``clusterId`` syntax restrictions see https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. - kubernetes_namespace_admission_rules (Sequence[google.cloud.binaryauthorization_v1.types.Policy.KubernetesNamespaceAdmissionRulesEntry]): + kubernetes_namespace_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format: [a-z.-]+, e.g. 'some-namespace' - kubernetes_service_account_admission_rules (Sequence[google.cloud.binaryauthorization_v1.types.Policy.KubernetesServiceAccountAdmissionRulesEntry]): + kubernetes_service_account_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-kubernetes-service-account admission rules. Service account spec format: ``namespace:serviceaccount``. e.g. 'test-ns:default' - istio_service_identity_admission_rules (Sequence[google.cloud.binaryauthorization_v1.types.Policy.IstioServiceIdentityAdmissionRulesEntry]): + istio_service_identity_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-istio-service-identity admission rules. Istio service identity spec format: diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 8662108..5d3515e 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -256,7 +256,6 @@ async def get_policy( [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -371,7 +370,6 @@ async def update_policy( Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -498,7 +496,6 @@ async def create_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -628,7 +625,6 @@ async def get_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -740,7 +736,6 @@ async def update_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -859,7 +854,6 @@ async def list_attestors( [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -984,7 +978,6 @@ async def delete_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py index 3d4f261..170f7d4 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -479,7 +479,6 @@ def get_policy( [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -584,7 +583,6 @@ def update_policy( Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -701,7 +699,6 @@ def create_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -831,7 +828,6 @@ def get_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -933,7 +929,6 @@ def update_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -1042,7 +1037,6 @@ def list_attestors( [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 @@ -1157,7 +1151,6 @@ def delete_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py index 5555449..0968b6b 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py @@ -82,6 +82,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -290,5 +291,9 @@ def delete_attestor( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("BinauthzManagementServiceV1Beta1Transport",) diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py index c9a0b6e..ab98529 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py @@ -461,5 +461,9 @@ def delete_attestor( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("BinauthzManagementServiceV1Beta1GrpcTransport",) diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index ec901b0..2df4773 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,7 +216,6 @@ async def get_system_policy( r"""Gets the current system policy in the specified location. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py index bd0f7a8..0716134 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -432,7 +432,6 @@ def get_system_policy( r"""Gets the current system policy in the specified location. - .. code-block:: python from google.cloud import binaryauthorization_v1beta1 diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py index 8db9662..23a225b 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py @@ -81,6 +81,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -146,5 +147,9 @@ def get_system_policy( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SystemPolicyV1Beta1Transport",) diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py index a77287f..d3cb249 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py @@ -258,5 +258,9 @@ def get_system_policy( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SystemPolicyV1Beta1GrpcTransport",) diff --git a/google/cloud/binaryauthorization_v1beta1/types/__init__.py b/google/cloud/binaryauthorization_v1beta1/types/__init__.py index 30b8ea4..25e8b6c 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/types/__init__.py @@ -13,7 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .continuous_validation_logging import ContinuousValidationEvent +from .continuous_validation_logging import ( + ContinuousValidationEvent, +) from .resources import ( AdmissionRule, AdmissionWhitelistPattern, diff --git a/google/cloud/binaryauthorization_v1beta1/types/resources.py b/google/cloud/binaryauthorization_v1beta1/types/resources.py index 5323d0b..0fd403e 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/resources.py +++ b/google/cloud/binaryauthorization_v1beta1/types/resources.py @@ -57,21 +57,21 @@ class Policy(proto.Message): permitted. This feature is typically used to exclude Google or third-party infrastructure images from Binary Authorization policies. - cluster_admission_rules (Sequence[google.cloud.binaryauthorization_v1beta1.types.Policy.ClusterAdmissionRulesEntry]): + cluster_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-cluster admission rules. Cluster spec format: ``location.clusterId``. There can be at most one admission rule per cluster spec. A ``location`` is either a compute zone (e.g. us-central1-a) or a region (e.g. us-central1). For ``clusterId`` syntax restrictions see https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. - kubernetes_namespace_admission_rules (Sequence[google.cloud.binaryauthorization_v1beta1.types.Policy.KubernetesNamespaceAdmissionRulesEntry]): + kubernetes_namespace_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format: ``[a-z.-]+``, e.g. ``some-namespace`` - kubernetes_service_account_admission_rules (Sequence[google.cloud.binaryauthorization_v1beta1.types.Policy.KubernetesServiceAccountAdmissionRulesEntry]): + kubernetes_service_account_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-kubernetes-service-account admission rules. Service account spec format: ``namespace:serviceaccount``. e.g. ``test-ns:default`` - istio_service_identity_admission_rules (Sequence[google.cloud.binaryauthorization_v1beta1.types.Policy.IstioServiceIdentityAdmissionRulesEntry]): + istio_service_identity_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-istio-service-identity admission rules. Istio service identity spec format: ``spiffe:///ns//sa/`` or diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json b/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json index 5f748e4..e135974 100644 --- a/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json +++ b/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.binaryauthorization.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-binaryauthorization" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.create_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.CreateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "CreateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.CreateAttestorRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "attestor_id", + "type": "str" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "create_attestor" }, + "description": "Sample for CreateAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_create_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_CreateAttestor_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_create_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.create_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.CreateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "CreateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.CreateAttestorRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "attestor_id", + "type": "str" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "create_attestor" }, + "description": "Sample for CreateAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_create_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_CreateAttestor_sync", "segments": [ { @@ -87,19 +184,54 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_create_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.delete_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.DeleteAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "DeleteAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_attestor" }, + "description": "Sample for DeleteAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_delete_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_DeleteAttestor_async", "segments": [ { @@ -130,18 +262,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_delete_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.delete_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.DeleteAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "DeleteAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_attestor" }, + "description": "Sample for DeleteAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_delete_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_DeleteAttestor_sync", "segments": [ { @@ -172,19 +339,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_delete_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.get_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.GetAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "GetAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "get_attestor" }, + "description": "Sample for GetAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_GetAttestor_async", "segments": [ { @@ -217,18 +420,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.get_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.GetAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "GetAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "get_attestor" }, + "description": "Sample for GetAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_GetAttestor_sync", "segments": [ { @@ -261,19 +500,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.get_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.GetPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "GetPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "get_policy" }, + "description": "Sample for GetPolicy", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_GetPolicy_async", "segments": [ { @@ -306,18 +581,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.get_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.GetPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "GetPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "get_policy" }, + "description": "Sample for GetPolicy", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_GetPolicy_sync", "segments": [ { @@ -350,19 +661,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_get_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.list_attestors", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.ListAttestors", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "ListAttestors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.ListAttestorsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1.pagers.ListAttestorsAsyncPager", + "shortName": "list_attestors" }, + "description": "Sample for ListAttestors", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_list_attestors_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_ListAttestors_async", "segments": [ { @@ -395,18 +742,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_list_attestors_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.list_attestors", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.ListAttestors", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "ListAttestors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.ListAttestorsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1.pagers.ListAttestorsPager", + "shortName": "list_attestors" }, + "description": "Sample for ListAttestors", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_list_attestors_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_ListAttestors_sync", "segments": [ { @@ -439,19 +822,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_list_attestors_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.update_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.UpdateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "UpdateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "update_attestor" }, + "description": "Sample for UpdateAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_UpdateAttestor_async", "segments": [ { @@ -484,18 +903,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.update_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.UpdateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "UpdateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Attestor", + "shortName": "update_attestor" }, + "description": "Sample for UpdateAttestor", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_UpdateAttestor_sync", "segments": [ { @@ -528,19 +983,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient", + "shortName": "BinauthzManagementServiceV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient.update_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.UpdatePolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "UpdatePolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest" + }, + { + "name": "policy", + "type": "google.cloud.binaryauthorization_v1.types.Policy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "update_policy" }, + "description": "Sample for UpdatePolicy", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_UpdatePolicy_async", "segments": [ { @@ -573,18 +1064,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client", + "shortName": "BinauthzManagementServiceV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.BinauthzManagementServiceV1Client.update_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1.UpdatePolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1", "shortName": "BinauthzManagementServiceV1" }, "shortName": "UpdatePolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest" + }, + { + "name": "policy", + "type": "google.cloud.binaryauthorization_v1.types.Policy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "update_policy" }, + "description": "Sample for UpdatePolicy", "file": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_BinauthzManagementServiceV1_UpdatePolicy_sync", "segments": [ { @@ -617,19 +1144,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_binauthz_management_service_v1_update_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.SystemPolicyV1AsyncClient", + "shortName": "SystemPolicyV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.SystemPolicyV1AsyncClient.get_system_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.SystemPolicyV1.GetSystemPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.SystemPolicyV1", "shortName": "SystemPolicyV1" }, "shortName": "GetSystemPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "get_system_policy" }, + "description": "Sample for GetSystemPolicy", "file": "binaryauthorization_v1_generated_system_policy_v1_get_system_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_SystemPolicyV1_GetSystemPolicy_async", "segments": [ { @@ -662,18 +1225,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_system_policy_v1_get_system_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.SystemPolicyV1Client", + "shortName": "SystemPolicyV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.SystemPolicyV1Client.get_system_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1.SystemPolicyV1.GetSystemPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1.SystemPolicyV1", "shortName": "SystemPolicyV1" }, "shortName": "GetSystemPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.Policy", + "shortName": "get_system_policy" }, + "description": "Sample for GetSystemPolicy", "file": "binaryauthorization_v1_generated_system_policy_v1_get_system_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_SystemPolicyV1_GetSystemPolicy_sync", "segments": [ { @@ -706,19 +1305,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_system_policy_v1_get_system_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1.ValidationHelperV1AsyncClient", + "shortName": "ValidationHelperV1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1.ValidationHelperV1AsyncClient.validate_attestation_occurrence", "method": { + "fullName": "google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence", "service": { + "fullName": "google.cloud.binaryauthorization.v1.ValidationHelperV1", "shortName": "ValidationHelperV1" }, "shortName": "ValidateAttestationOccurrence" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceResponse", + "shortName": "validate_attestation_occurrence" }, + "description": "Sample for ValidateAttestationOccurrence", "file": "binaryauthorization_v1_generated_validation_helper_v1_validate_attestation_occurrence_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_ValidationHelperV1_ValidateAttestationOccurrence_async", "segments": [ { @@ -751,18 +1382,50 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_validation_helper_v1_validate_attestation_occurrence_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1.ValidationHelperV1Client", + "shortName": "ValidationHelperV1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1.ValidationHelperV1Client.validate_attestation_occurrence", "method": { + "fullName": "google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence", "service": { + "fullName": "google.cloud.binaryauthorization.v1.ValidationHelperV1", "shortName": "ValidationHelperV1" }, "shortName": "ValidateAttestationOccurrence" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceResponse", + "shortName": "validate_attestation_occurrence" }, + "description": "Sample for ValidateAttestationOccurrence", "file": "binaryauthorization_v1_generated_validation_helper_v1_validate_attestation_occurrence_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1_generated_ValidationHelperV1_ValidateAttestationOccurrence_sync", "segments": [ { @@ -795,7 +1458,8 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1_generated_validation_helper_v1_validate_attestation_occurrence_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json b/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json index b42f297..3845e43 100644 --- a/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json +++ b/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.binaryauthorization.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-binaryauthorization" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.create_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.CreateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "CreateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "attestor_id", + "type": "str" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1beta1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "create_attestor" }, + "description": "Sample for CreateAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_create_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_CreateAttestor_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_create_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.create_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.CreateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "CreateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "attestor_id", + "type": "str" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1beta1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "create_attestor" }, + "description": "Sample for CreateAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_create_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_CreateAttestor_sync", "segments": [ { @@ -87,19 +184,54 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_create_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.delete_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.DeleteAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "DeleteAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_attestor" }, + "description": "Sample for DeleteAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_delete_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_DeleteAttestor_async", "segments": [ { @@ -130,18 +262,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_delete_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.delete_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.DeleteAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "DeleteAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_attestor" }, + "description": "Sample for DeleteAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_delete_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_DeleteAttestor_sync", "segments": [ { @@ -172,19 +339,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_delete_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.get_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.GetAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "GetAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "get_attestor" }, + "description": "Sample for GetAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_GetAttestor_async", "segments": [ { @@ -217,18 +420,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.get_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.GetAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "GetAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "get_attestor" }, + "description": "Sample for GetAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_GetAttestor_sync", "segments": [ { @@ -261,19 +500,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.get_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.GetPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "GetPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "get_policy" }, + "description": "Sample for GetPolicy", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_GetPolicy_async", "segments": [ { @@ -306,18 +581,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.get_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.GetPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "GetPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "get_policy" }, + "description": "Sample for GetPolicy", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_GetPolicy_sync", "segments": [ { @@ -350,19 +661,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.list_attestors", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.ListAttestors", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "ListAttestors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1.pagers.ListAttestorsAsyncPager", + "shortName": "list_attestors" }, + "description": "Sample for ListAttestors", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_list_attestors_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_ListAttestors_async", "segments": [ { @@ -395,18 +742,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_list_attestors_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.list_attestors", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.ListAttestors", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "ListAttestors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1.pagers.ListAttestorsPager", + "shortName": "list_attestors" }, + "description": "Sample for ListAttestors", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_list_attestors_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_ListAttestors_sync", "segments": [ { @@ -439,19 +822,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_list_attestors_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.update_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.UpdateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "UpdateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1beta1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "update_attestor" }, + "description": "Sample for UpdateAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_attestor_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_UpdateAttestor_async", "segments": [ { @@ -484,18 +903,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_attestor_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.update_attestor", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.UpdateAttestor", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "UpdateAttestor" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest" + }, + { + "name": "attestor", + "type": "google.cloud.binaryauthorization_v1beta1.types.Attestor" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Attestor", + "shortName": "update_attestor" }, + "description": "Sample for UpdateAttestor", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_attestor_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_UpdateAttestor_sync", "segments": [ { @@ -528,19 +983,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_attestor_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient", + "shortName": "BinauthzManagementServiceV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient.update_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.UpdatePolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "UpdatePolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest" + }, + { + "name": "policy", + "type": "google.cloud.binaryauthorization_v1beta1.types.Policy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "update_policy" }, + "description": "Sample for UpdatePolicy", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_UpdatePolicy_async", "segments": [ { @@ -573,18 +1064,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client", + "shortName": "BinauthzManagementServiceV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client.update_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1.UpdatePolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1", "shortName": "BinauthzManagementServiceV1Beta1" }, "shortName": "UpdatePolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest" + }, + { + "name": "policy", + "type": "google.cloud.binaryauthorization_v1beta1.types.Policy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "update_policy" }, + "description": "Sample for UpdatePolicy", "file": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_BinauthzManagementServiceV1Beta1_UpdatePolicy_sync", "segments": [ { @@ -617,19 +1144,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_update_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.SystemPolicyV1Beta1AsyncClient", + "shortName": "SystemPolicyV1Beta1AsyncClient" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.SystemPolicyV1Beta1AsyncClient.get_system_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1.GetSystemPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1", "shortName": "SystemPolicyV1Beta1" }, "shortName": "GetSystemPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "get_system_policy" }, + "description": "Sample for GetSystemPolicy", "file": "binaryauthorization_v1beta1_generated_system_policy_v1_beta1_get_system_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_SystemPolicyV1Beta1_GetSystemPolicy_async", "segments": [ { @@ -662,18 +1225,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_system_policy_v1_beta1_get_system_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.binaryauthorization_v1beta1.SystemPolicyV1Beta1Client", + "shortName": "SystemPolicyV1Beta1Client" + }, + "fullName": "google.cloud.binaryauthorization_v1beta1.SystemPolicyV1Beta1Client.get_system_policy", "method": { + "fullName": "google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1.GetSystemPolicy", "service": { + "fullName": "google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1", "shortName": "SystemPolicyV1Beta1" }, "shortName": "GetSystemPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.binaryauthorization_v1beta1.types.Policy", + "shortName": "get_system_policy" }, + "description": "Sample for GetSystemPolicy", "file": "binaryauthorization_v1beta1_generated_system_policy_v1_beta1_get_system_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "binaryauthorization_v1beta1_generated_SystemPolicyV1Beta1_GetSystemPolicy_sync", "segments": [ { @@ -706,7 +1305,8 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "binaryauthorization_v1beta1_generated_system_policy_v1_beta1_get_system_policy_sync.py" } ] } diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index f538d30..5eee8e9 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -98,24 +98,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BinauthzManagementServiceV1Client, - BinauthzManagementServiceV1AsyncClient, + (BinauthzManagementServiceV1Client, "grpc"), + (BinauthzManagementServiceV1AsyncClient, "grpc_asyncio"), ], ) -def test_binauthz_management_service_v1_client_from_service_account_info(client_class): +def test_binauthz_management_service_v1_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") @pytest.mark.parametrize( @@ -144,27 +146,33 @@ def test_binauthz_management_service_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BinauthzManagementServiceV1Client, - BinauthzManagementServiceV1AsyncClient, + (BinauthzManagementServiceV1Client, "grpc"), + (BinauthzManagementServiceV1AsyncClient, "grpc_asyncio"), ], ) -def test_binauthz_management_service_v1_client_from_service_account_file(client_class): +def test_binauthz_management_service_v1_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") def test_binauthz_management_service_v1_client_get_transport_class(): @@ -2254,7 +2262,7 @@ async def test_list_attestors_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2300,7 +2308,9 @@ async def test_list_attestors_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_attestors(request={})).pages: + async for page_ in ( + await client.list_attestors(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2617,6 +2627,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = BinauthzManagementServiceV1Client.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = BinauthzManagementServiceV1Client( @@ -2665,6 +2688,14 @@ def test_binauthz_management_service_v1_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_binauthz_management_service_v1_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2817,24 +2848,40 @@ def test_binauthz_management_service_v1_grpc_transport_client_cert_source_for_mt ) -def test_binauthz_management_service_v1_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_binauthz_management_service_v1_host_no_port(transport_name): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") -def test_binauthz_management_service_v1_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_binauthz_management_service_v1_host_with_port(transport_name): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:8000" + assert client.transport._host == ("binaryauthorization.googleapis.com:8000") def test_binauthz_management_service_v1_grpc_transport_channel(): diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index 958d771..cec5b2c 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -90,24 +90,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - SystemPolicyV1Client, - SystemPolicyV1AsyncClient, + (SystemPolicyV1Client, "grpc"), + (SystemPolicyV1AsyncClient, "grpc_asyncio"), ], ) -def test_system_policy_v1_client_from_service_account_info(client_class): +def test_system_policy_v1_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") @pytest.mark.parametrize( @@ -136,27 +138,33 @@ def test_system_policy_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - SystemPolicyV1Client, - SystemPolicyV1AsyncClient, + (SystemPolicyV1Client, "grpc"), + (SystemPolicyV1AsyncClient, "grpc_asyncio"), ], ) -def test_system_policy_v1_client_from_service_account_file(client_class): +def test_system_policy_v1_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") def test_system_policy_v1_client_get_transport_class(): @@ -993,6 +1001,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SystemPolicyV1Client.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SystemPolicyV1Client( @@ -1033,6 +1054,14 @@ def test_system_policy_v1_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_system_policy_v1_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1178,24 +1207,40 @@ def test_system_policy_v1_grpc_transport_client_cert_source_for_mtls(transport_c ) -def test_system_policy_v1_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_system_policy_v1_host_no_port(transport_name): client = SystemPolicyV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") -def test_system_policy_v1_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_system_policy_v1_host_with_port(transport_name): client = SystemPolicyV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:8000" + assert client.transport._host == ("binaryauthorization.googleapis.com:8000") def test_system_policy_v1_grpc_transport_channel(): diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 041cb23..1ea1b06 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -91,24 +91,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ValidationHelperV1Client, - ValidationHelperV1AsyncClient, + (ValidationHelperV1Client, "grpc"), + (ValidationHelperV1AsyncClient, "grpc_asyncio"), ], ) -def test_validation_helper_v1_client_from_service_account_info(client_class): +def test_validation_helper_v1_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") @pytest.mark.parametrize( @@ -137,27 +139,33 @@ def test_validation_helper_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ValidationHelperV1Client, - ValidationHelperV1AsyncClient, + (ValidationHelperV1Client, "grpc"), + (ValidationHelperV1AsyncClient, "grpc_asyncio"), ], ) -def test_validation_helper_v1_client_from_service_account_file(client_class): +def test_validation_helper_v1_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") def test_validation_helper_v1_client_get_transport_class(): @@ -917,6 +925,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ValidationHelperV1Client.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ValidationHelperV1Client( @@ -957,6 +978,14 @@ def test_validation_helper_v1_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_validation_helper_v1_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1104,24 +1133,40 @@ def test_validation_helper_v1_grpc_transport_client_cert_source_for_mtls( ) -def test_validation_helper_v1_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_validation_helper_v1_host_no_port(transport_name): client = ValidationHelperV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") -def test_validation_helper_v1_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_validation_helper_v1_host_with_port(transport_name): client = ValidationHelperV1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:8000" + assert client.transport._host == ("binaryauthorization.googleapis.com:8000") def test_validation_helper_v1_grpc_transport_channel(): diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index efa7d61..741b96e 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -104,14 +104,14 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BinauthzManagementServiceV1Beta1Client, - BinauthzManagementServiceV1Beta1AsyncClient, + (BinauthzManagementServiceV1Beta1Client, "grpc"), + (BinauthzManagementServiceV1Beta1AsyncClient, "grpc_asyncio"), ], ) def test_binauthz_management_service_v1_beta1_client_from_service_account_info( - client_class, + client_class, transport_name ): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -119,11 +119,11 @@ def test_binauthz_management_service_v1_beta1_client_from_service_account_info( ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") @pytest.mark.parametrize( @@ -155,29 +155,33 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_ @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BinauthzManagementServiceV1Beta1Client, - BinauthzManagementServiceV1Beta1AsyncClient, + (BinauthzManagementServiceV1Beta1Client, "grpc"), + (BinauthzManagementServiceV1Beta1AsyncClient, "grpc_asyncio"), ], ) def test_binauthz_management_service_v1_beta1_client_from_service_account_file( - client_class, + client_class, transport_name ): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") def test_binauthz_management_service_v1_beta1_client_get_transport_class(): @@ -2270,7 +2274,7 @@ async def test_list_attestors_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2316,7 +2320,9 @@ async def test_list_attestors_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_attestors(request={})).pages: + async for page_ in ( + await client.list_attestors(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2633,6 +2639,21 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = BinauthzManagementServiceV1Beta1Client.get_transport_class( + transport_name + )( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = BinauthzManagementServiceV1Beta1Client( @@ -2681,6 +2702,14 @@ def test_binauthz_management_service_v1_beta1_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_binauthz_management_service_v1_beta1_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2833,24 +2862,40 @@ def test_binauthz_management_service_v1_beta1_grpc_transport_client_cert_source_ ) -def test_binauthz_management_service_v1_beta1_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_binauthz_management_service_v1_beta1_host_no_port(transport_name): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") -def test_binauthz_management_service_v1_beta1_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_binauthz_management_service_v1_beta1_host_with_port(transport_name): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:8000" + assert client.transport._host == ("binaryauthorization.googleapis.com:8000") def test_binauthz_management_service_v1_beta1_grpc_transport_channel(): diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index a33fba8..02b46ed 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -93,24 +93,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - SystemPolicyV1Beta1Client, - SystemPolicyV1Beta1AsyncClient, + (SystemPolicyV1Beta1Client, "grpc"), + (SystemPolicyV1Beta1AsyncClient, "grpc_asyncio"), ], ) -def test_system_policy_v1_beta1_client_from_service_account_info(client_class): +def test_system_policy_v1_beta1_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") @pytest.mark.parametrize( @@ -139,27 +141,33 @@ def test_system_policy_v1_beta1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - SystemPolicyV1Beta1Client, - SystemPolicyV1Beta1AsyncClient, + (SystemPolicyV1Beta1Client, "grpc"), + (SystemPolicyV1Beta1AsyncClient, "grpc_asyncio"), ], ) -def test_system_policy_v1_beta1_client_from_service_account_file(client_class): +def test_system_policy_v1_beta1_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") def test_system_policy_v1_beta1_client_get_transport_class(): @@ -1014,6 +1022,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SystemPolicyV1Beta1Client.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SystemPolicyV1Beta1Client( @@ -1054,6 +1075,14 @@ def test_system_policy_v1_beta1_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_system_policy_v1_beta1_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1201,24 +1230,40 @@ def test_system_policy_v1_beta1_grpc_transport_client_cert_source_for_mtls( ) -def test_system_policy_v1_beta1_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_system_policy_v1_beta1_host_no_port(transport_name): client = SystemPolicyV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:443" + assert client.transport._host == ("binaryauthorization.googleapis.com:443") -def test_system_policy_v1_beta1_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_system_policy_v1_beta1_host_with_port(transport_name): client = SystemPolicyV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="binaryauthorization.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "binaryauthorization.googleapis.com:8000" + assert client.transport._host == ("binaryauthorization.googleapis.com:8000") def test_system_policy_v1_beta1_grpc_transport_channel(): From c82ef8aed047072fcd69220ed17b690ea96767a9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:53:19 -0400 Subject: [PATCH 09/18] chore(python): add nox session to sort python imports (#140) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c9..7c454ab 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/noxfile.py b/noxfile.py index 6ee5e8a..92da31f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,7 +25,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +84,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +95,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) From e1094c70ef33cf15dbab66d5fa30742d51d2ff57 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 16:18:17 +0000 Subject: [PATCH 10/18] chore(python): use ubuntu 22.04 in docs image (#142) Source-Link: https://github.com/googleapis/synthtool/commit/f15cc72fb401b4861cedebb10af74afe428fb1f8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/docker/docs/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7c454ab..64f82d6 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 -# created: 2022-04-20T23:42:53.970438194Z + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] From bd2da3913cc8e2b26eb1ccba4328e6fd079d4204 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:47:25 -0400 Subject: [PATCH 11/18] chore: use gapic-generator-python 0.65.2 (#143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../async_client.py | 42 +++++++------- .../services/system_policy_v1/async_client.py | 6 +- .../validation_helper_v1/async_client.py | 6 +- .../async_client.py | 42 +++++++------- .../system_policy_v1_beta1/async_client.py | 6 +- .../test_binauthz_management_service_v1.py | 58 +++++++++---------- .../test_system_policy_v1.py | 8 +-- .../test_validation_helper_v1.py | 8 +-- ...st_binauthz_management_service_v1_beta1.py | 58 +++++++++---------- .../test_system_policy_v1_beta1.py | 8 +-- 10 files changed, 121 insertions(+), 121 deletions(-) diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index 056549e..a7e52ae 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -251,9 +251,9 @@ async def get_policy( from google.cloud import binaryauthorization_v1 - def sample_get_policy(): + async def sample_get_policy(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.GetPolicyRequest( @@ -261,7 +261,7 @@ def sample_get_policy(): ) # Make the request - response = client.get_policy(request=request) + response = await client.get_policy(request=request) # Handle the response print(response) @@ -364,9 +364,9 @@ async def update_policy( from google.cloud import binaryauthorization_v1 - def sample_update_policy(): + async def sample_update_policy(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) policy = binaryauthorization_v1.Policy() @@ -378,7 +378,7 @@ def sample_update_policy(): ) # Make the request - response = client.update_policy(request=request) + response = await client.update_policy(request=request) # Handle the response print(response) @@ -488,9 +488,9 @@ async def create_attestor( from google.cloud import binaryauthorization_v1 - def sample_create_attestor(): + async def sample_create_attestor(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) attestor = binaryauthorization_v1.Attestor() @@ -504,7 +504,7 @@ def sample_create_attestor(): ) # Make the request - response = client.create_attestor(request=request) + response = await client.create_attestor(request=request) # Handle the response print(response) @@ -617,9 +617,9 @@ async def get_attestor( from google.cloud import binaryauthorization_v1 - def sample_get_attestor(): + async def sample_get_attestor(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.GetAttestorRequest( @@ -627,7 +627,7 @@ def sample_get_attestor(): ) # Make the request - response = client.get_attestor(request=request) + response = await client.get_attestor(request=request) # Handle the response print(response) @@ -728,9 +728,9 @@ async def update_attestor( from google.cloud import binaryauthorization_v1 - def sample_update_attestor(): + async def sample_update_attestor(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) attestor = binaryauthorization_v1.Attestor() @@ -742,7 +742,7 @@ def sample_update_attestor(): ) # Make the request - response = client.update_attestor(request=request) + response = await client.update_attestor(request=request) # Handle the response print(response) @@ -845,9 +845,9 @@ async def list_attestors( from google.cloud import binaryauthorization_v1 - def sample_list_attestors(): + async def sample_list_attestors(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.ListAttestorsRequest( @@ -858,7 +858,7 @@ def sample_list_attestors(): page_result = client.list_attestors(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -969,9 +969,9 @@ async def delete_attestor( from google.cloud import binaryauthorization_v1 - def sample_delete_attestor(): + async def sample_delete_attestor(): # Create a client - client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.DeleteAttestorRequest( @@ -979,7 +979,7 @@ def sample_delete_attestor(): ) # Make the request - client.delete_attestor(request=request) + await client.delete_attestor(request=request) Args: request (Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]): diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index 3784c1e..6ae10ec 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -219,9 +219,9 @@ async def get_system_policy( from google.cloud import binaryauthorization_v1 - def sample_get_system_policy(): + async def sample_get_system_policy(): # Create a client - client = binaryauthorization_v1.SystemPolicyV1Client() + client = binaryauthorization_v1.SystemPolicyV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.GetSystemPolicyRequest( @@ -229,7 +229,7 @@ def sample_get_system_policy(): ) # Make the request - response = client.get_system_policy(request=request) + response = await client.get_system_policy(request=request) # Handle the response print(response) diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 54f8070..1238f8b 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -215,9 +215,9 @@ async def validate_attestation_occurrence( from google.cloud import binaryauthorization_v1 - def sample_validate_attestation_occurrence(): + async def sample_validate_attestation_occurrence(): # Create a client - client = binaryauthorization_v1.ValidationHelperV1Client() + client = binaryauthorization_v1.ValidationHelperV1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1.ValidateAttestationOccurrenceRequest( @@ -227,7 +227,7 @@ def sample_validate_attestation_occurrence(): ) # Make the request - response = client.validate_attestation_occurrence(request=request) + response = await client.validate_attestation_occurrence(request=request) # Handle the response print(response) diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 5d3515e..5d3a7c8 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -260,9 +260,9 @@ async def get_policy( from google.cloud import binaryauthorization_v1beta1 - def sample_get_policy(): + async def sample_get_policy(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1beta1.GetPolicyRequest( @@ -270,7 +270,7 @@ def sample_get_policy(): ) # Make the request - response = client.get_policy(request=request) + response = await client.get_policy(request=request) # Handle the response print(response) @@ -374,9 +374,9 @@ async def update_policy( from google.cloud import binaryauthorization_v1beta1 - def sample_update_policy(): + async def sample_update_policy(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) policy = binaryauthorization_v1beta1.Policy() @@ -388,7 +388,7 @@ def sample_update_policy(): ) # Make the request - response = client.update_policy(request=request) + response = await client.update_policy(request=request) # Handle the response print(response) @@ -500,9 +500,9 @@ async def create_attestor( from google.cloud import binaryauthorization_v1beta1 - def sample_create_attestor(): + async def sample_create_attestor(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) attestor = binaryauthorization_v1beta1.Attestor() @@ -516,7 +516,7 @@ def sample_create_attestor(): ) # Make the request - response = client.create_attestor(request=request) + response = await client.create_attestor(request=request) # Handle the response print(response) @@ -629,9 +629,9 @@ async def get_attestor( from google.cloud import binaryauthorization_v1beta1 - def sample_get_attestor(): + async def sample_get_attestor(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1beta1.GetAttestorRequest( @@ -639,7 +639,7 @@ def sample_get_attestor(): ) # Make the request - response = client.get_attestor(request=request) + response = await client.get_attestor(request=request) # Handle the response print(response) @@ -740,9 +740,9 @@ async def update_attestor( from google.cloud import binaryauthorization_v1beta1 - def sample_update_attestor(): + async def sample_update_attestor(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) attestor = binaryauthorization_v1beta1.Attestor() @@ -754,7 +754,7 @@ def sample_update_attestor(): ) # Make the request - response = client.update_attestor(request=request) + response = await client.update_attestor(request=request) # Handle the response print(response) @@ -858,9 +858,9 @@ async def list_attestors( from google.cloud import binaryauthorization_v1beta1 - def sample_list_attestors(): + async def sample_list_attestors(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1beta1.ListAttestorsRequest( @@ -871,7 +871,7 @@ def sample_list_attestors(): page_result = client.list_attestors(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -982,9 +982,9 @@ async def delete_attestor( from google.cloud import binaryauthorization_v1beta1 - def sample_delete_attestor(): + async def sample_delete_attestor(): # Create a client - client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1beta1.DeleteAttestorRequest( @@ -992,7 +992,7 @@ def sample_delete_attestor(): ) # Make the request - client.delete_attestor(request=request) + await client.delete_attestor(request=request) Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest, dict]): diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index 2df4773..417a156 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -220,9 +220,9 @@ async def get_system_policy( from google.cloud import binaryauthorization_v1beta1 - def sample_get_system_policy(): + async def sample_get_system_policy(): # Create a client - client = binaryauthorization_v1beta1.SystemPolicyV1Beta1Client() + client = binaryauthorization_v1beta1.SystemPolicyV1Beta1AsyncClient() # Initialize request argument(s) request = binaryauthorization_v1beta1.GetSystemPolicyRequest( @@ -230,7 +230,7 @@ def sample_get_system_policy(): ) # Make the request - response = client.get_system_policy(request=request) + response = await client.get_system_policy(request=request) # Handle the response print(response) diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index 5eee8e9..e124965 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -799,7 +799,7 @@ def test_get_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.GetPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_policy), "__call__") as call: @@ -815,7 +815,7 @@ def test_get_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -829,7 +829,7 @@ async def test_get_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_policy), "__call__") as call: @@ -845,7 +845,7 @@ async def test_get_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1041,7 +1041,7 @@ def test_update_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdatePolicyRequest() - request.policy.name = "policy.name/value" + request.policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_policy), "__call__") as call: @@ -1057,7 +1057,7 @@ def test_update_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "policy.name=policy.name/value", + "policy.name=name_value", ) in kw["metadata"] @@ -1071,7 +1071,7 @@ async def test_update_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdatePolicyRequest() - request.policy.name = "policy.name/value" + request.policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_policy), "__call__") as call: @@ -1087,7 +1087,7 @@ async def test_update_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "policy.name=policy.name/value", + "policy.name=name_value", ) in kw["metadata"] @@ -1276,7 +1276,7 @@ def test_create_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateAttestorRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: @@ -1292,7 +1292,7 @@ def test_create_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1306,7 +1306,7 @@ async def test_create_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateAttestorRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: @@ -1322,7 +1322,7 @@ async def test_create_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1531,7 +1531,7 @@ def test_get_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.GetAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: @@ -1547,7 +1547,7 @@ def test_get_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1561,7 +1561,7 @@ async def test_get_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: @@ -1577,7 +1577,7 @@ async def test_get_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1766,7 +1766,7 @@ def test_update_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateAttestorRequest() - request.attestor.name = "attestor.name/value" + request.attestor.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: @@ -1782,7 +1782,7 @@ def test_update_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor.name=attestor.name/value", + "attestor.name=name_value", ) in kw["metadata"] @@ -1796,7 +1796,7 @@ async def test_update_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateAttestorRequest() - request.attestor.name = "attestor.name/value" + request.attestor.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: @@ -1812,7 +1812,7 @@ async def test_update_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor.name=attestor.name/value", + "attestor.name=name_value", ) in kw["metadata"] @@ -1994,7 +1994,7 @@ def test_list_attestors_field_headers(): # a field header. Set these to a non-empty value. request = service.ListAttestorsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: @@ -2010,7 +2010,7 @@ def test_list_attestors_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2024,7 +2024,7 @@ async def test_list_attestors_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListAttestorsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: @@ -2042,7 +2042,7 @@ async def test_list_attestors_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2173,7 +2173,7 @@ def test_list_attestors_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, resources.Attestor) for i in results) @@ -2406,7 +2406,7 @@ def test_delete_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_attestor), "__call__") as call: @@ -2422,7 +2422,7 @@ def test_delete_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2436,7 +2436,7 @@ async def test_delete_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_attestor), "__call__") as call: @@ -2452,7 +2452,7 @@ async def test_delete_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index cec5b2c..f543d6e 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -772,7 +772,7 @@ def test_get_system_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.GetSystemPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -790,7 +790,7 @@ def test_get_system_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -804,7 +804,7 @@ async def test_get_system_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetSystemPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -822,7 +822,7 @@ async def test_get_system_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 1ea1b06..ac5de6d 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -778,7 +778,7 @@ def test_validate_attestation_occurrence_field_headers(): # a field header. Set these to a non-empty value. request = service.ValidateAttestationOccurrenceRequest() - request.attestor = "attestor/value" + request.attestor = "attestor_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -796,7 +796,7 @@ def test_validate_attestation_occurrence_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor=attestor/value", + "attestor=attestor_value", ) in kw["metadata"] @@ -810,7 +810,7 @@ async def test_validate_attestation_occurrence_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ValidateAttestationOccurrenceRequest() - request.attestor = "attestor/value" + request.attestor = "attestor_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -830,7 +830,7 @@ async def test_validate_attestation_occurrence_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor=attestor/value", + "attestor=attestor_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index 741b96e..c6e8d7e 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -811,7 +811,7 @@ def test_get_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.GetPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_policy), "__call__") as call: @@ -827,7 +827,7 @@ def test_get_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -841,7 +841,7 @@ async def test_get_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_policy), "__call__") as call: @@ -857,7 +857,7 @@ async def test_get_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1053,7 +1053,7 @@ def test_update_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdatePolicyRequest() - request.policy.name = "policy.name/value" + request.policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_policy), "__call__") as call: @@ -1069,7 +1069,7 @@ def test_update_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "policy.name=policy.name/value", + "policy.name=name_value", ) in kw["metadata"] @@ -1083,7 +1083,7 @@ async def test_update_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdatePolicyRequest() - request.policy.name = "policy.name/value" + request.policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_policy), "__call__") as call: @@ -1099,7 +1099,7 @@ async def test_update_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "policy.name=policy.name/value", + "policy.name=name_value", ) in kw["metadata"] @@ -1288,7 +1288,7 @@ def test_create_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateAttestorRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: @@ -1304,7 +1304,7 @@ def test_create_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1318,7 +1318,7 @@ async def test_create_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateAttestorRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: @@ -1334,7 +1334,7 @@ async def test_create_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1543,7 +1543,7 @@ def test_get_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.GetAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: @@ -1559,7 +1559,7 @@ def test_get_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1573,7 +1573,7 @@ async def test_get_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: @@ -1589,7 +1589,7 @@ async def test_get_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1778,7 +1778,7 @@ def test_update_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateAttestorRequest() - request.attestor.name = "attestor.name/value" + request.attestor.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: @@ -1794,7 +1794,7 @@ def test_update_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor.name=attestor.name/value", + "attestor.name=name_value", ) in kw["metadata"] @@ -1808,7 +1808,7 @@ async def test_update_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateAttestorRequest() - request.attestor.name = "attestor.name/value" + request.attestor.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: @@ -1824,7 +1824,7 @@ async def test_update_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attestor.name=attestor.name/value", + "attestor.name=name_value", ) in kw["metadata"] @@ -2006,7 +2006,7 @@ def test_list_attestors_field_headers(): # a field header. Set these to a non-empty value. request = service.ListAttestorsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: @@ -2022,7 +2022,7 @@ def test_list_attestors_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2036,7 +2036,7 @@ async def test_list_attestors_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListAttestorsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: @@ -2054,7 +2054,7 @@ async def test_list_attestors_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2185,7 +2185,7 @@ def test_list_attestors_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, resources.Attestor) for i in results) @@ -2418,7 +2418,7 @@ def test_delete_attestor_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_attestor), "__call__") as call: @@ -2434,7 +2434,7 @@ def test_delete_attestor_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2448,7 +2448,7 @@ async def test_delete_attestor_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteAttestorRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_attestor), "__call__") as call: @@ -2464,7 +2464,7 @@ async def test_delete_attestor_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index 02b46ed..e89af52 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -793,7 +793,7 @@ def test_get_system_policy_field_headers(): # a field header. Set these to a non-empty value. request = service.GetSystemPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -811,7 +811,7 @@ def test_get_system_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -825,7 +825,7 @@ async def test_get_system_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetSystemPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -843,7 +843,7 @@ async def test_get_system_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] From 8c7a7041ccd139d72c4d7b0436a54ff83d46ee04 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 12:13:28 -0400 Subject: [PATCH 12/18] chore: [autoapprove] update readme_gen.py to include autoescape True (#144) Source-Link: https://github.com/googleapis/synthtool/commit/6b4d5a6407d740beb4158b302194a62a4108a8a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- scripts/readme-gen/readme_gen.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6..b631901 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 +# created: 2022-05-05T15:17:27.599381182Z diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') From 42d76871b01872f880a2cf41c840ebbaf3b4138f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 23:36:18 +0000 Subject: [PATCH 13/18] chore(python): auto approve template changes (#146) Source-Link: https://github.com/googleapis/synthtool/commit/453a5d9c9a55d1969240a37d36cec626d20a9024 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-approve.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/auto-approve.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b631901..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 -# created: 2022-05-05T15:17:27.599381182Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" From 0170f5f0045b4f5541d985724a84598e9fb7e3fa Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 17:24:20 +0000 Subject: [PATCH 14/18] chore: use gapic-generator-python 1.0.0 (#147) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 451250442 Source-Link: https://github.com/googleapis/googleapis/commit/cca5e8181f6442b134e8d4d206fbe9e0e74684ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/0b219da161a8bdcc3c6f7b2efcd82105182a30ca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9 --- .../test_binauthz_management_service_v1.py | 8 +++++++- .../gapic/binaryauthorization_v1/test_system_policy_v1.py | 8 +++++++- .../binaryauthorization_v1/test_validation_helper_v1.py | 8 +++++++- .../test_binauthz_management_service_v1_beta1.py | 8 +++++++- .../test_system_policy_v1_beta1.py | 8 +++++++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index e124965..e98a7ce 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index f543d6e..955572d 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index ac5de6d..8f32fe8 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index c6e8d7e..03c9c03 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index e89af52..f9d5e10 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio From 276802072057a817993311b92111ee4f84c7505a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 1 Jun 2022 22:27:31 -0400 Subject: [PATCH 15/18] fix(deps): require protobuf <4.0.0dev (#148) --- setup.py | 5 +++-- testing/constraints-3.6.txt | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9b0178d..3f6e52b 100644 --- a/setup.py +++ b/setup.py @@ -50,8 +50,9 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", - "grafeas >= 1.1.2", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", + "grafeas >= 1.1.2, <2.0dev", ), python_requires=">=3.6", classifiers=[ diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 71a1281..ca3c4ca 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,3 +7,4 @@ google-api-core==1.31.5 proto-plus==1.15.0 grafeas==1.1.2 +protobuf==3.19.0 From 3d3d7e40793834a4d079e83d21db6ec1fe285718 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:42:17 -0400 Subject: [PATCH 16/18] docs: fix changelog header to consistent size (#149) Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1143f5..e76cc82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ # Changelog -### [1.2.2](https://github.com/googleapis/python-binary-authorization/compare/v1.2.1...v1.2.2) (2022-03-05) +## [1.2.2](https://github.com/googleapis/python-binary-authorization/compare/v1.2.1...v1.2.2) (2022-03-05) ### Bug Fixes * **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#126](https://github.com/googleapis/python-binary-authorization/issues/126)) ([2b7e982](https://github.com/googleapis/python-binary-authorization/commit/2b7e982e09b85570af842acba3ca6c48831a49e2)) -### [1.2.1](https://github.com/googleapis/python-binary-authorization/compare/v1.2.0...v1.2.1) (2022-02-11) +## [1.2.1](https://github.com/googleapis/python-binary-authorization/compare/v1.2.0...v1.2.1) (2022-02-11) ### Bug Fixes @@ -30,7 +30,7 @@ * **v1beta1:** add SystemPolicyV1Beta1 service ([f25d17a](https://www.github.com/googleapis/python-binary-authorization/commit/f25d17abaefe4a2d317161ec15b867b33eb3e8ba)) * **v1beta1:** update SignatureAlgorithm enum to match algorithm names in KMS ([f25d17a](https://www.github.com/googleapis/python-binary-authorization/commit/f25d17abaefe4a2d317161ec15b867b33eb3e8ba)) -### [1.0.1](https://www.github.com/googleapis/python-binary-authorization/compare/v1.0.0...v1.0.1) (2021-11-01) +## [1.0.1](https://www.github.com/googleapis/python-binary-authorization/compare/v1.0.0...v1.0.1) (2021-11-01) ### Bug Fixes @@ -64,7 +64,7 @@ * add context manager support in client ([#84](https://www.github.com/googleapis/python-binary-authorization/issues/84)) ([0991f56](https://www.github.com/googleapis/python-binary-authorization/commit/0991f564af01dc8b0172693290a9aba566035848)) -### [0.4.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.4.0...v0.4.1) (2021-09-30) +## [0.4.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.4.0...v0.4.1) (2021-09-30) ### Bug Fixes @@ -90,7 +90,7 @@ * fix broken links in README ([cd828ec](https://www.github.com/googleapis/python-binary-authorization/commit/cd828ec45edb5a297607ea7e9f94c39e68ef2d7d)) -### [0.3.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.3.0...v0.3.1) (2021-07-26) +## [0.3.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.3.0...v0.3.1) (2021-07-26) ### Bug Fixes @@ -125,14 +125,14 @@ * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-binary-authorization/issues/1127)) ([#43](https://www.github.com/googleapis/python-binary-authorization/issues/43)) ([726d589](https://www.github.com/googleapis/python-binary-authorization/commit/726d58920de4e97a70cbbe1fd88ac427224ba1ea)), closes [#1126](https://www.github.com/googleapis/python-binary-authorization/issues/1126) -### [0.2.2](https://www.github.com/googleapis/python-binary-authorization/compare/v0.2.1...v0.2.2) (2021-06-16) +## [0.2.2](https://www.github.com/googleapis/python-binary-authorization/compare/v0.2.1...v0.2.2) (2021-06-16) ### Bug Fixes * exclude docs and tests from package ([#39](https://www.github.com/googleapis/python-binary-authorization/issues/39)) ([a90d7f4](https://www.github.com/googleapis/python-binary-authorization/commit/a90d7f46ca54c3bf805208bff157cfbc48a14234)) -### [0.2.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.2.0...v0.2.1) (2021-05-25) +## [0.2.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.2.0...v0.2.1) (2021-05-25) ### Bug Fixes @@ -146,7 +146,7 @@ * Publish Binary Authorization ContinuousValidationEvent proto ([#31](https://www.github.com/googleapis/python-binary-authorization/issues/31)) ([d3d2abe](https://www.github.com/googleapis/python-binary-authorization/commit/d3d2abeb22bad714de0591916c1065fda7305a92)) -### [0.1.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.1.0...v0.1.1) (2021-04-01) +## [0.1.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.1.0...v0.1.1) (2021-04-01) ### Bug Fixes From fd16f2fdf18c78203e67a90713c9358a0b375106 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 3 Jun 2022 12:56:46 -0400 Subject: [PATCH 17/18] chore: test minimum dependencies in python 3.7 (#152) --- testing/constraints-3.7.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index da93009..ca3c4ca 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,2 +1,10 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +grafeas==1.1.2 +protobuf==3.19.0 From cf7e5ba0f1047b69651699ac29b1e1f5121b83c3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 06:44:49 -0400 Subject: [PATCH 18/18] chore(main): release 1.2.3 (#150) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e76cc82..70eefb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.2.3](https://github.com/googleapis/python-binary-authorization/compare/v1.2.2...v1.2.3) (2022-06-03) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#148](https://github.com/googleapis/python-binary-authorization/issues/148)) ([2768020](https://github.com/googleapis/python-binary-authorization/commit/276802072057a817993311b92111ee4f84c7505a)) + + +### Documentation + +* fix changelog header to consistent size ([#149](https://github.com/googleapis/python-binary-authorization/issues/149)) ([3d3d7e4](https://github.com/googleapis/python-binary-authorization/commit/3d3d7e40793834a4d079e83d21db6ec1fe285718)) + ## [1.2.2](https://github.com/googleapis/python-binary-authorization/compare/v1.2.1...v1.2.2) (2022-03-05) diff --git a/setup.py b/setup.py index 3f6e52b..b0bf079 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore -version = "1.2.2" +version = "1.2.3" package_root = os.path.abspath(os.path.dirname(__file__))