diff --git a/packages/google-cloud-kms/.github/.OwlBot.lock.yaml b/packages/google-cloud-kms/.github/.OwlBot.lock.yaml index 44c78f7cc12d..87dd00611576 100644 --- a/packages/google-cloud-kms/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-kms/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/packages/google-cloud-kms/docs/conf.py b/packages/google-cloud-kms/docs/conf.py index c7ccd4acc7d7..39f1d289f159 100644 --- a/packages/google-cloud-kms/docs/conf.py +++ b/packages/google-cloud-kms/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-kms", "google-cloud-kms Documentation", [author], 1,) + ( + root_doc, + "google-cloud-kms", + "google-cloud-kms Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py index 7fb2edc407a4..6d1c9f1552df 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py @@ -314,12 +314,20 @@ def sample_list_ekm_connections(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListEkmConnectionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -435,7 +443,12 @@ def sample_get_ekm_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -572,7 +585,12 @@ def sample_create_ekm_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -697,7 +715,12 @@ def sample_update_ekm_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -809,7 +832,12 @@ async def set_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -922,7 +950,12 @@ async def get_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -977,7 +1010,12 @@ async def test_iam_permissions( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -991,7 +1029,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py index 012c487e0d79..d371d0e0b6c6 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py @@ -57,7 +57,10 @@ class EkmServiceClientMeta(type): _transport_registry["grpc"] = EkmServiceGrpcTransport _transport_registry["grpc_asyncio"] = EkmServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[EkmServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[EkmServiceTransport]: """Returns an appropriate transport class. @@ -172,10 +175,16 @@ def transport(self) -> EkmServiceTransport: return self._transport @staticmethod - def ekm_connection_path(project: str, location: str, ekm_connection: str,) -> str: + def ekm_connection_path( + project: str, + location: str, + ekm_connection: str, + ) -> str: """Returns a fully-qualified ekm_connection string.""" return "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}".format( - project=project, location=location, ekm_connection=ekm_connection, + project=project, + location=location, + ekm_connection=ekm_connection, ) @staticmethod @@ -188,10 +197,18 @@ def parse_ekm_connection_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def service_path(project: str, location: str, namespace: str, service: str,) -> str: + def service_path( + project: str, + location: str, + namespace: str, + service: str, + ) -> str: """Returns a fully-qualified service string.""" return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) @staticmethod @@ -204,7 +221,9 @@ def parse_service_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, @@ -217,9 +236,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]: @@ -228,9 +251,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]: @@ -239,9 +266,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]: @@ -250,10 +281,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,12 +556,20 @@ def sample_list_ekm_connections(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListEkmConnectionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -632,7 +675,12 @@ def sample_get_ekm_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -759,7 +807,12 @@ def sample_create_ekm_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -874,7 +927,12 @@ def sample_update_ekm_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -999,7 +1057,12 @@ def set_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1112,7 +1175,12 @@ def get_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1167,7 +1235,12 @@ def test_iam_permissions( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1175,7 +1248,9 @@ def test_iam_permissions( try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py index eeaadcfeafe8..0ca81047ba59 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -188,9 +190,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py index 207ac2e604be..1428ca0fcf41 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py @@ -231,8 +231,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py index e45e46a6f268..d2f79daa53b5 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py @@ -345,12 +345,20 @@ def sample_list_key_rings(): ) # 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.ListKeyRingsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -457,12 +465,20 @@ def sample_list_crypto_keys(): ) # 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.ListCryptoKeysAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -570,12 +586,20 @@ def sample_list_crypto_key_versions(): ) # 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.ListCryptoKeyVersionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -682,12 +706,20 @@ def sample_list_import_jobs(): ) # 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.ListImportJobsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -791,7 +823,12 @@ def sample_get_key_ring(): ) # 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 @@ -903,7 +940,12 @@ def sample_get_crypto_key(): ) # 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 @@ -1020,7 +1062,12 @@ def sample_get_crypto_key_version(): ) # 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 @@ -1132,7 +1179,12 @@ def sample_get_public_key(): ) # 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 @@ -1280,7 +1332,12 @@ def sample_get_import_job(): ) # 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 @@ -1405,7 +1462,12 @@ def sample_create_key_ring(): ) # 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 @@ -1540,7 +1602,12 @@ def sample_create_crypto_key(): ) # 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 @@ -1664,7 +1731,12 @@ def sample_create_crypto_key_version(): ) # 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 @@ -1758,7 +1830,12 @@ def sample_import_crypto_key_version(): ) # 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 @@ -1935,7 +2012,12 @@ def sample_create_import_job(): ) # 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 @@ -2053,7 +2135,12 @@ def sample_update_crypto_key(): ) # 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 @@ -2192,7 +2279,12 @@ def sample_update_crypto_key_version(): ) # 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 @@ -2317,7 +2409,12 @@ def sample_update_crypto_key_primary_version(): ) # 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 @@ -2454,7 +2551,12 @@ def sample_destroy_crypto_key_version(): ) # 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 @@ -2580,7 +2682,12 @@ def sample_restore_crypto_key_version(): ) # 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 @@ -2713,7 +2820,12 @@ def sample_encrypt(): ) # 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 @@ -2832,7 +2944,12 @@ def sample_decrypt(): ) # 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 @@ -2956,7 +3073,12 @@ def sample_asymmetric_sign(): ) # 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 @@ -3077,7 +3199,12 @@ def sample_asymmetric_decrypt(): ) # 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 @@ -3196,7 +3323,12 @@ def sample_mac_sign(): ) # 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 @@ -3324,7 +3456,12 @@ def sample_mac_verify(): ) # 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 @@ -3452,7 +3589,12 @@ def sample_generate_random_bytes(): ) # 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 @@ -3564,7 +3706,12 @@ async def set_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3677,7 +3824,12 @@ async def get_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3732,7 +3884,12 @@ async def test_iam_permissions( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3746,7 +3903,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py index 5d1a679cc134..0be42736bd16 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py @@ -63,7 +63,8 @@ class KeyManagementServiceClientMeta(type): _transport_registry["grpc_asyncio"] = KeyManagementServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[KeyManagementServiceTransport]: """Returns an appropriate transport class. @@ -186,7 +187,10 @@ def transport(self) -> KeyManagementServiceTransport: @staticmethod def crypto_key_path( - project: str, location: str, key_ring: str, crypto_key: str, + project: str, + location: str, + key_ring: str, + crypto_key: str, ) -> str: """Returns a fully-qualified crypto_key string.""" return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format( @@ -233,7 +237,10 @@ def parse_crypto_key_version_path(path: str) -> Dict[str, str]: @staticmethod def import_job_path( - project: str, location: str, key_ring: str, import_job: str, + project: str, + location: str, + key_ring: str, + import_job: str, ) -> str: """Returns a fully-qualified import_job string.""" return "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}".format( @@ -253,10 +260,16 @@ def parse_import_job_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def key_ring_path(project: str, location: str, key_ring: str,) -> str: + def key_ring_path( + project: str, + location: str, + key_ring: str, + ) -> str: """Returns a fully-qualified key_ring string.""" return "projects/{project}/locations/{location}/keyRings/{key_ring}".format( - project=project, location=location, key_ring=key_ring, + project=project, + location=location, + key_ring=key_ring, ) @staticmethod @@ -295,7 +308,9 @@ def parse_public_key_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, @@ -308,9 +323,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]: @@ -319,9 +338,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]: @@ -330,9 +353,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]: @@ -341,10 +368,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 @@ -611,12 +642,20 @@ def sample_list_key_rings(): ) # 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.ListKeyRingsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -713,12 +752,20 @@ def sample_list_crypto_keys(): ) # 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.ListCryptoKeysPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -816,12 +863,20 @@ def sample_list_crypto_key_versions(): ) # 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.ListCryptoKeyVersionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -918,12 +973,20 @@ def sample_list_import_jobs(): ) # 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.ListImportJobsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1017,7 +1080,12 @@ def sample_get_key_ring(): ) # 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 @@ -1119,7 +1187,12 @@ def sample_get_crypto_key(): ) # 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 @@ -1226,7 +1299,12 @@ def sample_get_crypto_key_version(): ) # 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 @@ -1328,7 +1406,12 @@ def sample_get_public_key(): ) # 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 @@ -1466,7 +1549,12 @@ def sample_get_import_job(): ) # 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 @@ -1581,7 +1669,12 @@ def sample_create_key_ring(): ) # 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 @@ -1706,7 +1799,12 @@ def sample_create_crypto_key(): ) # 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 @@ -1832,7 +1930,12 @@ def sample_create_crypto_key_version(): ) # 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 @@ -1929,7 +2032,12 @@ def sample_import_crypto_key_version(): ) # 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 @@ -2096,7 +2204,12 @@ def sample_create_import_job(): ) # 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 @@ -2204,7 +2317,12 @@ def sample_update_crypto_key(): ) # 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 @@ -2335,7 +2453,12 @@ def sample_update_crypto_key_version(): ) # 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 @@ -2452,7 +2575,12 @@ def sample_update_crypto_key_primary_version(): ) # 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 @@ -2581,7 +2709,12 @@ def sample_destroy_crypto_key_version(): ) # 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 @@ -2699,7 +2832,12 @@ def sample_restore_crypto_key_version(): ) # 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 @@ -2822,7 +2960,12 @@ def sample_encrypt(): ) # 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 @@ -2931,7 +3074,12 @@ def sample_decrypt(): ) # 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 @@ -3045,7 +3193,12 @@ def sample_asymmetric_sign(): ) # 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 @@ -3156,7 +3309,12 @@ def sample_asymmetric_decrypt(): ) # 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 @@ -3265,7 +3423,12 @@ def sample_mac_sign(): ) # 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 @@ -3383,7 +3546,12 @@ def sample_mac_verify(): ) # 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 @@ -3501,7 +3669,12 @@ def sample_generate_random_bytes(): ) # 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 @@ -3626,7 +3799,12 @@ def set_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3739,7 +3917,12 @@ def get_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3794,7 +3977,12 @@ def test_iam_permissions( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3802,7 +3990,9 @@ def test_iam_permissions( try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py index 49b02ccb37ab..774320c7ff0d 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py @@ -32,7 +32,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-kms",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-kms", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -499,9 +501,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py index 3e0446372c5d..6926c6e982c4 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py @@ -238,8 +238,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py index d35d429e31bd..5215c8b459c0 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py @@ -65,11 +65,26 @@ class ListEkmConnectionsRequest(proto.Message): results `__. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListEkmConnectionsResponse(proto.Message): @@ -94,10 +109,18 @@ def raw_page(self): return self ekm_connections = proto.RepeatedField( - proto.MESSAGE, number=1, message="EkmConnection", + proto.MESSAGE, + number=1, + message="EkmConnection", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + total_size = proto.Field( + proto.INT32, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - total_size = proto.Field(proto.INT32, number=3,) class GetEkmConnectionRequest(proto.Message): @@ -110,7 +133,10 @@ class GetEkmConnectionRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateEkmConnectionRequest(proto.Message): @@ -130,9 +156,19 @@ class CreateEkmConnectionRequest(proto.Message): initial field values. """ - parent = proto.Field(proto.STRING, number=1,) - ekm_connection_id = proto.Field(proto.STRING, number=2,) - ekm_connection = proto.Field(proto.MESSAGE, number=3, message="EkmConnection",) + parent = proto.Field( + proto.STRING, + number=1, + ) + ekm_connection_id = proto.Field( + proto.STRING, + number=2, + ) + ekm_connection = proto.Field( + proto.MESSAGE, + number=3, + message="EkmConnection", + ) class UpdateEkmConnectionRequest(proto.Message): @@ -147,9 +183,15 @@ class UpdateEkmConnectionRequest(proto.Message): this request. """ - ekm_connection = proto.Field(proto.MESSAGE, number=1, message="EkmConnection",) + ekm_connection = proto.Field( + proto.MESSAGE, + number=1, + message="EkmConnection", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -193,19 +235,44 @@ class Certificate(proto.Message): [parsed][google.cloud.kms.v1.Certificate.parsed] is true. """ - raw_der = proto.Field(proto.BYTES, number=1,) - parsed = proto.Field(proto.BOOL, number=2,) - issuer = proto.Field(proto.STRING, number=3,) - subject = proto.Field(proto.STRING, number=4,) - subject_alternative_dns_names = proto.RepeatedField(proto.STRING, number=5,) + raw_der = proto.Field( + proto.BYTES, + number=1, + ) + parsed = proto.Field( + proto.BOOL, + number=2, + ) + issuer = proto.Field( + proto.STRING, + number=3, + ) + subject = proto.Field( + proto.STRING, + number=4, + ) + subject_alternative_dns_names = proto.RepeatedField( + proto.STRING, + number=5, + ) not_before_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) not_after_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + serial_number = proto.Field( + proto.STRING, + number=8, + ) + sha256_fingerprint = proto.Field( + proto.STRING, + number=9, ) - serial_number = proto.Field(proto.STRING, number=8,) - sha256_fingerprint = proto.Field(proto.STRING, number=9,) class EkmConnection(proto.Message): @@ -269,19 +336,42 @@ class ServiceResolver(proto.Message): EKM replica. """ - service_directory_service = proto.Field(proto.STRING, number=1,) - endpoint_filter = proto.Field(proto.STRING, number=2,) - hostname = proto.Field(proto.STRING, number=3,) + service_directory_service = proto.Field( + proto.STRING, + number=1, + ) + endpoint_filter = proto.Field( + proto.STRING, + number=2, + ) + hostname = proto.Field( + proto.STRING, + number=3, + ) server_certificates = proto.RepeatedField( - proto.MESSAGE, number=4, message="Certificate", + proto.MESSAGE, + number=4, + message="Certificate", ) - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) service_resolvers = proto.RepeatedField( - proto.MESSAGE, number=3, message=ServiceResolver, + proto.MESSAGE, + number=3, + message=ServiceResolver, + ) + etag = proto.Field( + proto.STRING, + number=5, ) - etag = proto.Field(proto.STRING, number=5,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py index d530a565362f..10c2b7a18fe3 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py @@ -63,8 +63,15 @@ class KeyRing(proto.Message): [KeyRing][google.cloud.kms.v1.KeyRing] was created. """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class CryptoKey(proto.Message): @@ -200,12 +207,29 @@ class CryptoKeyPurpose(proto.Enum): ASYMMETRIC_DECRYPT = 6 MAC = 9 - name = proto.Field(proto.STRING, number=1,) - primary = proto.Field(proto.MESSAGE, number=2, message="CryptoKeyVersion",) - purpose = proto.Field(proto.ENUM, number=3, enum=CryptoKeyPurpose,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + primary = proto.Field( + proto.MESSAGE, + number=2, + message="CryptoKeyVersion", + ) + purpose = proto.Field( + proto.ENUM, + number=3, + enum=CryptoKeyPurpose, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) next_rotation_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, ) rotation_period = proto.Field( proto.MESSAGE, @@ -214,14 +238,28 @@ class CryptoKeyPurpose(proto.Enum): message=duration_pb2.Duration, ) version_template = proto.Field( - proto.MESSAGE, number=11, message="CryptoKeyVersionTemplate", + proto.MESSAGE, + number=11, + message="CryptoKeyVersionTemplate", + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) + import_only = proto.Field( + proto.BOOL, + number=13, ) - labels = proto.MapField(proto.STRING, proto.STRING, number=10,) - import_only = proto.Field(proto.BOOL, number=13,) destroy_scheduled_duration = proto.Field( - proto.MESSAGE, number=14, message=duration_pb2.Duration, + proto.MESSAGE, + number=14, + message=duration_pb2.Duration, + ) + crypto_key_backend = proto.Field( + proto.STRING, + number=15, ) - crypto_key_backend = proto.Field(proto.STRING, number=15,) class CryptoKeyVersionTemplate(proto.Message): @@ -254,9 +292,15 @@ class CryptoKeyVersionTemplate(proto.Message): [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. """ - protection_level = proto.Field(proto.ENUM, number=1, enum="ProtectionLevel",) + protection_level = proto.Field( + proto.ENUM, + number=1, + enum="ProtectionLevel", + ) algorithm = proto.Field( - proto.ENUM, number=3, enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", + proto.ENUM, + number=3, + enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", ) @@ -300,13 +344,33 @@ class CertificateChains(proto.Message): corresponding to the attestation. """ - cavium_certs = proto.RepeatedField(proto.STRING, number=1,) - google_card_certs = proto.RepeatedField(proto.STRING, number=2,) - google_partition_certs = proto.RepeatedField(proto.STRING, number=3,) - - format = proto.Field(proto.ENUM, number=4, enum=AttestationFormat,) - content = proto.Field(proto.BYTES, number=5,) - cert_chains = proto.Field(proto.MESSAGE, number=6, message=CertificateChains,) + cavium_certs = proto.RepeatedField( + proto.STRING, + number=1, + ) + google_card_certs = proto.RepeatedField( + proto.STRING, + number=2, + ) + google_partition_certs = proto.RepeatedField( + proto.STRING, + number=3, + ) + + format = proto.Field( + proto.ENUM, + number=4, + enum=AttestationFormat, + ) + content = proto.Field( + proto.BYTES, + number=5, + ) + cert_chains = proto.Field( + proto.MESSAGE, + number=6, + message=CertificateChains, + ) class CryptoKeyVersion(proto.Message): @@ -501,32 +565,72 @@ class CryptoKeyVersionView(proto.Enum): CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0 FULL = 1 - name = proto.Field(proto.STRING, number=1,) - state = proto.Field(proto.ENUM, number=3, enum=CryptoKeyVersionState,) - protection_level = proto.Field(proto.ENUM, number=7, enum="ProtectionLevel",) - algorithm = proto.Field(proto.ENUM, number=10, enum=CryptoKeyVersionAlgorithm,) + name = proto.Field( + proto.STRING, + number=1, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=CryptoKeyVersionState, + ) + protection_level = proto.Field( + proto.ENUM, + number=7, + enum="ProtectionLevel", + ) + algorithm = proto.Field( + proto.ENUM, + number=10, + enum=CryptoKeyVersionAlgorithm, + ) attestation = proto.Field( - proto.MESSAGE, number=8, message="KeyOperationAttestation", + proto.MESSAGE, + number=8, + message="KeyOperationAttestation", + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) generate_time = proto.Field( - proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=11, + message=timestamp_pb2.Timestamp, ) destroy_time = proto.Field( - proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) destroy_event_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + import_job = proto.Field( + proto.STRING, + number=14, ) - import_job = proto.Field(proto.STRING, number=14,) import_time = proto.Field( - proto.MESSAGE, number=15, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=15, + message=timestamp_pb2.Timestamp, + ) + import_failure_reason = proto.Field( + proto.STRING, + number=16, ) - import_failure_reason = proto.Field(proto.STRING, number=16,) external_protection_level_options = proto.Field( - proto.MESSAGE, number=17, message="ExternalProtectionLevelOptions", + proto.MESSAGE, + number=17, + message="ExternalProtectionLevelOptions", + ) + reimport_eligible = proto.Field( + proto.BOOL, + number=18, ) - reimport_eligible = proto.Field(proto.BOOL, number=18,) class PublicKey(proto.Message): @@ -578,13 +682,29 @@ class PublicKey(proto.Message): public key. """ - pem = proto.Field(proto.STRING, number=1,) + pem = proto.Field( + proto.STRING, + number=1, + ) algorithm = proto.Field( - proto.ENUM, number=2, enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", + proto.ENUM, + number=2, + enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", + ) + pem_crc32c = proto.Field( + proto.MESSAGE, + number=3, + message=wrappers_pb2.Int64Value, + ) + name = proto.Field( + proto.STRING, + number=4, + ) + protection_level = proto.Field( + proto.ENUM, + number=5, + enum="ProtectionLevel", ) - pem_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,) - name = proto.Field(proto.STRING, number=4,) - protection_level = proto.Field(proto.ENUM, number=5, enum="ProtectionLevel",) class ImportJob(proto.Message): @@ -709,23 +829,59 @@ class WrappingPublicKey(proto.Message): (https://tools.ietf.org/html/rfc7468#section-13). """ - pem = proto.Field(proto.STRING, number=1,) + pem = proto.Field( + proto.STRING, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - import_method = proto.Field(proto.ENUM, number=2, enum=ImportMethod,) - protection_level = proto.Field(proto.ENUM, number=9, enum="ProtectionLevel",) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + import_method = proto.Field( + proto.ENUM, + number=2, + enum=ImportMethod, + ) + protection_level = proto.Field( + proto.ENUM, + number=9, + enum="ProtectionLevel", + ) + create_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) generate_time = proto.Field( - proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) expire_event_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=ImportJobState, + ) + public_key = proto.Field( + proto.MESSAGE, + number=7, + message=WrappingPublicKey, ) - state = proto.Field(proto.ENUM, number=6, enum=ImportJobState,) - public_key = proto.Field(proto.MESSAGE, number=7, message=WrappingPublicKey,) attestation = proto.Field( - proto.MESSAGE, number=8, message="KeyOperationAttestation", + proto.MESSAGE, + number=8, + message="KeyOperationAttestation", ) @@ -751,8 +907,14 @@ class ExternalProtectionLevelOptions(proto.Message): using an [EkmConnection][google.cloud.kms.v1.EkmConnection]. """ - external_key_uri = proto.Field(proto.STRING, number=1,) - ekm_connection_key_path = proto.Field(proto.STRING, number=2,) + external_key_uri = proto.Field( + proto.STRING, + number=1, + ) + ekm_connection_key_path = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py index 020d5d218c93..9a4bdb72ab46 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py @@ -98,11 +98,26 @@ class ListKeyRingsRequest(proto.Message): results `__. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListCryptoKeysRequest(proto.Message): @@ -141,14 +156,31 @@ class ListCryptoKeysRequest(proto.Message): results `__. """ - 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, + ) version_view = proto.Field( - proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView, + proto.ENUM, + number=4, + enum=resources.CryptoKeyVersion.CryptoKeyVersionView, + ) + filter = proto.Field( + proto.STRING, + number=5, + ) + order_by = proto.Field( + proto.STRING, + number=6, ) - filter = proto.Field(proto.STRING, number=5,) - order_by = proto.Field(proto.STRING, number=6,) class ListCryptoKeyVersionsRequest(proto.Message): @@ -186,14 +218,31 @@ class ListCryptoKeyVersionsRequest(proto.Message): results `__. """ - 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, + ) view = proto.Field( - proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView, + proto.ENUM, + number=4, + enum=resources.CryptoKeyVersion.CryptoKeyVersionView, + ) + filter = proto.Field( + proto.STRING, + number=5, + ) + order_by = proto.Field( + proto.STRING, + number=6, ) - filter = proto.Field(proto.STRING, number=5,) - order_by = proto.Field(proto.STRING, number=6,) class ListImportJobsRequest(proto.Message): @@ -229,11 +278,26 @@ class ListImportJobsRequest(proto.Message): results `__. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListKeyRingsResponse(proto.Message): @@ -256,9 +320,19 @@ class ListKeyRingsResponse(proto.Message): def raw_page(self): return self - key_rings = proto.RepeatedField(proto.MESSAGE, number=1, message=resources.KeyRing,) - next_page_token = proto.Field(proto.STRING, number=2,) - total_size = proto.Field(proto.INT32, number=3,) + key_rings = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.KeyRing, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + total_size = proto.Field( + proto.INT32, + number=3, + ) class ListCryptoKeysResponse(proto.Message): @@ -283,10 +357,18 @@ def raw_page(self): return self crypto_keys = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.CryptoKey, + proto.MESSAGE, + number=1, + message=resources.CryptoKey, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + total_size = proto.Field( + proto.INT32, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - total_size = proto.Field(proto.INT32, number=3,) class ListCryptoKeyVersionsResponse(proto.Message): @@ -312,10 +394,18 @@ def raw_page(self): return self crypto_key_versions = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.CryptoKeyVersion, + proto.MESSAGE, + number=1, + message=resources.CryptoKeyVersion, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + total_size = proto.Field( + proto.INT32, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - total_size = proto.Field(proto.INT32, number=3,) class ListImportJobsResponse(proto.Message): @@ -340,10 +430,18 @@ def raw_page(self): return self import_jobs = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.ImportJob, + proto.MESSAGE, + number=1, + message=resources.ImportJob, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + total_size = proto.Field( + proto.INT32, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - total_size = proto.Field(proto.INT32, number=3,) class GetKeyRingRequest(proto.Message): @@ -356,7 +454,10 @@ class GetKeyRingRequest(proto.Message): the [KeyRing][google.cloud.kms.v1.KeyRing] to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetCryptoKeyRequest(proto.Message): @@ -369,7 +470,10 @@ class GetCryptoKeyRequest(proto.Message): the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetCryptoKeyVersionRequest(proto.Message): @@ -384,7 +488,10 @@ class GetCryptoKeyVersionRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetPublicKeyRequest(proto.Message): @@ -399,7 +506,10 @@ class GetPublicKeyRequest(proto.Message): public key to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetImportJobRequest(proto.Message): @@ -412,7 +522,10 @@ class GetImportJobRequest(proto.Message): the [ImportJob][google.cloud.kms.v1.ImportJob] to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateKeyRingRequest(proto.Message): @@ -432,9 +545,19 @@ class CreateKeyRingRequest(proto.Message): initial field values. """ - parent = proto.Field(proto.STRING, number=1,) - key_ring_id = proto.Field(proto.STRING, number=2,) - key_ring = proto.Field(proto.MESSAGE, number=3, message=resources.KeyRing,) + parent = proto.Field( + proto.STRING, + number=1, + ) + key_ring_id = proto.Field( + proto.STRING, + number=2, + ) + key_ring = proto.Field( + proto.MESSAGE, + number=3, + message=resources.KeyRing, + ) class CreateCryptoKeyRequest(proto.Message): @@ -464,10 +587,23 @@ class CreateCryptoKeyRequest(proto.Message): [CryptoKey][google.cloud.kms.v1.CryptoKey]. """ - parent = proto.Field(proto.STRING, number=1,) - crypto_key_id = proto.Field(proto.STRING, number=2,) - crypto_key = proto.Field(proto.MESSAGE, number=3, message=resources.CryptoKey,) - skip_initial_version_creation = proto.Field(proto.BOOL, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + crypto_key_id = proto.Field( + proto.STRING, + number=2, + ) + crypto_key = proto.Field( + proto.MESSAGE, + number=3, + message=resources.CryptoKey, + ) + skip_initial_version_creation = proto.Field( + proto.BOOL, + number=5, + ) class CreateCryptoKeyVersionRequest(proto.Message): @@ -486,9 +622,14 @@ class CreateCryptoKeyVersionRequest(proto.Message): with initial field values. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) crypto_key_version = proto.Field( - proto.MESSAGE, number=2, message=resources.CryptoKeyVersion, + proto.MESSAGE, + number=2, + message=resources.CryptoKeyVersion, ) @@ -581,14 +722,27 @@ class ImportCryptoKeyVersionRequest(proto.Message): This field is a member of `oneof`_ ``wrapped_key_material``. """ - parent = proto.Field(proto.STRING, number=1,) - crypto_key_version = proto.Field(proto.STRING, number=6,) + parent = proto.Field( + proto.STRING, + number=1, + ) + crypto_key_version = proto.Field( + proto.STRING, + number=6, + ) algorithm = proto.Field( - proto.ENUM, number=2, enum=resources.CryptoKeyVersion.CryptoKeyVersionAlgorithm, + proto.ENUM, + number=2, + enum=resources.CryptoKeyVersion.CryptoKeyVersionAlgorithm, + ) + import_job = proto.Field( + proto.STRING, + number=4, ) - import_job = proto.Field(proto.STRING, number=4,) rsa_aes_wrapped_key = proto.Field( - proto.BYTES, number=5, oneof="wrapped_key_material", + proto.BYTES, + number=5, + oneof="wrapped_key_material", ) @@ -609,9 +763,19 @@ class CreateImportJobRequest(proto.Message): initial field values. """ - parent = proto.Field(proto.STRING, number=1,) - import_job_id = proto.Field(proto.STRING, number=2,) - import_job = proto.Field(proto.MESSAGE, number=3, message=resources.ImportJob,) + parent = proto.Field( + proto.STRING, + number=1, + ) + import_job_id = proto.Field( + proto.STRING, + number=2, + ) + import_job = proto.Field( + proto.MESSAGE, + number=3, + message=resources.ImportJob, + ) class UpdateCryptoKeyRequest(proto.Message): @@ -627,9 +791,15 @@ class UpdateCryptoKeyRequest(proto.Message): this request. """ - crypto_key = proto.Field(proto.MESSAGE, number=1, message=resources.CryptoKey,) + crypto_key = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CryptoKey, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -648,10 +818,14 @@ class UpdateCryptoKeyVersionRequest(proto.Message): """ crypto_key_version = proto.Field( - proto.MESSAGE, number=1, message=resources.CryptoKeyVersion, + proto.MESSAGE, + number=1, + message=resources.CryptoKeyVersion, ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -669,8 +843,14 @@ class UpdateCryptoKeyPrimaryVersionRequest(proto.Message): use as primary. """ - name = proto.Field(proto.STRING, number=1,) - crypto_key_version_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + crypto_key_version_id = proto.Field( + proto.STRING, + number=2, + ) class DestroyCryptoKeyVersionRequest(proto.Message): @@ -684,7 +864,10 @@ class DestroyCryptoKeyVersionRequest(proto.Message): destroy. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class RestoreCryptoKeyVersionRequest(proto.Message): @@ -698,7 +881,10 @@ class RestoreCryptoKeyVersionRequest(proto.Message): restore. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class EncryptRequest(proto.Message): @@ -783,14 +969,27 @@ class EncryptRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - plaintext = proto.Field(proto.BYTES, number=2,) - additional_authenticated_data = proto.Field(proto.BYTES, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + plaintext = proto.Field( + proto.BYTES, + number=2, + ) + additional_authenticated_data = proto.Field( + proto.BYTES, + number=3, + ) plaintext_crc32c = proto.Field( - proto.MESSAGE, number=7, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=7, + message=wrappers_pb2.Int64Value, ) additional_authenticated_data_crc32c = proto.Field( - proto.MESSAGE, number=8, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=8, + message=wrappers_pb2.Int64Value, ) @@ -854,14 +1053,27 @@ class DecryptRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - ciphertext = proto.Field(proto.BYTES, number=2,) - additional_authenticated_data = proto.Field(proto.BYTES, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + ciphertext = proto.Field( + proto.BYTES, + number=2, + ) + additional_authenticated_data = proto.Field( + proto.BYTES, + number=3, + ) ciphertext_crc32c = proto.Field( - proto.MESSAGE, number=5, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=5, + message=wrappers_pb2.Int64Value, ) additional_authenticated_data_crc32c = proto.Field( - proto.MESSAGE, number=6, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=6, + message=wrappers_pb2.Int64Value, ) @@ -931,13 +1143,29 @@ class AsymmetricSignRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - digest = proto.Field(proto.MESSAGE, number=3, message="Digest",) + name = proto.Field( + proto.STRING, + number=1, + ) + digest = proto.Field( + proto.MESSAGE, + number=3, + message="Digest", + ) digest_crc32c = proto.Field( - proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=4, + message=wrappers_pb2.Int64Value, + ) + data = proto.Field( + proto.BYTES, + number=6, + ) + data_crc32c = proto.Field( + proto.MESSAGE, + number=7, + message=wrappers_pb2.Int64Value, ) - data = proto.Field(proto.BYTES, number=6,) - data_crc32c = proto.Field(proto.MESSAGE, number=7, message=wrappers_pb2.Int64Value,) class AsymmetricDecryptRequest(proto.Message): @@ -976,10 +1204,18 @@ class AsymmetricDecryptRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - ciphertext = proto.Field(proto.BYTES, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + ciphertext = proto.Field( + proto.BYTES, + number=3, + ) ciphertext_crc32c = proto.Field( - proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=4, + message=wrappers_pb2.Int64Value, ) @@ -1019,9 +1255,19 @@ class MacSignRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - data = proto.Field(proto.BYTES, number=2,) - data_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,) + name = proto.Field( + proto.STRING, + number=1, + ) + data = proto.Field( + proto.BYTES, + number=2, + ) + data_crc32c = proto.Field( + proto.MESSAGE, + number=3, + message=wrappers_pb2.Int64Value, + ) class MacVerifyRequest(proto.Message): @@ -1082,11 +1328,28 @@ class MacVerifyRequest(proto.Message): languages that support this type. """ - name = proto.Field(proto.STRING, number=1,) - data = proto.Field(proto.BYTES, number=2,) - data_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,) - mac = proto.Field(proto.BYTES, number=4,) - mac_crc32c = proto.Field(proto.MESSAGE, number=5, message=wrappers_pb2.Int64Value,) + name = proto.Field( + proto.STRING, + number=1, + ) + data = proto.Field( + proto.BYTES, + number=2, + ) + data_crc32c = proto.Field( + proto.MESSAGE, + number=3, + message=wrappers_pb2.Int64Value, + ) + mac = proto.Field( + proto.BYTES, + number=4, + ) + mac_crc32c = proto.Field( + proto.MESSAGE, + number=5, + message=wrappers_pb2.Int64Value, + ) class GenerateRandomBytesRequest(proto.Message): @@ -1109,10 +1372,18 @@ class GenerateRandomBytesRequest(proto.Message): level is supported. """ - location = proto.Field(proto.STRING, number=1,) - length_bytes = proto.Field(proto.INT32, number=2,) + location = proto.Field( + proto.STRING, + number=1, + ) + length_bytes = proto.Field( + proto.INT32, + number=2, + ) protection_level = proto.Field( - proto.ENUM, number=3, enum=resources.ProtectionLevel, + proto.ENUM, + number=3, + enum=resources.ProtectionLevel, ) @@ -1182,15 +1453,31 @@ class EncryptResponse(proto.Message): used in encryption. """ - name = proto.Field(proto.STRING, number=1,) - ciphertext = proto.Field(proto.BYTES, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + ciphertext = proto.Field( + proto.BYTES, + number=2, + ) ciphertext_crc32c = proto.Field( - proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=4, + message=wrappers_pb2.Int64Value, + ) + verified_plaintext_crc32c = proto.Field( + proto.BOOL, + number=5, + ) + verified_additional_authenticated_data_crc32c = proto.Field( + proto.BOOL, + number=6, ) - verified_plaintext_crc32c = proto.Field(proto.BOOL, number=5,) - verified_additional_authenticated_data_crc32c = proto.Field(proto.BOOL, number=6,) protection_level = proto.Field( - proto.ENUM, number=7, enum=resources.ProtectionLevel, + proto.ENUM, + number=7, + enum=resources.ProtectionLevel, ) @@ -1234,13 +1521,23 @@ class DecryptResponse(proto.Message): used in decryption. """ - plaintext = proto.Field(proto.BYTES, number=1,) + plaintext = proto.Field( + proto.BYTES, + number=1, + ) plaintext_crc32c = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=2, + message=wrappers_pb2.Int64Value, + ) + used_primary = proto.Field( + proto.BOOL, + number=3, ) - used_primary = proto.Field(proto.BOOL, number=3,) protection_level = proto.Field( - proto.ENUM, number=4, enum=resources.ProtectionLevel, + proto.ENUM, + number=4, + enum=resources.ProtectionLevel, ) @@ -1310,15 +1607,31 @@ class AsymmetricSignResponse(proto.Message): used for signing. """ - signature = proto.Field(proto.BYTES, number=1,) + signature = proto.Field( + proto.BYTES, + number=1, + ) signature_crc32c = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=2, + message=wrappers_pb2.Int64Value, + ) + verified_digest_crc32c = proto.Field( + proto.BOOL, + number=3, + ) + name = proto.Field( + proto.STRING, + number=4, + ) + verified_data_crc32c = proto.Field( + proto.BOOL, + number=5, ) - verified_digest_crc32c = proto.Field(proto.BOOL, number=3,) - name = proto.Field(proto.STRING, number=4,) - verified_data_crc32c = proto.Field(proto.BOOL, number=5,) protection_level = proto.Field( - proto.ENUM, number=6, enum=resources.ProtectionLevel, + proto.ENUM, + number=6, + enum=resources.ProtectionLevel, ) @@ -1369,13 +1682,23 @@ class AsymmetricDecryptResponse(proto.Message): used in decryption. """ - plaintext = proto.Field(proto.BYTES, number=1,) + plaintext = proto.Field( + proto.BYTES, + number=1, + ) plaintext_crc32c = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, + proto.MESSAGE, + number=2, + message=wrappers_pb2.Int64Value, + ) + verified_ciphertext_crc32c = proto.Field( + proto.BOOL, + number=3, ) - verified_ciphertext_crc32c = proto.Field(proto.BOOL, number=3,) protection_level = proto.Field( - proto.ENUM, number=4, enum=resources.ProtectionLevel, + proto.ENUM, + number=4, + enum=resources.ProtectionLevel, ) @@ -1430,12 +1753,27 @@ class MacSignResponse(proto.Message): used for signing. """ - name = proto.Field(proto.STRING, number=1,) - mac = proto.Field(proto.BYTES, number=2,) - mac_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,) - verified_data_crc32c = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + mac = proto.Field( + proto.BYTES, + number=2, + ) + mac_crc32c = proto.Field( + proto.MESSAGE, + number=3, + message=wrappers_pb2.Int64Value, + ) + verified_data_crc32c = proto.Field( + proto.BOOL, + number=4, + ) protection_level = proto.Field( - proto.ENUM, number=5, enum=resources.ProtectionLevel, + proto.ENUM, + number=5, + enum=resources.ProtectionLevel, ) @@ -1499,13 +1837,30 @@ class MacVerifyResponse(proto.Message): used for verification. """ - name = proto.Field(proto.STRING, number=1,) - success = proto.Field(proto.BOOL, number=2,) - verified_data_crc32c = proto.Field(proto.BOOL, number=3,) - verified_mac_crc32c = proto.Field(proto.BOOL, number=4,) - verified_success_integrity = proto.Field(proto.BOOL, number=5,) + name = proto.Field( + proto.STRING, + number=1, + ) + success = proto.Field( + proto.BOOL, + number=2, + ) + verified_data_crc32c = proto.Field( + proto.BOOL, + number=3, + ) + verified_mac_crc32c = proto.Field( + proto.BOOL, + number=4, + ) + verified_success_integrity = proto.Field( + proto.BOOL, + number=5, + ) protection_level = proto.Field( - proto.ENUM, number=6, enum=resources.ProtectionLevel, + proto.ENUM, + number=6, + enum=resources.ProtectionLevel, ) @@ -1535,8 +1890,15 @@ class GenerateRandomBytesResponse(proto.Message): support this type. """ - data = proto.Field(proto.BYTES, number=1,) - data_crc32c = proto.Field(proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value,) + data = proto.Field( + proto.BYTES, + number=1, + ) + data_crc32c = proto.Field( + proto.MESSAGE, + number=3, + message=wrappers_pb2.Int64Value, + ) class Digest(proto.Message): @@ -1568,9 +1930,21 @@ class Digest(proto.Message): This field is a member of `oneof`_ ``digest``. """ - sha256 = proto.Field(proto.BYTES, number=1, oneof="digest",) - sha384 = proto.Field(proto.BYTES, number=2, oneof="digest",) - sha512 = proto.Field(proto.BYTES, number=3, oneof="digest",) + sha256 = proto.Field( + proto.BYTES, + number=1, + oneof="digest", + ) + sha384 = proto.Field( + proto.BYTES, + number=2, + oneof="digest", + ) + sha512 = proto.Field( + proto.BYTES, + number=3, + oneof="digest", + ) class LocationMetadata(proto.Message): @@ -1592,8 +1966,14 @@ class LocationMetadata(proto.Message): be created in this location. """ - hsm_available = proto.Field(proto.BOOL, number=1,) - ekm_available = proto.Field(proto.BOOL, number=2,) + hsm_available = proto.Field( + proto.BOOL, + number=1, + ) + ekm_available = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-kms/noxfile.py b/packages/google-cloud-kms/noxfile.py index 2a2001c49998..3addb4ed9431 100644 --- a/packages/google-cloud-kms/noxfile.py +++ b/packages/google-cloud-kms/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/packages/google-cloud-kms/samples/attestations/noxfile.py b/packages/google-cloud-kms/samples/attestations/noxfile.py index 4c808af73ea2..949e0fde9ae1 100644 --- a/packages/google-cloud-kms/samples/attestations/noxfile.py +++ b/packages/google-cloud-kms/samples/attestations/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/packages/google-cloud-kms/samples/snippets/noxfile.py b/packages/google-cloud-kms/samples/snippets/noxfile.py index 4c808af73ea2..949e0fde9ae1 100644 --- a/packages/google-cloud-kms/samples/snippets/noxfile.py +++ b/packages/google-cloud-kms/samples/snippets/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py index ec75fa15eb10..a2afb9974afd 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py @@ -86,7 +86,13 @@ def test__get_default_mtls_endpoint(): assert EkmServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [EkmServiceClient, EkmServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + EkmServiceClient, + EkmServiceAsyncClient, + ], +) def test_ekm_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -126,7 +132,13 @@ def test_ekm_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [EkmServiceClient, EkmServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + EkmServiceClient, + EkmServiceAsyncClient, + ], +) def test_ekm_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -481,7 +493,9 @@ def test_ekm_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -612,10 +626,17 @@ def test_ekm_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [ekm_service.ListEkmConnectionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.ListEkmConnectionsRequest, + dict, + ], +) def test_list_ekm_connections(request_type, transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -628,7 +649,8 @@ def test_list_ekm_connections(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = ekm_service.ListEkmConnectionsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) response = client.list_ekm_connections(request) @@ -647,7 +669,8 @@ def test_list_ekm_connections_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -665,7 +688,8 @@ async def test_list_ekm_connections_async( transport: str = "grpc_asyncio", request_type=ekm_service.ListEkmConnectionsRequest ): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -679,7 +703,8 @@ async def test_list_ekm_connections_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( ekm_service.ListEkmConnectionsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) ) response = await client.list_ekm_connections(request) @@ -701,7 +726,9 @@ async def test_list_ekm_connections_async_from_dict(): def test_list_ekm_connections_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -723,12 +750,17 @@ def test_list_ekm_connections_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_ekm_connections_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -752,11 +784,16 @@ async def test_list_ekm_connections_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_ekm_connections_flattened(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -766,7 +803,9 @@ def test_list_ekm_connections_flattened(): call.return_value = ekm_service.ListEkmConnectionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_ekm_connections(parent="parent_value",) + client.list_ekm_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -778,19 +817,24 @@ def test_list_ekm_connections_flattened(): def test_list_ekm_connections_flattened_error(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_ekm_connections( - ekm_service.ListEkmConnectionsRequest(), parent="parent_value", + ekm_service.ListEkmConnectionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_ekm_connections_flattened_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -804,7 +848,9 @@ async def test_list_ekm_connections_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_ekm_connections(parent="parent_value",) + response = await client.list_ekm_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -817,19 +863,23 @@ async def test_list_ekm_connections_flattened_async(): @pytest.mark.asyncio async def test_list_ekm_connections_flattened_error_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_ekm_connections( - ekm_service.ListEkmConnectionsRequest(), parent="parent_value", + ekm_service.ListEkmConnectionsRequest(), + parent="parent_value", ) def test_list_ekm_connections_pager(transport_name: str = "grpc"): client = EkmServiceClient( - 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. @@ -847,10 +897,14 @@ def test_list_ekm_connections_pager(transport_name: str = "grpc"): next_page_token="abc", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[], next_page_token="def", + ekm_connections=[], + next_page_token="def", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[ekm_service.EkmConnection(),], next_page_token="ghi", + ekm_connections=[ + ekm_service.EkmConnection(), + ], + next_page_token="ghi", ), ekm_service.ListEkmConnectionsResponse( ekm_connections=[ @@ -876,7 +930,8 @@ def test_list_ekm_connections_pager(transport_name: str = "grpc"): def test_list_ekm_connections_pages(transport_name: str = "grpc"): client = EkmServiceClient( - 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. @@ -894,10 +949,14 @@ def test_list_ekm_connections_pages(transport_name: str = "grpc"): next_page_token="abc", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[], next_page_token="def", + ekm_connections=[], + next_page_token="def", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[ekm_service.EkmConnection(),], next_page_token="ghi", + ekm_connections=[ + ekm_service.EkmConnection(), + ], + next_page_token="ghi", ), ekm_service.ListEkmConnectionsResponse( ekm_connections=[ @@ -914,7 +973,9 @@ def test_list_ekm_connections_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_ekm_connections_async_pager(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -933,10 +994,14 @@ async def test_list_ekm_connections_async_pager(): next_page_token="abc", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[], next_page_token="def", + ekm_connections=[], + next_page_token="def", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[ekm_service.EkmConnection(),], next_page_token="ghi", + ekm_connections=[ + ekm_service.EkmConnection(), + ], + next_page_token="ghi", ), ekm_service.ListEkmConnectionsResponse( ekm_connections=[ @@ -946,7 +1011,9 @@ async def test_list_ekm_connections_async_pager(): ), RuntimeError, ) - async_pager = await client.list_ekm_connections(request={},) + async_pager = await client.list_ekm_connections( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -958,7 +1025,9 @@ async def test_list_ekm_connections_async_pager(): @pytest.mark.asyncio async def test_list_ekm_connections_async_pages(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -977,10 +1046,14 @@ async def test_list_ekm_connections_async_pages(): next_page_token="abc", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[], next_page_token="def", + ekm_connections=[], + next_page_token="def", ), ekm_service.ListEkmConnectionsResponse( - ekm_connections=[ekm_service.EkmConnection(),], next_page_token="ghi", + ekm_connections=[ + ekm_service.EkmConnection(), + ], + next_page_token="ghi", ), ekm_service.ListEkmConnectionsResponse( ekm_connections=[ @@ -997,10 +1070,17 @@ async def test_list_ekm_connections_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [ekm_service.GetEkmConnectionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.GetEkmConnectionRequest, + dict, + ], +) def test_get_ekm_connection(request_type, transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1013,7 +1093,8 @@ def test_get_ekm_connection(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = ekm_service.EkmConnection( - name="name_value", etag="etag_value", + name="name_value", + etag="etag_value", ) response = client.get_ekm_connection(request) @@ -1032,7 +1113,8 @@ def test_get_ekm_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1050,7 +1132,8 @@ async def test_get_ekm_connection_async( transport: str = "grpc_asyncio", request_type=ekm_service.GetEkmConnectionRequest ): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1063,7 +1146,10 @@ async def test_get_ekm_connection_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - ekm_service.EkmConnection(name="name_value", etag="etag_value",) + ekm_service.EkmConnection( + name="name_value", + etag="etag_value", + ) ) response = await client.get_ekm_connection(request) @@ -1084,7 +1170,9 @@ async def test_get_ekm_connection_async_from_dict(): def test_get_ekm_connection_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -1106,12 +1194,17 @@ def test_get_ekm_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_ekm_connection_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -1135,11 +1228,16 @@ async def test_get_ekm_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_ekm_connection_flattened(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1149,7 +1247,9 @@ def test_get_ekm_connection_flattened(): call.return_value = ekm_service.EkmConnection() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_ekm_connection(name="name_value",) + client.get_ekm_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1161,19 +1261,24 @@ def test_get_ekm_connection_flattened(): def test_get_ekm_connection_flattened_error(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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_ekm_connection( - ekm_service.GetEkmConnectionRequest(), name="name_value", + ekm_service.GetEkmConnectionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_ekm_connection_flattened_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1187,7 +1292,9 @@ async def test_get_ekm_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_ekm_connection(name="name_value",) + response = await client.get_ekm_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1200,22 +1307,30 @@ async def test_get_ekm_connection_flattened_async(): @pytest.mark.asyncio async def test_get_ekm_connection_flattened_error_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_ekm_connection( - ekm_service.GetEkmConnectionRequest(), name="name_value", + ekm_service.GetEkmConnectionRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [ekm_service.CreateEkmConnectionRequest, dict,] + "request_type", + [ + ekm_service.CreateEkmConnectionRequest, + dict, + ], ) def test_create_ekm_connection(request_type, transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1228,7 +1343,8 @@ def test_create_ekm_connection(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = ekm_service.EkmConnection( - name="name_value", etag="etag_value", + name="name_value", + etag="etag_value", ) response = client.create_ekm_connection(request) @@ -1247,7 +1363,8 @@ def test_create_ekm_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1265,7 +1382,8 @@ async def test_create_ekm_connection_async( transport: str = "grpc_asyncio", request_type=ekm_service.CreateEkmConnectionRequest ): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1278,7 +1396,10 @@ async def test_create_ekm_connection_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - ekm_service.EkmConnection(name="name_value", etag="etag_value",) + ekm_service.EkmConnection( + name="name_value", + etag="etag_value", + ) ) response = await client.create_ekm_connection(request) @@ -1299,7 +1420,9 @@ async def test_create_ekm_connection_async_from_dict(): def test_create_ekm_connection_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -1321,12 +1444,17 @@ def test_create_ekm_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_ekm_connection_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -1350,11 +1478,16 @@ async def test_create_ekm_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_ekm_connection_flattened(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1386,7 +1519,9 @@ def test_create_ekm_connection_flattened(): def test_create_ekm_connection_flattened_error(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1401,7 +1536,9 @@ def test_create_ekm_connection_flattened_error(): @pytest.mark.asyncio async def test_create_ekm_connection_flattened_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,7 +1575,9 @@ async def test_create_ekm_connection_flattened_async(): @pytest.mark.asyncio async def test_create_ekm_connection_flattened_error_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1452,11 +1591,16 @@ async def test_create_ekm_connection_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [ekm_service.UpdateEkmConnectionRequest, dict,] + "request_type", + [ + ekm_service.UpdateEkmConnectionRequest, + dict, + ], ) def test_update_ekm_connection(request_type, transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1469,7 +1613,8 @@ def test_update_ekm_connection(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = ekm_service.EkmConnection( - name="name_value", etag="etag_value", + name="name_value", + etag="etag_value", ) response = client.update_ekm_connection(request) @@ -1488,7 +1633,8 @@ def test_update_ekm_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1506,7 +1652,8 @@ async def test_update_ekm_connection_async( transport: str = "grpc_asyncio", request_type=ekm_service.UpdateEkmConnectionRequest ): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1519,7 +1666,10 @@ async def test_update_ekm_connection_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - ekm_service.EkmConnection(name="name_value", etag="etag_value",) + ekm_service.EkmConnection( + name="name_value", + etag="etag_value", + ) ) response = await client.update_ekm_connection(request) @@ -1540,7 +1690,9 @@ async def test_update_ekm_connection_async_from_dict(): def test_update_ekm_connection_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -1570,7 +1722,9 @@ def test_update_ekm_connection_field_headers(): @pytest.mark.asyncio async def test_update_ekm_connection_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -1601,7 +1755,9 @@ async def test_update_ekm_connection_field_headers_async(): def test_update_ekm_connection_flattened(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1629,7 +1785,9 @@ def test_update_ekm_connection_flattened(): def test_update_ekm_connection_flattened_error(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1643,7 +1801,9 @@ def test_update_ekm_connection_flattened_error(): @pytest.mark.asyncio async def test_update_ekm_connection_flattened_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1676,7 +1836,9 @@ async def test_update_ekm_connection_flattened_async(): @pytest.mark.asyncio async def test_update_ekm_connection_flattened_error_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1695,7 +1857,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EkmServiceClient( - 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. @@ -1715,7 +1878,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = EkmServiceClient(client_options=options, transport=transport,) + client = EkmServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1731,7 +1897,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EkmServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1761,7 +1928,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EkmServiceGrpcTransport, transports.EkmServiceGrpcAsyncIOTransport,], + [ + transports.EkmServiceGrpcTransport, + transports.EkmServiceGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1773,8 +1943,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.EkmServiceGrpcTransport,) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.EkmServiceGrpcTransport, + ) def test_ekm_service_base_transport_error(): @@ -1825,7 +2000,8 @@ def test_ekm_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.EkmServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1866,7 +2042,10 @@ def test_ekm_service_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.EkmServiceGrpcTransport, transports.EkmServiceGrpcAsyncIOTransport,], + [ + transports.EkmServiceGrpcTransport, + transports.EkmServiceGrpcAsyncIOTransport, + ], ) def test_ekm_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1989,7 +2168,8 @@ def test_ekm_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.EkmServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2001,7 +2181,8 @@ def test_ekm_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.EkmServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2105,7 +2286,9 @@ def test_ekm_connection_path(): location = "clam" ekm_connection = "whelk" expected = "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}".format( - project=project, location=location, ekm_connection=ekm_connection, + project=project, + location=location, + ekm_connection=ekm_connection, ) actual = EkmServiceClient.ekm_connection_path(project, location, ekm_connection) assert expected == actual @@ -2130,7 +2313,10 @@ def test_service_path(): namespace = "winkle" service = "nautilus" expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) actual = EkmServiceClient.service_path(project, location, namespace, service) assert expected == actual @@ -2172,7 +2358,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 = EkmServiceClient.common_folder_path(folder) assert expected == actual @@ -2190,7 +2378,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 = EkmServiceClient.common_organization_path(organization) assert expected == actual @@ -2208,7 +2398,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 = EkmServiceClient.common_project_path(project) assert expected == actual @@ -2228,7 +2420,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 = EkmServiceClient.common_location_path(project, location) assert expected == actual @@ -2253,7 +2446,8 @@ def test_client_with_default_client_info(): transports.EkmServiceTransport, "_prep_wrapped_messages" ) as prep: client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2262,14 +2456,16 @@ def test_client_with_default_client_info(): ) as prep: transport_class = EkmServiceClient.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) def test_set_iam_policy(transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2279,7 +2475,10 @@ def test_set_iam_policy(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) @@ -2300,7 +2499,8 @@ def test_set_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2311,7 +2511,10 @@ async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -2331,7 +2534,9 @@ async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): def test_set_iam_policy_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -2351,12 +2556,17 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -2376,11 +2586,16 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2397,7 +2612,9 @@ def test_set_iam_policy_from_dict(): @pytest.mark.asyncio async def test_set_iam_policy_from_dict_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2414,7 +2631,8 @@ async def test_set_iam_policy_from_dict_async(): def test_get_iam_policy(transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2424,7 +2642,10 @@ def test_get_iam_policy(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) @@ -2445,7 +2666,8 @@ def test_get_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2456,7 +2678,10 @@ async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -2476,7 +2701,9 @@ async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): def test_get_iam_policy_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -2496,12 +2723,17 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -2521,11 +2753,16 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2542,7 +2779,9 @@ def test_get_iam_policy_from_dict(): @pytest.mark.asyncio async def test_get_iam_policy_from_dict_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -2559,7 +2798,8 @@ async def test_get_iam_policy_from_dict_async(): def test_test_iam_permissions(transport: str = "grpc"): client = EkmServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2592,7 +2832,8 @@ def test_test_iam_permissions(transport: str = "grpc"): @pytest.mark.asyncio async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2625,7 +2866,9 @@ async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): def test_test_iam_permissions_field_headers(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + 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. @@ -2647,12 +2890,17 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + 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. @@ -2676,11 +2924,16 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict(): - client = EkmServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.test_iam_permissions), "__call__" @@ -2699,7 +2952,9 @@ def test_test_iam_permissions_from_dict(): @pytest.mark.asyncio async def test_test_iam_permissions_from_dict_async(): - client = EkmServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EkmServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.test_iam_permissions), "__call__" @@ -2721,7 +2976,8 @@ async def test_test_iam_permissions_from_dict_async(): @pytest.mark.asyncio async def test_transport_close_async(): client = EkmServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py index 418dfccadec2..20dd2c47efd1 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py @@ -98,7 +98,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [KeyManagementServiceClient, KeyManagementServiceAsyncClient,] + "client_class", + [ + KeyManagementServiceClient, + KeyManagementServiceAsyncClient, + ], ) def test_key_management_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -140,7 +144,11 @@ def test_key_management_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [KeyManagementServiceClient, KeyManagementServiceAsyncClient,] + "client_class", + [ + KeyManagementServiceClient, + KeyManagementServiceAsyncClient, + ], ) def test_key_management_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -522,7 +530,9 @@ def test_key_management_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -665,10 +675,17 @@ def test_key_management_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.ListKeyRingsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListKeyRingsRequest, + dict, + ], +) def test_list_key_rings(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -679,7 +696,8 @@ def test_list_key_rings(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_key_rings), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.ListKeyRingsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) response = client.list_key_rings(request) @@ -698,7 +716,8 @@ def test_list_key_rings_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -714,7 +733,8 @@ async def test_list_key_rings_async( transport: str = "grpc_asyncio", request_type=service.ListKeyRingsRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -726,7 +746,8 @@ async def test_list_key_rings_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListKeyRingsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) ) response = await client.list_key_rings(request) @@ -770,7 +791,10 @@ def test_list_key_rings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -799,7 +823,10 @@ async def test_list_key_rings_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_key_rings_flattened(): @@ -813,7 +840,9 @@ def test_list_key_rings_flattened(): call.return_value = service.ListKeyRingsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_key_rings(parent="parent_value",) + client.list_key_rings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -833,7 +862,8 @@ def test_list_key_rings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_key_rings( - service.ListKeyRingsRequest(), parent="parent_value", + service.ListKeyRingsRequest(), + parent="parent_value", ) @@ -853,7 +883,9 @@ async def test_list_key_rings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_key_rings(parent="parent_value",) + response = await client.list_key_rings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -874,13 +906,15 @@ async def test_list_key_rings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_key_rings( - service.ListKeyRingsRequest(), parent="parent_value", + service.ListKeyRingsRequest(), + parent="parent_value", ) def test_list_key_rings_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -895,12 +929,21 @@ def test_list_key_rings_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListKeyRingsResponse(key_rings=[], next_page_token="def",), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(),], next_page_token="ghi", + key_rings=[], + next_page_token="def", ), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(), resources.KeyRing(),], + key_rings=[ + resources.KeyRing(), + ], + next_page_token="ghi", + ), + service.ListKeyRingsResponse( + key_rings=[ + resources.KeyRing(), + resources.KeyRing(), + ], ), RuntimeError, ) @@ -920,7 +963,8 @@ def test_list_key_rings_pager(transport_name: str = "grpc"): def test_list_key_rings_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -935,12 +979,21 @@ def test_list_key_rings_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListKeyRingsResponse(key_rings=[], next_page_token="def",), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(),], next_page_token="ghi", + key_rings=[], + next_page_token="def", ), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(), resources.KeyRing(),], + key_rings=[ + resources.KeyRing(), + ], + next_page_token="ghi", + ), + service.ListKeyRingsResponse( + key_rings=[ + resources.KeyRing(), + resources.KeyRing(), + ], ), RuntimeError, ) @@ -969,16 +1022,27 @@ async def test_list_key_rings_async_pager(): ], next_page_token="abc", ), - service.ListKeyRingsResponse(key_rings=[], next_page_token="def",), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(),], next_page_token="ghi", + key_rings=[], + next_page_token="def", + ), + service.ListKeyRingsResponse( + key_rings=[ + resources.KeyRing(), + ], + next_page_token="ghi", ), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(), resources.KeyRing(),], + key_rings=[ + resources.KeyRing(), + resources.KeyRing(), + ], ), RuntimeError, ) - async_pager = await client.list_key_rings(request={},) + async_pager = await client.list_key_rings( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1008,12 +1072,21 @@ async def test_list_key_rings_async_pages(): ], next_page_token="abc", ), - service.ListKeyRingsResponse(key_rings=[], next_page_token="def",), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(),], next_page_token="ghi", + key_rings=[], + next_page_token="def", + ), + service.ListKeyRingsResponse( + key_rings=[ + resources.KeyRing(), + ], + next_page_token="ghi", ), service.ListKeyRingsResponse( - key_rings=[resources.KeyRing(), resources.KeyRing(),], + key_rings=[ + resources.KeyRing(), + resources.KeyRing(), + ], ), RuntimeError, ) @@ -1024,10 +1097,17 @@ async def test_list_key_rings_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.ListCryptoKeysRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListCryptoKeysRequest, + dict, + ], +) def test_list_crypto_keys(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1038,7 +1118,8 @@ def test_list_crypto_keys(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_crypto_keys), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.ListCryptoKeysResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) response = client.list_crypto_keys(request) @@ -1057,7 +1138,8 @@ def test_list_crypto_keys_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1073,7 +1155,8 @@ async def test_list_crypto_keys_async( transport: str = "grpc_asyncio", request_type=service.ListCryptoKeysRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1085,7 +1168,8 @@ async def test_list_crypto_keys_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCryptoKeysResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) ) response = await client.list_crypto_keys(request) @@ -1129,7 +1213,10 @@ def test_list_crypto_keys_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 @@ -1158,7 +1245,10 @@ async def test_list_crypto_keys_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_crypto_keys_flattened(): @@ -1172,7 +1262,9 @@ def test_list_crypto_keys_flattened(): call.return_value = service.ListCryptoKeysResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_crypto_keys(parent="parent_value",) + client.list_crypto_keys( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1192,7 +1284,8 @@ def test_list_crypto_keys_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_crypto_keys( - service.ListCryptoKeysRequest(), parent="parent_value", + service.ListCryptoKeysRequest(), + parent="parent_value", ) @@ -1212,7 +1305,9 @@ async def test_list_crypto_keys_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_crypto_keys(parent="parent_value",) + response = await client.list_crypto_keys( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1233,13 +1328,15 @@ async def test_list_crypto_keys_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_crypto_keys( - service.ListCryptoKeysRequest(), parent="parent_value", + service.ListCryptoKeysRequest(), + parent="parent_value", ) def test_list_crypto_keys_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -1254,12 +1351,21 @@ def test_list_crypto_keys_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListCryptoKeysResponse(crypto_keys=[], next_page_token="def",), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(),], next_page_token="ghi", + crypto_keys=[], + next_page_token="def", ), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(), resources.CryptoKey(),], + crypto_keys=[ + resources.CryptoKey(), + ], + next_page_token="ghi", + ), + service.ListCryptoKeysResponse( + crypto_keys=[ + resources.CryptoKey(), + resources.CryptoKey(), + ], ), RuntimeError, ) @@ -1279,7 +1385,8 @@ def test_list_crypto_keys_pager(transport_name: str = "grpc"): def test_list_crypto_keys_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -1294,12 +1401,21 @@ def test_list_crypto_keys_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListCryptoKeysResponse(crypto_keys=[], next_page_token="def",), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(),], next_page_token="ghi", + crypto_keys=[], + next_page_token="def", + ), + service.ListCryptoKeysResponse( + crypto_keys=[ + resources.CryptoKey(), + ], + next_page_token="ghi", ), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(), resources.CryptoKey(),], + crypto_keys=[ + resources.CryptoKey(), + resources.CryptoKey(), + ], ), RuntimeError, ) @@ -1328,16 +1444,27 @@ async def test_list_crypto_keys_async_pager(): ], next_page_token="abc", ), - service.ListCryptoKeysResponse(crypto_keys=[], next_page_token="def",), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(),], next_page_token="ghi", + crypto_keys=[], + next_page_token="def", + ), + service.ListCryptoKeysResponse( + crypto_keys=[ + resources.CryptoKey(), + ], + next_page_token="ghi", ), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(), resources.CryptoKey(),], + crypto_keys=[ + resources.CryptoKey(), + resources.CryptoKey(), + ], ), RuntimeError, ) - async_pager = await client.list_crypto_keys(request={},) + async_pager = await client.list_crypto_keys( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1367,12 +1494,21 @@ async def test_list_crypto_keys_async_pages(): ], next_page_token="abc", ), - service.ListCryptoKeysResponse(crypto_keys=[], next_page_token="def",), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(),], next_page_token="ghi", + crypto_keys=[], + next_page_token="def", ), service.ListCryptoKeysResponse( - crypto_keys=[resources.CryptoKey(), resources.CryptoKey(),], + crypto_keys=[ + resources.CryptoKey(), + ], + next_page_token="ghi", + ), + service.ListCryptoKeysResponse( + crypto_keys=[ + resources.CryptoKey(), + resources.CryptoKey(), + ], ), RuntimeError, ) @@ -1383,10 +1519,17 @@ async def test_list_crypto_keys_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.ListCryptoKeyVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListCryptoKeyVersionsRequest, + dict, + ], +) def test_list_crypto_key_versions(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1399,7 +1542,8 @@ def test_list_crypto_key_versions(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCryptoKeyVersionsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) response = client.list_crypto_key_versions(request) @@ -1418,7 +1562,8 @@ def test_list_crypto_key_versions_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1436,7 +1581,8 @@ async def test_list_crypto_key_versions_async( transport: str = "grpc_asyncio", request_type=service.ListCryptoKeyVersionsRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1450,7 +1596,8 @@ async def test_list_crypto_key_versions_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCryptoKeyVersionsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) ) response = await client.list_crypto_key_versions(request) @@ -1496,7 +1643,10 @@ def test_list_crypto_key_versions_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 @@ -1527,7 +1677,10 @@ async def test_list_crypto_key_versions_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_crypto_key_versions_flattened(): @@ -1543,7 +1696,9 @@ def test_list_crypto_key_versions_flattened(): call.return_value = service.ListCryptoKeyVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_crypto_key_versions(parent="parent_value",) + client.list_crypto_key_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1563,7 +1718,8 @@ def test_list_crypto_key_versions_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_crypto_key_versions( - service.ListCryptoKeyVersionsRequest(), parent="parent_value", + service.ListCryptoKeyVersionsRequest(), + parent="parent_value", ) @@ -1585,7 +1741,9 @@ async def test_list_crypto_key_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_crypto_key_versions(parent="parent_value",) + response = await client.list_crypto_key_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1606,13 +1764,15 @@ async def test_list_crypto_key_versions_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_crypto_key_versions( - service.ListCryptoKeyVersionsRequest(), parent="parent_value", + service.ListCryptoKeyVersionsRequest(), + parent="parent_value", ) def test_list_crypto_key_versions_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -1630,10 +1790,13 @@ def test_list_crypto_key_versions_pager(transport_name: str = "grpc"): next_page_token="abc", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[], next_page_token="def", + crypto_key_versions=[], + next_page_token="def", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[resources.CryptoKeyVersion(),], + crypto_key_versions=[ + resources.CryptoKeyVersion(), + ], next_page_token="ghi", ), service.ListCryptoKeyVersionsResponse( @@ -1660,7 +1823,8 @@ def test_list_crypto_key_versions_pager(transport_name: str = "grpc"): def test_list_crypto_key_versions_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -1678,10 +1842,13 @@ def test_list_crypto_key_versions_pages(transport_name: str = "grpc"): next_page_token="abc", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[], next_page_token="def", + crypto_key_versions=[], + next_page_token="def", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[resources.CryptoKeyVersion(),], + crypto_key_versions=[ + resources.CryptoKeyVersion(), + ], next_page_token="ghi", ), service.ListCryptoKeyVersionsResponse( @@ -1720,10 +1887,13 @@ async def test_list_crypto_key_versions_async_pager(): next_page_token="abc", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[], next_page_token="def", + crypto_key_versions=[], + next_page_token="def", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[resources.CryptoKeyVersion(),], + crypto_key_versions=[ + resources.CryptoKeyVersion(), + ], next_page_token="ghi", ), service.ListCryptoKeyVersionsResponse( @@ -1734,7 +1904,9 @@ async def test_list_crypto_key_versions_async_pager(): ), RuntimeError, ) - async_pager = await client.list_crypto_key_versions(request={},) + async_pager = await client.list_crypto_key_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1767,10 +1939,13 @@ async def test_list_crypto_key_versions_async_pages(): next_page_token="abc", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[], next_page_token="def", + crypto_key_versions=[], + next_page_token="def", ), service.ListCryptoKeyVersionsResponse( - crypto_key_versions=[resources.CryptoKeyVersion(),], + crypto_key_versions=[ + resources.CryptoKeyVersion(), + ], next_page_token="ghi", ), service.ListCryptoKeyVersionsResponse( @@ -1788,10 +1963,17 @@ async def test_list_crypto_key_versions_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.ListImportJobsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListImportJobsRequest, + dict, + ], +) def test_list_import_jobs(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1802,7 +1984,8 @@ def test_list_import_jobs(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_import_jobs), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.ListImportJobsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) response = client.list_import_jobs(request) @@ -1821,7 +2004,8 @@ def test_list_import_jobs_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1837,7 +2021,8 @@ async def test_list_import_jobs_async( transport: str = "grpc_asyncio", request_type=service.ListImportJobsRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1849,7 +2034,8 @@ async def test_list_import_jobs_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListImportJobsResponse( - next_page_token="next_page_token_value", total_size=1086, + next_page_token="next_page_token_value", + total_size=1086, ) ) response = await client.list_import_jobs(request) @@ -1893,7 +2079,10 @@ def test_list_import_jobs_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 @@ -1922,7 +2111,10 @@ async def test_list_import_jobs_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_import_jobs_flattened(): @@ -1936,7 +2128,9 @@ def test_list_import_jobs_flattened(): call.return_value = service.ListImportJobsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_import_jobs(parent="parent_value",) + client.list_import_jobs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1956,7 +2150,8 @@ def test_list_import_jobs_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_import_jobs( - service.ListImportJobsRequest(), parent="parent_value", + service.ListImportJobsRequest(), + parent="parent_value", ) @@ -1976,7 +2171,9 @@ async def test_list_import_jobs_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_import_jobs(parent="parent_value",) + response = await client.list_import_jobs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1997,13 +2194,15 @@ async def test_list_import_jobs_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_import_jobs( - service.ListImportJobsRequest(), parent="parent_value", + service.ListImportJobsRequest(), + parent="parent_value", ) def test_list_import_jobs_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -2018,12 +2217,21 @@ def test_list_import_jobs_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListImportJobsResponse(import_jobs=[], next_page_token="def",), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(),], next_page_token="ghi", + import_jobs=[], + next_page_token="def", ), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(), resources.ImportJob(),], + import_jobs=[ + resources.ImportJob(), + ], + next_page_token="ghi", + ), + service.ListImportJobsResponse( + import_jobs=[ + resources.ImportJob(), + resources.ImportJob(), + ], ), RuntimeError, ) @@ -2043,7 +2251,8 @@ def test_list_import_jobs_pager(transport_name: str = "grpc"): def test_list_import_jobs_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - 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. @@ -2058,12 +2267,21 @@ def test_list_import_jobs_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListImportJobsResponse(import_jobs=[], next_page_token="def",), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(),], next_page_token="ghi", + import_jobs=[], + next_page_token="def", + ), + service.ListImportJobsResponse( + import_jobs=[ + resources.ImportJob(), + ], + next_page_token="ghi", ), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(), resources.ImportJob(),], + import_jobs=[ + resources.ImportJob(), + resources.ImportJob(), + ], ), RuntimeError, ) @@ -2092,16 +2310,27 @@ async def test_list_import_jobs_async_pager(): ], next_page_token="abc", ), - service.ListImportJobsResponse(import_jobs=[], next_page_token="def",), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(),], next_page_token="ghi", + import_jobs=[], + next_page_token="def", ), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(), resources.ImportJob(),], + import_jobs=[ + resources.ImportJob(), + ], + next_page_token="ghi", + ), + service.ListImportJobsResponse( + import_jobs=[ + resources.ImportJob(), + resources.ImportJob(), + ], ), RuntimeError, ) - async_pager = await client.list_import_jobs(request={},) + async_pager = await client.list_import_jobs( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2131,12 +2360,21 @@ async def test_list_import_jobs_async_pages(): ], next_page_token="abc", ), - service.ListImportJobsResponse(import_jobs=[], next_page_token="def",), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(),], next_page_token="ghi", + import_jobs=[], + next_page_token="def", ), service.ListImportJobsResponse( - import_jobs=[resources.ImportJob(), resources.ImportJob(),], + import_jobs=[ + resources.ImportJob(), + ], + next_page_token="ghi", + ), + service.ListImportJobsResponse( + import_jobs=[ + resources.ImportJob(), + resources.ImportJob(), + ], ), RuntimeError, ) @@ -2147,10 +2385,17 @@ async def test_list_import_jobs_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.GetKeyRingRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetKeyRingRequest, + dict, + ], +) def test_get_key_ring(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2160,7 +2405,9 @@ def test_get_key_ring(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_key_ring), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.KeyRing(name="name_value",) + call.return_value = resources.KeyRing( + name="name_value", + ) response = client.get_key_ring(request) # Establish that the underlying gRPC stub method was called. @@ -2177,7 +2424,8 @@ def test_get_key_ring_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2193,7 +2441,8 @@ async def test_get_key_ring_async( transport: str = "grpc_asyncio", request_type=service.GetKeyRingRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2204,7 +2453,9 @@ async def test_get_key_ring_async( with mock.patch.object(type(client.transport.get_key_ring), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.KeyRing(name="name_value",) + resources.KeyRing( + name="name_value", + ) ) response = await client.get_key_ring(request) @@ -2246,7 +2497,10 @@ def test_get_key_ring_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 @@ -2273,7 +2527,10 @@ async def test_get_key_ring_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_key_ring_flattened(): @@ -2287,7 +2544,9 @@ def test_get_key_ring_flattened(): call.return_value = resources.KeyRing() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_key_ring(name="name_value",) + client.get_key_ring( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2307,7 +2566,8 @@ def test_get_key_ring_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_key_ring( - service.GetKeyRingRequest(), name="name_value", + service.GetKeyRingRequest(), + name="name_value", ) @@ -2325,7 +2585,9 @@ async def test_get_key_ring_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.KeyRing()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_key_ring(name="name_value",) + response = await client.get_key_ring( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2346,14 +2608,22 @@ async def test_get_key_ring_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_key_ring( - service.GetKeyRingRequest(), name="name_value", + service.GetKeyRingRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.GetCryptoKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetCryptoKeyRequest, + dict, + ], +) def test_get_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2389,7 +2659,8 @@ def test_get_crypto_key_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2405,7 +2676,8 @@ async def test_get_crypto_key_async( transport: str = "grpc_asyncio", request_type=service.GetCryptoKeyRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2466,7 +2738,10 @@ def test_get_crypto_key_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 @@ -2493,7 +2768,10 @@ async def test_get_crypto_key_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_crypto_key_flattened(): @@ -2507,7 +2785,9 @@ def test_get_crypto_key_flattened(): call.return_value = resources.CryptoKey() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_crypto_key(name="name_value",) + client.get_crypto_key( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2527,7 +2807,8 @@ def test_get_crypto_key_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_crypto_key( - service.GetCryptoKeyRequest(), name="name_value", + service.GetCryptoKeyRequest(), + name="name_value", ) @@ -2545,7 +2826,9 @@ async def test_get_crypto_key_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CryptoKey()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_crypto_key(name="name_value",) + response = await client.get_crypto_key( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2566,14 +2849,22 @@ async def test_get_crypto_key_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_crypto_key( - service.GetCryptoKeyRequest(), name="name_value", + service.GetCryptoKeyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.GetCryptoKeyVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetCryptoKeyVersionRequest, + dict, + ], +) def test_get_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2622,7 +2913,8 @@ def test_get_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2640,7 +2932,8 @@ async def test_get_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.GetCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2717,7 +3010,10 @@ def test_get_crypto_key_version_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 @@ -2748,7 +3044,10 @@ async def test_get_crypto_key_version_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_crypto_key_version_flattened(): @@ -2764,7 +3063,9 @@ def test_get_crypto_key_version_flattened(): call.return_value = resources.CryptoKeyVersion() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_crypto_key_version(name="name_value",) + client.get_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2784,7 +3085,8 @@ def test_get_crypto_key_version_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_crypto_key_version( - service.GetCryptoKeyVersionRequest(), name="name_value", + service.GetCryptoKeyVersionRequest(), + name="name_value", ) @@ -2806,7 +3108,9 @@ async def test_get_crypto_key_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_crypto_key_version(name="name_value",) + response = await client.get_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2827,14 +3131,22 @@ async def test_get_crypto_key_version_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_crypto_key_version( - service.GetCryptoKeyVersionRequest(), name="name_value", + service.GetCryptoKeyVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.GetPublicKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetPublicKeyRequest, + dict, + ], +) def test_get_public_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2872,7 +3184,8 @@ def test_get_public_key_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2888,7 +3201,8 @@ async def test_get_public_key_async( transport: str = "grpc_asyncio", request_type=service.GetPublicKeyRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2952,7 +3266,10 @@ def test_get_public_key_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 @@ -2979,7 +3296,10 @@ async def test_get_public_key_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_public_key_flattened(): @@ -2993,7 +3313,9 @@ def test_get_public_key_flattened(): call.return_value = resources.PublicKey() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_public_key(name="name_value",) + client.get_public_key( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3013,7 +3335,8 @@ def test_get_public_key_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_public_key( - service.GetPublicKeyRequest(), name="name_value", + service.GetPublicKeyRequest(), + name="name_value", ) @@ -3031,7 +3354,9 @@ async def test_get_public_key_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.PublicKey()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_public_key(name="name_value",) + response = await client.get_public_key( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3052,14 +3377,22 @@ async def test_get_public_key_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_public_key( - service.GetPublicKeyRequest(), name="name_value", + service.GetPublicKeyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.GetImportJobRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetImportJobRequest, + dict, + ], +) def test_get_import_job(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3097,7 +3430,8 @@ def test_get_import_job_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3113,7 +3447,8 @@ async def test_get_import_job_async( transport: str = "grpc_asyncio", request_type=service.GetImportJobRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3177,7 +3512,10 @@ def test_get_import_job_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 @@ -3204,7 +3542,10 @@ async def test_get_import_job_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_import_job_flattened(): @@ -3218,7 +3559,9 @@ def test_get_import_job_flattened(): call.return_value = resources.ImportJob() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_import_job(name="name_value",) + client.get_import_job( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3238,7 +3581,8 @@ def test_get_import_job_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_import_job( - service.GetImportJobRequest(), name="name_value", + service.GetImportJobRequest(), + name="name_value", ) @@ -3256,7 +3600,9 @@ async def test_get_import_job_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.ImportJob()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_import_job(name="name_value",) + response = await client.get_import_job( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3277,14 +3623,22 @@ async def test_get_import_job_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_import_job( - service.GetImportJobRequest(), name="name_value", + service.GetImportJobRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.CreateKeyRingRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateKeyRingRequest, + dict, + ], +) def test_create_key_ring(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3294,7 +3648,9 @@ def test_create_key_ring(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_key_ring), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.KeyRing(name="name_value",) + call.return_value = resources.KeyRing( + name="name_value", + ) response = client.create_key_ring(request) # Establish that the underlying gRPC stub method was called. @@ -3311,7 +3667,8 @@ def test_create_key_ring_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3327,7 +3684,8 @@ async def test_create_key_ring_async( transport: str = "grpc_asyncio", request_type=service.CreateKeyRingRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3338,7 +3696,9 @@ async def test_create_key_ring_async( with mock.patch.object(type(client.transport.create_key_ring), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.KeyRing(name="name_value",) + resources.KeyRing( + name="name_value", + ) ) response = await client.create_key_ring(request) @@ -3380,7 +3740,10 @@ def test_create_key_ring_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 @@ -3407,7 +3770,10 @@ async def test_create_key_ring_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_key_ring_flattened(): @@ -3510,10 +3876,17 @@ async def test_create_key_ring_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.CreateCryptoKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCryptoKeyRequest, + dict, + ], +) def test_create_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3551,7 +3924,8 @@ def test_create_crypto_key_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3569,7 +3943,8 @@ async def test_create_crypto_key_async( transport: str = "grpc_asyncio", request_type=service.CreateCryptoKeyRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3634,7 +4009,10 @@ def test_create_crypto_key_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 @@ -3663,7 +4041,10 @@ async def test_create_crypto_key_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_crypto_key_flattened(): @@ -3770,10 +4151,17 @@ async def test_create_crypto_key_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.CreateCryptoKeyVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCryptoKeyVersionRequest, + dict, + ], +) def test_create_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3822,7 +4210,8 @@ def test_create_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3840,7 +4229,8 @@ async def test_create_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.CreateCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3917,7 +4307,10 @@ def test_create_crypto_key_version_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 @@ -3948,7 +4341,10 @@ async def test_create_crypto_key_version_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_crypto_key_version_flattened(): @@ -4047,10 +4443,17 @@ async def test_create_crypto_key_version_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.ImportCryptoKeyVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ImportCryptoKeyVersionRequest, + dict, + ], +) def test_import_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4099,7 +4502,8 @@ def test_import_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4117,7 +4521,8 @@ async def test_import_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.ImportCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4194,7 +4599,10 @@ def test_import_crypto_key_version_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 @@ -4225,13 +4633,23 @@ async def test_import_crypto_key_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [service.CreateImportJobRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateImportJobRequest, + dict, + ], +) def test_create_import_job(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4271,7 +4689,8 @@ def test_create_import_job_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4289,7 +4708,8 @@ async def test_create_import_job_async( transport: str = "grpc_asyncio", request_type=service.CreateImportJobRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4357,7 +4777,10 @@ def test_create_import_job_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 @@ -4386,7 +4809,10 @@ async def test_create_import_job_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_import_job_flattened(): @@ -4493,10 +4919,17 @@ async def test_create_import_job_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.UpdateCryptoKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCryptoKeyRequest, + dict, + ], +) def test_update_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4534,7 +4967,8 @@ def test_update_crypto_key_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4552,7 +4986,8 @@ async def test_update_crypto_key_async( transport: str = "grpc_asyncio", request_type=service.UpdateCryptoKeyRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4617,9 +5052,10 @@ def test_update_crypto_key_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "crypto_key.name=crypto_key.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "crypto_key.name=crypto_key.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4648,9 +5084,10 @@ async def test_update_crypto_key_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "crypto_key.name=crypto_key.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "crypto_key.name=crypto_key.name/value", + ) in kw["metadata"] def test_update_crypto_key_flattened(): @@ -4747,10 +5184,17 @@ async def test_update_crypto_key_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.UpdateCryptoKeyVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCryptoKeyVersionRequest, + dict, + ], +) def test_update_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4799,7 +5243,8 @@ def test_update_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4817,7 +5262,8 @@ async def test_update_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.UpdateCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5031,11 +5477,16 @@ async def test_update_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [service.UpdateCryptoKeyPrimaryVersionRequest, dict,] + "request_type", + [ + service.UpdateCryptoKeyPrimaryVersionRequest, + dict, + ], ) def test_update_crypto_key_primary_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5073,7 +5524,8 @@ def test_update_crypto_key_primary_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5092,7 +5544,8 @@ async def test_update_crypto_key_primary_version_async( request_type=service.UpdateCryptoKeyPrimaryVersionRequest, ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5157,7 +5610,10 @@ def test_update_crypto_key_primary_version_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 @@ -5186,7 +5642,10 @@ async def test_update_crypto_key_primary_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_update_crypto_key_primary_version_flattened(): @@ -5203,7 +5662,8 @@ def test_update_crypto_key_primary_version_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_crypto_key_primary_version( - name="name_value", crypto_key_version_id="crypto_key_version_id_value", + name="name_value", + crypto_key_version_id="crypto_key_version_id_value", ) # Establish that the underlying call was made with the expected @@ -5250,7 +5710,8 @@ async def test_update_crypto_key_primary_version_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.update_crypto_key_primary_version( - name="name_value", crypto_key_version_id="crypto_key_version_id_value", + name="name_value", + crypto_key_version_id="crypto_key_version_id_value", ) # Establish that the underlying call was made with the expected @@ -5282,11 +5743,16 @@ async def test_update_crypto_key_primary_version_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [service.DestroyCryptoKeyVersionRequest, dict,] + "request_type", + [ + service.DestroyCryptoKeyVersionRequest, + dict, + ], ) def test_destroy_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5335,7 +5801,8 @@ def test_destroy_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5353,7 +5820,8 @@ async def test_destroy_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.DestroyCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5430,7 +5898,10 @@ def test_destroy_crypto_key_version_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 @@ -5461,7 +5932,10 @@ async def test_destroy_crypto_key_version_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_destroy_crypto_key_version_flattened(): @@ -5477,7 +5951,9 @@ def test_destroy_crypto_key_version_flattened(): call.return_value = resources.CryptoKeyVersion() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.destroy_crypto_key_version(name="name_value",) + client.destroy_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5497,7 +5973,8 @@ def test_destroy_crypto_key_version_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.destroy_crypto_key_version( - service.DestroyCryptoKeyVersionRequest(), name="name_value", + service.DestroyCryptoKeyVersionRequest(), + name="name_value", ) @@ -5519,7 +5996,9 @@ async def test_destroy_crypto_key_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.destroy_crypto_key_version(name="name_value",) + response = await client.destroy_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5540,16 +6019,22 @@ async def test_destroy_crypto_key_version_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.destroy_crypto_key_version( - service.DestroyCryptoKeyVersionRequest(), name="name_value", + service.DestroyCryptoKeyVersionRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [service.RestoreCryptoKeyVersionRequest, dict,] + "request_type", + [ + service.RestoreCryptoKeyVersionRequest, + dict, + ], ) def test_restore_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5598,7 +6083,8 @@ def test_restore_crypto_key_version_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5616,7 +6102,8 @@ async def test_restore_crypto_key_version_async( transport: str = "grpc_asyncio", request_type=service.RestoreCryptoKeyVersionRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5693,7 +6180,10 @@ def test_restore_crypto_key_version_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 @@ -5724,7 +6214,10 @@ async def test_restore_crypto_key_version_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_restore_crypto_key_version_flattened(): @@ -5740,7 +6233,9 @@ def test_restore_crypto_key_version_flattened(): call.return_value = resources.CryptoKeyVersion() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.restore_crypto_key_version(name="name_value",) + client.restore_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5760,7 +6255,8 @@ def test_restore_crypto_key_version_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.restore_crypto_key_version( - service.RestoreCryptoKeyVersionRequest(), name="name_value", + service.RestoreCryptoKeyVersionRequest(), + name="name_value", ) @@ -5782,7 +6278,9 @@ async def test_restore_crypto_key_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.restore_crypto_key_version(name="name_value",) + response = await client.restore_crypto_key_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5803,14 +6301,22 @@ async def test_restore_crypto_key_version_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.restore_crypto_key_version( - service.RestoreCryptoKeyVersionRequest(), name="name_value", + service.RestoreCryptoKeyVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.EncryptRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.EncryptRequest, + dict, + ], +) def test_encrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5847,7 +6353,8 @@ def test_encrypt_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5863,7 +6370,8 @@ async def test_encrypt_async( transport: str = "grpc_asyncio", request_type=service.EncryptRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5926,7 +6434,10 @@ def test_encrypt_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 @@ -5955,7 +6466,10 @@ async def test_encrypt_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_encrypt_flattened(): @@ -5970,7 +6484,8 @@ def test_encrypt_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.encrypt( - name="name_value", plaintext=b"plaintext_blob", + name="name_value", + plaintext=b"plaintext_blob", ) # Establish that the underlying call was made with the expected @@ -5994,7 +6509,9 @@ def test_encrypt_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.encrypt( - service.EncryptRequest(), name="name_value", plaintext=b"plaintext_blob", + service.EncryptRequest(), + name="name_value", + plaintext=b"plaintext_blob", ) @@ -6014,7 +6531,10 @@ async def test_encrypt_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.encrypt(name="name_value", plaintext=b"plaintext_blob",) + response = await client.encrypt( + name="name_value", + plaintext=b"plaintext_blob", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6038,14 +6558,23 @@ async def test_encrypt_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.encrypt( - service.EncryptRequest(), name="name_value", plaintext=b"plaintext_blob", + service.EncryptRequest(), + name="name_value", + plaintext=b"plaintext_blob", ) -@pytest.mark.parametrize("request_type", [service.DecryptRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DecryptRequest, + dict, + ], +) def test_decrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6078,7 +6607,8 @@ def test_decrypt_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6094,7 +6624,8 @@ async def test_decrypt_async( transport: str = "grpc_asyncio", request_type=service.DecryptRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6153,7 +6684,10 @@ def test_decrypt_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 @@ -6182,7 +6716,10 @@ async def test_decrypt_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_decrypt_flattened(): @@ -6197,7 +6734,8 @@ def test_decrypt_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.decrypt( - name="name_value", ciphertext=b"ciphertext_blob", + name="name_value", + ciphertext=b"ciphertext_blob", ) # Establish that the underlying call was made with the expected @@ -6221,7 +6759,9 @@ def test_decrypt_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.decrypt( - service.DecryptRequest(), name="name_value", ciphertext=b"ciphertext_blob", + service.DecryptRequest(), + name="name_value", + ciphertext=b"ciphertext_blob", ) @@ -6242,7 +6782,8 @@ async def test_decrypt_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.decrypt( - name="name_value", ciphertext=b"ciphertext_blob", + name="name_value", + ciphertext=b"ciphertext_blob", ) # Establish that the underlying call was made with the expected @@ -6267,14 +6808,23 @@ async def test_decrypt_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.decrypt( - service.DecryptRequest(), name="name_value", ciphertext=b"ciphertext_blob", + service.DecryptRequest(), + name="name_value", + ciphertext=b"ciphertext_blob", ) -@pytest.mark.parametrize("request_type", [service.AsymmetricSignRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.AsymmetricSignRequest, + dict, + ], +) def test_asymmetric_sign(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6311,7 +6861,8 @@ def test_asymmetric_sign_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6327,7 +6878,8 @@ async def test_asymmetric_sign_async( transport: str = "grpc_asyncio", request_type=service.AsymmetricSignRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6390,7 +6942,10 @@ def test_asymmetric_sign_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 @@ -6419,7 +6974,10 @@ async def test_asymmetric_sign_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_asymmetric_sign_flattened(): @@ -6434,7 +6992,8 @@ def test_asymmetric_sign_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.asymmetric_sign( - name="name_value", digest=service.Digest(sha256=b"sha256_blob"), + name="name_value", + digest=service.Digest(sha256=b"sha256_blob"), ) # Establish that the underlying call was made with the expected @@ -6481,7 +7040,8 @@ async def test_asymmetric_sign_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.asymmetric_sign( - name="name_value", digest=service.Digest(sha256=b"sha256_blob"), + name="name_value", + digest=service.Digest(sha256=b"sha256_blob"), ) # Establish that the underlying call was made with the expected @@ -6512,10 +7072,17 @@ async def test_asymmetric_sign_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.AsymmetricDecryptRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.AsymmetricDecryptRequest, + dict, + ], +) def test_asymmetric_decrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6550,7 +7117,8 @@ def test_asymmetric_decrypt_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6568,7 +7136,8 @@ async def test_asymmetric_decrypt_async( transport: str = "grpc_asyncio", request_type=service.AsymmetricDecryptRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6631,7 +7200,10 @@ def test_asymmetric_decrypt_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 @@ -6662,7 +7234,10 @@ async def test_asymmetric_decrypt_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_asymmetric_decrypt_flattened(): @@ -6679,7 +7254,8 @@ def test_asymmetric_decrypt_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.asymmetric_decrypt( - name="name_value", ciphertext=b"ciphertext_blob", + name="name_value", + ciphertext=b"ciphertext_blob", ) # Establish that the underlying call was made with the expected @@ -6728,7 +7304,8 @@ async def test_asymmetric_decrypt_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.asymmetric_decrypt( - name="name_value", ciphertext=b"ciphertext_blob", + name="name_value", + ciphertext=b"ciphertext_blob", ) # Establish that the underlying call was made with the expected @@ -6759,10 +7336,17 @@ async def test_asymmetric_decrypt_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.MacSignRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.MacSignRequest, + dict, + ], +) def test_mac_sign(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6797,7 +7381,8 @@ def test_mac_sign_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6813,7 +7398,8 @@ async def test_mac_sign_async( transport: str = "grpc_asyncio", request_type=service.MacSignRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6874,7 +7460,10 @@ def test_mac_sign_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 @@ -6903,7 +7492,10 @@ async def test_mac_sign_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_mac_sign_flattened(): @@ -6918,7 +7510,8 @@ def test_mac_sign_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.mac_sign( - name="name_value", data=b"data_blob", + name="name_value", + data=b"data_blob", ) # Establish that the underlying call was made with the expected @@ -6942,7 +7535,9 @@ def test_mac_sign_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.mac_sign( - service.MacSignRequest(), name="name_value", data=b"data_blob", + service.MacSignRequest(), + name="name_value", + data=b"data_blob", ) @@ -6962,7 +7557,10 @@ async def test_mac_sign_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.mac_sign(name="name_value", data=b"data_blob",) + response = await client.mac_sign( + name="name_value", + data=b"data_blob", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6986,14 +7584,23 @@ async def test_mac_sign_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.mac_sign( - service.MacSignRequest(), name="name_value", data=b"data_blob", + service.MacSignRequest(), + name="name_value", + data=b"data_blob", ) -@pytest.mark.parametrize("request_type", [service.MacVerifyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.MacVerifyRequest, + dict, + ], +) def test_mac_verify(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7032,7 +7639,8 @@ def test_mac_verify_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7048,7 +7656,8 @@ async def test_mac_verify_async( transport: str = "grpc_asyncio", request_type=service.MacVerifyRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7113,7 +7722,10 @@ def test_mac_verify_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 @@ -7142,7 +7754,10 @@ async def test_mac_verify_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_mac_verify_flattened(): @@ -7157,7 +7772,9 @@ def test_mac_verify_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.mac_verify( - name="name_value", data=b"data_blob", mac=b"mac_blob", + name="name_value", + data=b"data_blob", + mac=b"mac_blob", ) # Establish that the underlying call was made with the expected @@ -7208,7 +7825,9 @@ async def test_mac_verify_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.mac_verify( - name="name_value", data=b"data_blob", mac=b"mac_blob", + name="name_value", + data=b"data_blob", + mac=b"mac_blob", ) # Establish that the underlying call was made with the expected @@ -7243,10 +7862,17 @@ async def test_mac_verify_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.GenerateRandomBytesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateRandomBytesRequest, + dict, + ], +) def test_generate_random_bytes(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7258,7 +7884,9 @@ def test_generate_random_bytes(request_type, transport: str = "grpc"): type(client.transport.generate_random_bytes), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = service.GenerateRandomBytesResponse(data=b"data_blob",) + call.return_value = service.GenerateRandomBytesResponse( + data=b"data_blob", + ) response = client.generate_random_bytes(request) # Establish that the underlying gRPC stub method was called. @@ -7275,7 +7903,8 @@ def test_generate_random_bytes_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 = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7293,7 +7922,8 @@ async def test_generate_random_bytes_async( transport: str = "grpc_asyncio", request_type=service.GenerateRandomBytesRequest ): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7306,7 +7936,9 @@ async def test_generate_random_bytes_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.GenerateRandomBytesResponse(data=b"data_blob",) + service.GenerateRandomBytesResponse( + data=b"data_blob", + ) ) response = await client.generate_random_bytes(request) @@ -7350,7 +7982,10 @@ def test_generate_random_bytes_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "location=location/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "location=location/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -7381,7 +8016,10 @@ async def test_generate_random_bytes_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "location=location/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "location=location/value", + ) in kw["metadata"] def test_generate_random_bytes_flattened(): @@ -7497,7 +8135,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = KeyManagementServiceClient( - 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. @@ -7518,7 +8157,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = KeyManagementServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -7535,7 +8175,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = KeyManagementServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -7583,7 +8224,10 @@ def test_transport_grpc_default(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.KeyManagementServiceGrpcTransport,) + assert isinstance( + client.transport, + transports.KeyManagementServiceGrpcTransport, + ) def test_key_management_service_base_transport_error(): @@ -7656,7 +8300,8 @@ def test_key_management_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.KeyManagementServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -7828,7 +8473,8 @@ def test_key_management_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.KeyManagementServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -7840,7 +8486,8 @@ def test_key_management_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.KeyManagementServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -7953,7 +8600,10 @@ def test_crypto_key_path(): key_ring = "whelk" crypto_key = "octopus" expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format( - project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, + project=project, + location=location, + key_ring=key_ring, + crypto_key=crypto_key, ) actual = KeyManagementServiceClient.crypto_key_path( project, location, key_ring, crypto_key @@ -8015,7 +8665,10 @@ def test_import_job_path(): key_ring = "winkle" import_job = "nautilus" expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}".format( - project=project, location=location, key_ring=key_ring, import_job=import_job, + project=project, + location=location, + key_ring=key_ring, + import_job=import_job, ) actual = KeyManagementServiceClient.import_job_path( project, location, key_ring, import_job @@ -8042,7 +8695,9 @@ def test_key_ring_path(): location = "octopus" key_ring = "oyster" expected = "projects/{project}/locations/{location}/keyRings/{key_ring}".format( - project=project, location=location, key_ring=key_ring, + project=project, + location=location, + key_ring=key_ring, ) actual = KeyManagementServiceClient.key_ring_path(project, location, key_ring) assert expected == actual @@ -8117,7 +8772,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 = KeyManagementServiceClient.common_folder_path(folder) assert expected == actual @@ -8135,7 +8792,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 = KeyManagementServiceClient.common_organization_path(organization) assert expected == actual @@ -8153,7 +8812,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 = KeyManagementServiceClient.common_project_path(project) assert expected == actual @@ -8173,7 +8834,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 = KeyManagementServiceClient.common_location_path(project, location) assert expected == actual @@ -8198,7 +8860,8 @@ def test_client_with_default_client_info(): transports.KeyManagementServiceTransport, "_prep_wrapped_messages" ) as prep: client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8207,14 +8870,16 @@ def test_client_with_default_client_info(): ) as prep: transport_class = KeyManagementServiceClient.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) def test_set_iam_policy(transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8224,7 +8889,10 @@ def test_set_iam_policy(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) @@ -8245,7 +8913,8 @@ def test_set_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8256,7 +8925,10 @@ async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -8298,7 +8970,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -8325,7 +9000,10 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict(): @@ -8367,7 +9045,8 @@ async def test_set_iam_policy_from_dict_async(): def test_get_iam_policy(transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8377,7 +9056,10 @@ def test_get_iam_policy(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) @@ -8398,7 +9080,8 @@ def test_get_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8409,7 +9092,10 @@ async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -8451,7 +9137,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -8478,7 +9167,10 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict(): @@ -8520,7 +9212,8 @@ async def test_get_iam_policy_from_dict_async(): def test_test_iam_permissions(transport: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8553,7 +9246,8 @@ def test_test_iam_permissions(transport: str = "grpc"): @pytest.mark.asyncio async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8610,7 +9304,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -8641,7 +9338,10 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict(): @@ -8690,7 +9390,8 @@ async def test_test_iam_permissions_from_dict_async(): @pytest.mark.asyncio async def test_transport_close_async(): client = KeyManagementServiceAsyncClient( - 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"