diff --git a/docs/privateca_v1/certificate_authority_service.rst b/docs/privateca_v1/certificate_authority_service.rst index 5cf7339..00601bc 100644 --- a/docs/privateca_v1/certificate_authority_service.rst +++ b/docs/privateca_v1/certificate_authority_service.rst @@ -5,7 +5,6 @@ CertificateAuthorityService :members: :inherited-members: - .. automodule:: google.cloud.security.privateca_v1.services.certificate_authority_service.pagers :members: :inherited-members: diff --git a/docs/privateca_v1beta1/certificate_authority_service.rst b/docs/privateca_v1beta1/certificate_authority_service.rst index e6f3134..536a4c8 100644 --- a/docs/privateca_v1beta1/certificate_authority_service.rst +++ b/docs/privateca_v1beta1/certificate_authority_service.rst @@ -5,7 +5,6 @@ CertificateAuthorityService :members: :inherited-members: - .. automodule:: google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers :members: :inherited-members: diff --git a/google/cloud/security/privateca/__init__.py b/google/cloud/security/privateca/__init__.py index bce2507..480932c 100644 --- a/google/cloud/security/privateca/__init__.py +++ b/google/cloud/security/privateca/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,152 +14,175 @@ # limitations under the License. # -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.async_client import ( - CertificateAuthorityServiceAsyncClient, -) -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.client import ( +from google.cloud.security.privateca_v1.services.certificate_authority_service.client import ( CertificateAuthorityServiceClient, ) -from google.cloud.security.privateca_v1beta1.types.resources import Certificate -from google.cloud.security.privateca_v1beta1.types.resources import CertificateAuthority -from google.cloud.security.privateca_v1beta1.types.resources import CertificateConfig -from google.cloud.security.privateca_v1beta1.types.resources import ( - CertificateDescription, -) -from google.cloud.security.privateca_v1beta1.types.resources import ( - CertificateRevocationList, -) -from google.cloud.security.privateca_v1beta1.types.resources import KeyUsage -from google.cloud.security.privateca_v1beta1.types.resources import ObjectId -from google.cloud.security.privateca_v1beta1.types.resources import PublicKey -from google.cloud.security.privateca_v1beta1.types.resources import ReusableConfig -from google.cloud.security.privateca_v1beta1.types.resources import ReusableConfigValues -from google.cloud.security.privateca_v1beta1.types.resources import ( - ReusableConfigWrapper, -) -from google.cloud.security.privateca_v1beta1.types.resources import RevocationReason -from google.cloud.security.privateca_v1beta1.types.resources import Subject -from google.cloud.security.privateca_v1beta1.types.resources import SubjectAltNames -from google.cloud.security.privateca_v1beta1.types.resources import SubordinateConfig -from google.cloud.security.privateca_v1beta1.types.resources import X509Extension -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.services.certificate_authority_service.async_client import ( + CertificateAuthorityServiceAsyncClient, +) + +from google.cloud.security.privateca_v1.types.resources import CaPool +from google.cloud.security.privateca_v1.types.resources import Certificate +from google.cloud.security.privateca_v1.types.resources import CertificateAuthority +from google.cloud.security.privateca_v1.types.resources import CertificateConfig +from google.cloud.security.privateca_v1.types.resources import CertificateDescription +from google.cloud.security.privateca_v1.types.resources import ( + CertificateExtensionConstraints, +) +from google.cloud.security.privateca_v1.types.resources import ( + CertificateIdentityConstraints, +) +from google.cloud.security.privateca_v1.types.resources import CertificateRevocationList +from google.cloud.security.privateca_v1.types.resources import CertificateTemplate +from google.cloud.security.privateca_v1.types.resources import KeyUsage +from google.cloud.security.privateca_v1.types.resources import ObjectId +from google.cloud.security.privateca_v1.types.resources import PublicKey +from google.cloud.security.privateca_v1.types.resources import Subject +from google.cloud.security.privateca_v1.types.resources import SubjectAltNames +from google.cloud.security.privateca_v1.types.resources import SubordinateConfig +from google.cloud.security.privateca_v1.types.resources import X509Extension +from google.cloud.security.privateca_v1.types.resources import X509Parameters +from google.cloud.security.privateca_v1.types.resources import RevocationReason +from google.cloud.security.privateca_v1.types.resources import SubjectRequestMode +from google.cloud.security.privateca_v1.types.service import ( ActivateCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import CreateCaPoolRequest +from google.cloud.security.privateca_v1.types.service import ( CreateCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - CreateCertificateRequest, +from google.cloud.security.privateca_v1.types.service import CreateCertificateRequest +from google.cloud.security.privateca_v1.types.service import ( + CreateCertificateTemplateRequest, +) +from google.cloud.security.privateca_v1.types.service import DeleteCaPoolRequest +from google.cloud.security.privateca_v1.types.service import ( + DeleteCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( + DeleteCertificateTemplateRequest, +) +from google.cloud.security.privateca_v1.types.service import ( DisableCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( EnableCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import FetchCaCertsRequest +from google.cloud.security.privateca_v1.types.service import FetchCaCertsResponse +from google.cloud.security.privateca_v1.types.service import ( FetchCertificateAuthorityCsrRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( FetchCertificateAuthorityCsrResponse, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import GetCaPoolRequest +from google.cloud.security.privateca_v1.types.service import ( GetCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import GetCertificateRequest -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import GetCertificateRequest +from google.cloud.security.privateca_v1.types.service import ( GetCertificateRevocationListRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - GetReusableConfigRequest, +from google.cloud.security.privateca_v1.types.service import ( + GetCertificateTemplateRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ListCaPoolsRequest +from google.cloud.security.privateca_v1.types.service import ListCaPoolsResponse +from google.cloud.security.privateca_v1.types.service import ( ListCertificateAuthoritiesRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( ListCertificateAuthoritiesResponse, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( ListCertificateRevocationListsRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import ( ListCertificateRevocationListsResponse, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - ListCertificatesRequest, -) -from google.cloud.security.privateca_v1beta1.types.service import ( - ListCertificatesResponse, +from google.cloud.security.privateca_v1.types.service import ListCertificatesRequest +from google.cloud.security.privateca_v1.types.service import ListCertificatesResponse +from google.cloud.security.privateca_v1.types.service import ( + ListCertificateTemplatesRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - ListReusableConfigsRequest, +from google.cloud.security.privateca_v1.types.service import ( + ListCertificateTemplatesResponse, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - ListReusableConfigsResponse, +from google.cloud.security.privateca_v1.types.service import OperationMetadata +from google.cloud.security.privateca_v1.types.service import RevokeCertificateRequest +from google.cloud.security.privateca_v1.types.service import ( + UndeleteCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import OperationMetadata -from google.cloud.security.privateca_v1beta1.types.service import ( - RestoreCertificateAuthorityRequest, -) -from google.cloud.security.privateca_v1beta1.types.service import ( - RevokeCertificateRequest, -) -from google.cloud.security.privateca_v1beta1.types.service import ( - ScheduleDeleteCertificateAuthorityRequest, -) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import UpdateCaPoolRequest +from google.cloud.security.privateca_v1.types.service import ( UpdateCertificateAuthorityRequest, ) -from google.cloud.security.privateca_v1beta1.types.service import ( - UpdateCertificateRequest, -) -from google.cloud.security.privateca_v1beta1.types.service import ( +from google.cloud.security.privateca_v1.types.service import UpdateCertificateRequest +from google.cloud.security.privateca_v1.types.service import ( UpdateCertificateRevocationListRequest, ) +from google.cloud.security.privateca_v1.types.service import ( + UpdateCertificateTemplateRequest, +) __all__ = ( - "ActivateCertificateAuthorityRequest", + "CertificateAuthorityServiceClient", + "CertificateAuthorityServiceAsyncClient", + "CaPool", "Certificate", "CertificateAuthority", - "CertificateAuthorityServiceAsyncClient", - "CertificateAuthorityServiceClient", "CertificateConfig", "CertificateDescription", + "CertificateExtensionConstraints", + "CertificateIdentityConstraints", "CertificateRevocationList", + "CertificateTemplate", + "KeyUsage", + "ObjectId", + "PublicKey", + "Subject", + "SubjectAltNames", + "SubordinateConfig", + "X509Extension", + "X509Parameters", + "RevocationReason", + "SubjectRequestMode", + "ActivateCertificateAuthorityRequest", + "CreateCaPoolRequest", "CreateCertificateAuthorityRequest", "CreateCertificateRequest", + "CreateCertificateTemplateRequest", + "DeleteCaPoolRequest", + "DeleteCertificateAuthorityRequest", + "DeleteCertificateTemplateRequest", "DisableCertificateAuthorityRequest", "EnableCertificateAuthorityRequest", + "FetchCaCertsRequest", + "FetchCaCertsResponse", "FetchCertificateAuthorityCsrRequest", "FetchCertificateAuthorityCsrResponse", + "GetCaPoolRequest", "GetCertificateAuthorityRequest", "GetCertificateRequest", "GetCertificateRevocationListRequest", - "GetReusableConfigRequest", - "KeyUsage", + "GetCertificateTemplateRequest", + "ListCaPoolsRequest", + "ListCaPoolsResponse", "ListCertificateAuthoritiesRequest", "ListCertificateAuthoritiesResponse", "ListCertificateRevocationListsRequest", "ListCertificateRevocationListsResponse", "ListCertificatesRequest", "ListCertificatesResponse", - "ListReusableConfigsRequest", - "ListReusableConfigsResponse", - "ObjectId", + "ListCertificateTemplatesRequest", + "ListCertificateTemplatesResponse", "OperationMetadata", - "PublicKey", - "RestoreCertificateAuthorityRequest", - "ReusableConfig", - "ReusableConfigValues", - "ReusableConfigWrapper", - "RevocationReason", "RevokeCertificateRequest", - "ScheduleDeleteCertificateAuthorityRequest", - "Subject", - "SubjectAltNames", - "SubordinateConfig", + "UndeleteCertificateAuthorityRequest", + "UpdateCaPoolRequest", "UpdateCertificateAuthorityRequest", "UpdateCertificateRequest", "UpdateCertificateRevocationListRequest", - "X509Extension", + "UpdateCertificateTemplateRequest", ) diff --git a/google/cloud/security/privateca_v1/__init__.py b/google/cloud/security/privateca_v1/__init__.py index 9d54ac9..4137916 100644 --- a/google/cloud/security/privateca_v1/__init__.py +++ b/google/cloud/security/privateca_v1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +15,10 @@ # from .services.certificate_authority_service import CertificateAuthorityServiceClient +from .services.certificate_authority_service import ( + CertificateAuthorityServiceAsyncClient, +) + from .types.resources import CaPool from .types.resources import Certificate from .types.resources import CertificateAuthority @@ -28,13 +31,13 @@ from .types.resources import KeyUsage from .types.resources import ObjectId from .types.resources import PublicKey -from .types.resources import RevocationReason from .types.resources import Subject from .types.resources import SubjectAltNames -from .types.resources import SubjectRequestMode from .types.resources import SubordinateConfig from .types.resources import X509Extension from .types.resources import X509Parameters +from .types.resources import RevocationReason +from .types.resources import SubjectRequestMode from .types.service import ActivateCertificateAuthorityRequest from .types.service import CreateCaPoolRequest from .types.service import CreateCertificateAuthorityRequest @@ -60,10 +63,10 @@ from .types.service import ListCertificateAuthoritiesResponse from .types.service import ListCertificateRevocationListsRequest from .types.service import ListCertificateRevocationListsResponse -from .types.service import ListCertificateTemplatesRequest -from .types.service import ListCertificateTemplatesResponse from .types.service import ListCertificatesRequest from .types.service import ListCertificatesResponse +from .types.service import ListCertificateTemplatesRequest +from .types.service import ListCertificateTemplatesResponse from .types.service import OperationMetadata from .types.service import RevokeCertificateRequest from .types.service import UndeleteCertificateAuthorityRequest @@ -73,12 +76,13 @@ from .types.service import UpdateCertificateRevocationListRequest from .types.service import UpdateCertificateTemplateRequest - __all__ = ( + "CertificateAuthorityServiceAsyncClient", "ActivateCertificateAuthorityRequest", "CaPool", "Certificate", "CertificateAuthority", + "CertificateAuthorityServiceClient", "CertificateConfig", "CertificateDescription", "CertificateExtensionConstraints", @@ -131,5 +135,4 @@ "UpdateCertificateTemplateRequest", "X509Extension", "X509Parameters", - "CertificateAuthorityServiceClient", ) diff --git a/google/cloud/security/privateca_v1/gapic_metadata.json b/google/cloud/security/privateca_v1/gapic_metadata.json new file mode 100644 index 0000000..9eb6757 --- /dev/null +++ b/google/cloud/security/privateca_v1/gapic_metadata.json @@ -0,0 +1,313 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.security.privateca_v1", + "protoPackage": "google.cloud.security.privateca.v1", + "schema": "1.0", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ + "activate_certificate_authority" + ] + }, + "CreateCaPool": { + "methods": [ + "create_ca_pool" + ] + }, + "CreateCertificate": { + "methods": [ + "create_certificate" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "create_certificate_authority" + ] + }, + "CreateCertificateTemplate": { + "methods": [ + "create_certificate_template" + ] + }, + "DeleteCaPool": { + "methods": [ + "delete_ca_pool" + ] + }, + "DeleteCertificateAuthority": { + "methods": [ + "delete_certificate_authority" + ] + }, + "DeleteCertificateTemplate": { + "methods": [ + "delete_certificate_template" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disable_certificate_authority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enable_certificate_authority" + ] + }, + "FetchCaCerts": { + "methods": [ + "fetch_ca_certs" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetch_certificate_authority_csr" + ] + }, + "GetCaPool": { + "methods": [ + "get_ca_pool" + ] + }, + "GetCertificate": { + "methods": [ + "get_certificate" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "get_certificate_authority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "get_certificate_revocation_list" + ] + }, + "GetCertificateTemplate": { + "methods": [ + "get_certificate_template" + ] + }, + "ListCaPools": { + "methods": [ + "list_ca_pools" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "list_certificate_authorities" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "list_certificate_revocation_lists" + ] + }, + "ListCertificateTemplates": { + "methods": [ + "list_certificate_templates" + ] + }, + "ListCertificates": { + "methods": [ + "list_certificates" + ] + }, + "RevokeCertificate": { + "methods": [ + "revoke_certificate" + ] + }, + "UndeleteCertificateAuthority": { + "methods": [ + "undelete_certificate_authority" + ] + }, + "UpdateCaPool": { + "methods": [ + "update_ca_pool" + ] + }, + "UpdateCertificate": { + "methods": [ + "update_certificate" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "update_certificate_authority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "update_certificate_revocation_list" + ] + }, + "UpdateCertificateTemplate": { + "methods": [ + "update_certificate_template" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CertificateAuthorityServiceAsyncClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ + "activate_certificate_authority" + ] + }, + "CreateCaPool": { + "methods": [ + "create_ca_pool" + ] + }, + "CreateCertificate": { + "methods": [ + "create_certificate" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "create_certificate_authority" + ] + }, + "CreateCertificateTemplate": { + "methods": [ + "create_certificate_template" + ] + }, + "DeleteCaPool": { + "methods": [ + "delete_ca_pool" + ] + }, + "DeleteCertificateAuthority": { + "methods": [ + "delete_certificate_authority" + ] + }, + "DeleteCertificateTemplate": { + "methods": [ + "delete_certificate_template" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disable_certificate_authority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enable_certificate_authority" + ] + }, + "FetchCaCerts": { + "methods": [ + "fetch_ca_certs" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetch_certificate_authority_csr" + ] + }, + "GetCaPool": { + "methods": [ + "get_ca_pool" + ] + }, + "GetCertificate": { + "methods": [ + "get_certificate" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "get_certificate_authority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "get_certificate_revocation_list" + ] + }, + "GetCertificateTemplate": { + "methods": [ + "get_certificate_template" + ] + }, + "ListCaPools": { + "methods": [ + "list_ca_pools" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "list_certificate_authorities" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "list_certificate_revocation_lists" + ] + }, + "ListCertificateTemplates": { + "methods": [ + "list_certificate_templates" + ] + }, + "ListCertificates": { + "methods": [ + "list_certificates" + ] + }, + "RevokeCertificate": { + "methods": [ + "revoke_certificate" + ] + }, + "UndeleteCertificateAuthority": { + "methods": [ + "undelete_certificate_authority" + ] + }, + "UpdateCaPool": { + "methods": [ + "update_ca_pool" + ] + }, + "UpdateCertificate": { + "methods": [ + "update_certificate" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "update_certificate_authority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "update_certificate_revocation_list" + ] + }, + "UpdateCertificateTemplate": { + "methods": [ + "update_certificate_template" + ] + } + } + } + } + } + } +} diff --git a/google/cloud/security/privateca_v1/services/__init__.py b/google/cloud/security/privateca_v1/services/__init__.py index 42ffdf2..4de6597 100644 --- a/google/cloud/security/privateca_v1/services/__init__.py +++ b/google/cloud/security/privateca_v1/services/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py index d837719..f519622 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import CertificateAuthorityServiceClient from .async_client import CertificateAuthorityServiceAsyncClient diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py index 0f76a45..792a60b 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation # type: ignore @@ -35,11 +33,10 @@ ) from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport from .client import CertificateAuthorityServiceClient @@ -82,35 +79,30 @@ class CertificateAuthorityServiceAsyncClient: parse_certificate_template_path = staticmethod( CertificateAuthorityServiceClient.parse_certificate_template_path ) - common_billing_account_path = staticmethod( CertificateAuthorityServiceClient.common_billing_account_path ) parse_common_billing_account_path = staticmethod( CertificateAuthorityServiceClient.parse_common_billing_account_path ) - common_folder_path = staticmethod( CertificateAuthorityServiceClient.common_folder_path ) parse_common_folder_path = staticmethod( CertificateAuthorityServiceClient.parse_common_folder_path ) - common_organization_path = staticmethod( CertificateAuthorityServiceClient.common_organization_path ) parse_common_organization_path = staticmethod( CertificateAuthorityServiceClient.parse_common_organization_path ) - common_project_path = staticmethod( CertificateAuthorityServiceClient.common_project_path ) parse_common_project_path = staticmethod( CertificateAuthorityServiceClient.parse_common_project_path ) - common_location_path = staticmethod( CertificateAuthorityServiceClient.common_location_path ) @@ -120,7 +112,8 @@ class CertificateAuthorityServiceAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -135,7 +128,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -152,7 +145,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> CertificateAuthorityServiceTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: CertificateAuthorityServiceTransport: The transport used by the client instance. @@ -167,12 +160,12 @@ def transport(self) -> CertificateAuthorityServiceTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the certificate authority service client. + """Instantiates the certificate authority service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -204,7 +197,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = CertificateAuthorityServiceClient( credentials=credentials, transport=transport, @@ -261,7 +253,6 @@ async def create_certificate( This corresponds to the ``certificate_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -288,7 +279,6 @@ async def create_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate is not None: @@ -342,7 +332,6 @@ async def get_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -369,7 +358,6 @@ async def get_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -418,7 +406,6 @@ async def list_certificates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -448,7 +435,6 @@ async def list_certificates( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -503,7 +489,6 @@ async def revoke_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -530,7 +515,6 @@ async def revoke_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -559,7 +543,7 @@ async def update_certificate( request: service.UpdateCertificateRequest = None, *, certificate: resources.Certificate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -589,7 +573,6 @@ async def update_certificate( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -616,7 +599,6 @@ async def update_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate is not None: request.certificate = certificate if update_mask is not None: @@ -677,7 +659,6 @@ async def activate_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -709,7 +690,6 @@ async def activate_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -785,7 +765,6 @@ async def create_certificate_authority( This corresponds to the ``certificate_authority_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -819,7 +798,6 @@ async def create_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_authority is not None: @@ -880,7 +858,6 @@ async def disable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -912,7 +889,6 @@ async def disable_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -969,7 +945,6 @@ async def enable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1001,7 +976,6 @@ async def enable_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1067,7 +1041,6 @@ async def fetch_certificate_authority_csr( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1094,7 +1067,6 @@ async def fetch_certificate_authority_csr( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1144,7 +1116,6 @@ async def get_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1174,7 +1145,6 @@ async def get_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1224,7 +1194,6 @@ async def list_certificate_authorities( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1254,7 +1223,6 @@ async def list_certificate_authorities( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1310,7 +1278,6 @@ async def undelete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1342,7 +1309,6 @@ async def undelete_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1399,7 +1365,6 @@ async def delete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1431,7 +1396,6 @@ async def delete_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1468,7 +1432,7 @@ async def update_certificate_authority( request: service.UpdateCertificateAuthorityRequest = None, *, certificate_authority: resources.CertificateAuthority = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1495,7 +1459,6 @@ async def update_certificate_authority( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1527,7 +1490,6 @@ async def update_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_authority is not None: request.certificate_authority = certificate_authority if update_mask is not None: @@ -1604,7 +1566,6 @@ async def create_ca_pool( This corresponds to the ``ca_pool_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1640,7 +1601,6 @@ async def create_ca_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if ca_pool is not None: @@ -1681,7 +1641,7 @@ async def update_ca_pool( request: service.UpdateCaPoolRequest = None, *, ca_pool: resources.CaPool = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1707,7 +1667,6 @@ async def update_ca_pool( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1743,7 +1702,6 @@ async def update_ca_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if ca_pool is not None: request.ca_pool = ca_pool if update_mask is not None: @@ -1804,7 +1762,6 @@ async def get_ca_pool( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1838,7 +1795,6 @@ async def get_ca_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1886,7 +1842,6 @@ async def list_ca_pools( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1916,7 +1871,6 @@ async def list_ca_pools( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1969,7 +1923,6 @@ async def delete_ca_pool( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2005,7 +1958,6 @@ async def delete_ca_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2065,7 +2017,6 @@ async def fetch_ca_certs( This corresponds to the ``ca_pool`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2092,7 +2043,6 @@ async def fetch_ca_certs( # If we have keyword arguments corresponding to fields on the # request, apply these. - if ca_pool is not None: request.ca_pool = ca_pool @@ -2142,7 +2092,6 @@ async def get_certificate_revocation_list( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2171,7 +2120,6 @@ async def get_certificate_revocation_list( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2221,7 +2169,6 @@ async def list_certificate_revocation_lists( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2251,7 +2198,6 @@ async def list_certificate_revocation_lists( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -2286,7 +2232,7 @@ async def update_certificate_revocation_list( request: service.UpdateCertificateRevocationListRequest = None, *, certificate_revocation_list: resources.CertificateRevocationList = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -2313,7 +2259,6 @@ async def update_certificate_revocation_list( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2344,7 +2289,6 @@ async def update_certificate_revocation_list( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_revocation_list is not None: request.certificate_revocation_list = certificate_revocation_list if update_mask is not None: @@ -2428,7 +2372,6 @@ async def create_certificate_template( This corresponds to the ``certificate_template_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2459,7 +2402,6 @@ async def create_certificate_template( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_template is not None: @@ -2520,7 +2462,6 @@ async def delete_certificate_template( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2560,7 +2501,6 @@ async def delete_certificate_template( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2585,7 +2525,7 @@ async def delete_certificate_template( response = operation_async.from_gapic( response, self._client._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=service.OperationMetadata, ) @@ -2618,7 +2558,6 @@ async def get_certificate_template( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2645,7 +2584,6 @@ async def get_certificate_template( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2694,7 +2632,6 @@ async def list_certificate_templates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2724,7 +2661,6 @@ async def list_certificate_templates( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -2759,7 +2695,7 @@ async def update_certificate_template( request: service.UpdateCertificateTemplateRequest = None, *, certificate_template: resources.CertificateTemplate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -2786,7 +2722,6 @@ async def update_certificate_template( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2815,7 +2750,6 @@ async def update_certificate_template( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_template is not None: request.certificate_template = certificate_template if update_mask is not None: diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py index ad3047f..ac7e7d5 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore @@ -39,11 +37,10 @@ ) from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import CertificateAuthorityServiceGrpcTransport from .transports.grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport @@ -68,7 +65,7 @@ class CertificateAuthorityServiceClientMeta(type): def get_transport_class( cls, label: str = None, ) -> Type[CertificateAuthorityServiceTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -96,7 +93,8 @@ class CertificateAuthorityServiceClient( @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. + """Converts api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. Args: @@ -130,7 +128,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -147,7 +146,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -166,23 +165,24 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> CertificateAuthorityServiceTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - CertificateAuthorityServiceTransport: The transport used by the client instance. + CertificateAuthorityServiceTransport: The transport used by the client + instance. """ return self._transport @staticmethod def ca_pool_path(project: str, location: str, ca_pool: str,) -> str: - """Return a fully-qualified ca_pool string.""" + """Returns a fully-qualified ca_pool string.""" return "projects/{project}/locations/{location}/caPools/{ca_pool}".format( project=project, location=location, ca_pool=ca_pool, ) @staticmethod def parse_ca_pool_path(path: str) -> Dict[str, str]: - """Parse a ca_pool path into its component segments.""" + """Parses a ca_pool path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)$", path, @@ -193,7 +193,7 @@ def parse_ca_pool_path(path: str) -> Dict[str, str]: def certificate_path( project: str, location: str, ca_pool: str, certificate: str, ) -> str: - """Return a fully-qualified certificate string.""" + """Returns a fully-qualified certificate string.""" return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}".format( project=project, location=location, @@ -203,7 +203,7 @@ def certificate_path( @staticmethod def parse_certificate_path(path: str) -> Dict[str, str]: - """Parse a certificate path into its component segments.""" + """Parses a certificate path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificates/(?P.+?)$", path, @@ -214,7 +214,7 @@ def parse_certificate_path(path: str) -> Dict[str, str]: def certificate_authority_path( project: str, location: str, ca_pool: str, certificate_authority: str, ) -> str: - """Return a fully-qualified certificate_authority string.""" + """Returns a fully-qualified certificate_authority string.""" return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format( project=project, location=location, @@ -224,7 +224,7 @@ def certificate_authority_path( @staticmethod def parse_certificate_authority_path(path: str) -> Dict[str, str]: - """Parse a certificate_authority path into its component segments.""" + """Parses a certificate_authority path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificateAuthorities/(?P.+?)$", path, @@ -239,7 +239,7 @@ def certificate_revocation_list_path( certificate_authority: str, certificate_revocation_list: str, ) -> str: - """Return a fully-qualified certificate_revocation_list string.""" + """Returns a fully-qualified certificate_revocation_list string.""" return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}".format( project=project, location=location, @@ -250,7 +250,7 @@ def certificate_revocation_list_path( @staticmethod def parse_certificate_revocation_list_path(path: str) -> Dict[str, str]: - """Parse a certificate_revocation_list path into its component segments.""" + """Parses a certificate_revocation_list path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificateAuthorities/(?P.+?)/certificateRevocationLists/(?P.+?)$", path, @@ -261,7 +261,7 @@ def parse_certificate_revocation_list_path(path: str) -> Dict[str, str]: def certificate_template_path( project: str, location: str, certificate_template: str, ) -> str: - """Return a fully-qualified certificate_template string.""" + """Returns a fully-qualified certificate_template string.""" return "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}".format( project=project, location=location, @@ -270,7 +270,7 @@ def certificate_template_path( @staticmethod def parse_certificate_template_path(path: str) -> Dict[str, str]: - """Parse a certificate_template path into its component segments.""" + """Parses a certificate_template path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/certificateTemplates/(?P.+?)$", path, @@ -279,7 +279,7 @@ def parse_certificate_template_path(path: str) -> Dict[str, str]: @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -292,7 +292,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -303,7 +303,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -314,7 +314,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -325,7 +325,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -339,12 +339,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, CertificateAuthorityServiceTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the certificate authority service client. + """Instantiates the certificate authority service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -399,9 +399,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -413,12 +414,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -433,8 +436,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -498,7 +501,6 @@ def create_certificate( This corresponds to the ``certificate_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -527,10 +529,8 @@ def create_certificate( # there are no flattened fields. if not isinstance(request, service.CreateCertificateRequest): request = service.CreateCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate is not None: @@ -580,7 +580,6 @@ def get_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -609,10 +608,8 @@ def get_certificate( # there are no flattened fields. if not isinstance(request, service.GetCertificateRequest): request = service.GetCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -657,7 +654,6 @@ def list_certificates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -689,10 +685,8 @@ def list_certificates( # there are no flattened fields. if not isinstance(request, service.ListCertificatesRequest): request = service.ListCertificatesRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -743,7 +737,6 @@ def revoke_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -772,10 +765,8 @@ def revoke_certificate( # there are no flattened fields. if not isinstance(request, service.RevokeCertificateRequest): request = service.RevokeCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -800,7 +791,7 @@ def update_certificate( request: service.UpdateCertificateRequest = None, *, certificate: resources.Certificate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -830,7 +821,6 @@ def update_certificate( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -859,10 +849,8 @@ def update_certificate( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateRequest): request = service.UpdateCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate is not None: request.certificate = certificate if update_mask is not None: @@ -919,7 +907,6 @@ def activate_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -953,10 +940,8 @@ def activate_certificate_authority( # there are no flattened fields. if not isinstance(request, service.ActivateCertificateAuthorityRequest): request = service.ActivateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1030,7 +1015,6 @@ def create_certificate_authority( This corresponds to the ``certificate_authority_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1066,10 +1050,8 @@ def create_certificate_authority( # there are no flattened fields. if not isinstance(request, service.CreateCertificateAuthorityRequest): request = service.CreateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_authority is not None: @@ -1128,7 +1110,6 @@ def disable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1162,10 +1143,8 @@ def disable_certificate_authority( # there are no flattened fields. if not isinstance(request, service.DisableCertificateAuthorityRequest): request = service.DisableCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1220,7 +1199,6 @@ def enable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1254,10 +1232,8 @@ def enable_certificate_authority( # there are no flattened fields. if not isinstance(request, service.EnableCertificateAuthorityRequest): request = service.EnableCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1321,7 +1297,6 @@ def fetch_certificate_authority_csr( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1350,10 +1325,8 @@ def fetch_certificate_authority_csr( # there are no flattened fields. if not isinstance(request, service.FetchCertificateAuthorityCsrRequest): request = service.FetchCertificateAuthorityCsrRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1401,7 +1374,6 @@ def get_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1433,10 +1405,8 @@ def get_certificate_authority( # there are no flattened fields. if not isinstance(request, service.GetCertificateAuthorityRequest): request = service.GetCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1484,7 +1454,6 @@ def list_certificate_authorities( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1516,10 +1485,8 @@ def list_certificate_authorities( # there are no flattened fields. if not isinstance(request, service.ListCertificateAuthoritiesRequest): request = service.ListCertificateAuthoritiesRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1573,7 +1540,6 @@ def undelete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1607,10 +1573,8 @@ def undelete_certificate_authority( # there are no flattened fields. if not isinstance(request, service.UndeleteCertificateAuthorityRequest): request = service.UndeleteCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1665,7 +1629,6 @@ def delete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1699,10 +1662,8 @@ def delete_certificate_authority( # there are no flattened fields. if not isinstance(request, service.DeleteCertificateAuthorityRequest): request = service.DeleteCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1737,7 +1698,7 @@ def update_certificate_authority( request: service.UpdateCertificateAuthorityRequest = None, *, certificate_authority: resources.CertificateAuthority = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1764,7 +1725,6 @@ def update_certificate_authority( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1798,10 +1758,8 @@ def update_certificate_authority( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateAuthorityRequest): request = service.UpdateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_authority is not None: request.certificate_authority = certificate_authority if update_mask is not None: @@ -1876,7 +1834,6 @@ def create_ca_pool( This corresponds to the ``ca_pool_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1914,10 +1871,8 @@ def create_ca_pool( # there are no flattened fields. if not isinstance(request, service.CreateCaPoolRequest): request = service.CreateCaPoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if ca_pool is not None: @@ -1954,7 +1909,7 @@ def update_ca_pool( request: service.UpdateCaPoolRequest = None, *, ca_pool: resources.CaPool = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1980,7 +1935,6 @@ def update_ca_pool( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2018,10 +1972,8 @@ def update_ca_pool( # there are no flattened fields. if not isinstance(request, service.UpdateCaPoolRequest): request = service.UpdateCaPoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if ca_pool is not None: request.ca_pool = ca_pool if update_mask is not None: @@ -2078,7 +2030,6 @@ def get_ca_pool( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2114,10 +2065,8 @@ def get_ca_pool( # there are no flattened fields. if not isinstance(request, service.GetCaPoolRequest): request = service.GetCaPoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2161,7 +2110,6 @@ def list_ca_pools( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2193,10 +2141,8 @@ def list_ca_pools( # there are no flattened fields. if not isinstance(request, service.ListCaPoolsRequest): request = service.ListCaPoolsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -2245,7 +2191,6 @@ def delete_ca_pool( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2283,10 +2228,8 @@ def delete_ca_pool( # there are no flattened fields. if not isinstance(request, service.DeleteCaPoolRequest): request = service.DeleteCaPoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2342,7 +2285,6 @@ def fetch_ca_certs( This corresponds to the ``ca_pool`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2371,10 +2313,8 @@ def fetch_ca_certs( # there are no flattened fields. if not isinstance(request, service.FetchCaCertsRequest): request = service.FetchCaCertsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if ca_pool is not None: request.ca_pool = ca_pool @@ -2420,7 +2360,6 @@ def get_certificate_revocation_list( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2451,10 +2390,8 @@ def get_certificate_revocation_list( # there are no flattened fields. if not isinstance(request, service.GetCertificateRevocationListRequest): request = service.GetCertificateRevocationListRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2502,7 +2439,6 @@ def list_certificate_revocation_lists( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2534,10 +2470,8 @@ def list_certificate_revocation_lists( # there are no flattened fields. if not isinstance(request, service.ListCertificateRevocationListsRequest): request = service.ListCertificateRevocationListsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -2570,7 +2504,7 @@ def update_certificate_revocation_list( request: service.UpdateCertificateRevocationListRequest = None, *, certificate_revocation_list: resources.CertificateRevocationList = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -2597,7 +2531,6 @@ def update_certificate_revocation_list( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2630,10 +2563,8 @@ def update_certificate_revocation_list( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateRevocationListRequest): request = service.UpdateCertificateRevocationListRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_revocation_list is not None: request.certificate_revocation_list = certificate_revocation_list if update_mask is not None: @@ -2715,7 +2646,6 @@ def create_certificate_template( This corresponds to the ``certificate_template_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2748,10 +2678,8 @@ def create_certificate_template( # there are no flattened fields. if not isinstance(request, service.CreateCertificateTemplateRequest): request = service.CreateCertificateTemplateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_template is not None: @@ -2810,7 +2738,6 @@ def delete_certificate_template( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2852,10 +2779,8 @@ def delete_certificate_template( # there are no flattened fields. if not isinstance(request, service.DeleteCertificateTemplateRequest): request = service.DeleteCertificateTemplateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2878,7 +2803,7 @@ def delete_certificate_template( response = operation.from_gapic( response, self._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=service.OperationMetadata, ) @@ -2911,7 +2836,6 @@ def get_certificate_template( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2940,10 +2864,8 @@ def get_certificate_template( # there are no flattened fields. if not isinstance(request, service.GetCertificateTemplateRequest): request = service.GetCertificateTemplateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2988,7 +2910,6 @@ def list_certificate_templates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3020,10 +2941,8 @@ def list_certificate_templates( # there are no flattened fields. if not isinstance(request, service.ListCertificateTemplatesRequest): request = service.ListCertificateTemplatesRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -3056,7 +2975,7 @@ def update_certificate_template( request: service.UpdateCertificateTemplateRequest = None, *, certificate_template: resources.CertificateTemplate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -3083,7 +3002,6 @@ def update_certificate_template( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3114,10 +3032,8 @@ def update_certificate_template( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateTemplateRequest): request = service.UpdateCertificateTemplateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_template is not None: request.certificate_template = certificate_template if update_mask is not None: diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py index 99ef635..689e033 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -246,7 +244,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -374,7 +372,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -504,7 +502,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -634,7 +632,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py index 3a3aa46..ab66300 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py index 0f8d05d..9a0216f 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,27 +39,41 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class CertificateAuthorityServiceTransport(abc.ABC): """Abstract transport class for CertificateAuthorityService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + DEFAULT_HOST: str = "privateca.googleapis.com" + def __init__( self, *, - host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -69,7 +82,7 @@ def __init__( credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is mutually exclusive with credentials. - scope (Optional[Sequence[str]]): A list of scopes. + scopes (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -83,29 +96,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -242,29 +302,29 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def create_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def get_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def list_certificates( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificatesRequest], - typing.Union[ + Union[ service.ListCertificatesResponse, - typing.Awaitable[service.ListCertificatesResponse], + Awaitable[service.ListCertificatesResponse], ], ]: raise NotImplementedError() @@ -272,65 +332,65 @@ def list_certificates( @property def revoke_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.RevokeCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def update_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def activate_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ActivateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def create_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def disable_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.DisableCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def enable_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.EnableCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def fetch_certificate_authority_csr( self, - ) -> typing.Callable[ + ) -> Callable[ [service.FetchCertificateAuthorityCsrRequest], - typing.Union[ + Union[ service.FetchCertificateAuthorityCsrResponse, - typing.Awaitable[service.FetchCertificateAuthorityCsrResponse], + Awaitable[service.FetchCertificateAuthorityCsrResponse], ], ]: raise NotImplementedError() @@ -338,11 +398,10 @@ def fetch_certificate_authority_csr( @property def get_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateAuthorityRequest], - typing.Union[ - resources.CertificateAuthority, - typing.Awaitable[resources.CertificateAuthority], + Union[ + resources.CertificateAuthority, Awaitable[resources.CertificateAuthority] ], ]: raise NotImplementedError() @@ -350,11 +409,11 @@ def get_certificate_authority( @property def list_certificate_authorities( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificateAuthoritiesRequest], - typing.Union[ + Union[ service.ListCertificateAuthoritiesResponse, - typing.Awaitable[service.ListCertificateAuthoritiesResponse], + Awaitable[service.ListCertificateAuthoritiesResponse], ], ]: raise NotImplementedError() @@ -362,96 +421,91 @@ def list_certificate_authorities( @property def undelete_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UndeleteCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def delete_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.DeleteCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def create_ca_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCaPoolRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_ca_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCaPoolRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def get_ca_pool( self, - ) -> typing.Callable[ - [service.GetCaPoolRequest], - typing.Union[resources.CaPool, typing.Awaitable[resources.CaPool]], + ) -> Callable[ + [service.GetCaPoolRequest], Union[resources.CaPool, Awaitable[resources.CaPool]] ]: raise NotImplementedError() @property def list_ca_pools( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCaPoolsRequest], - typing.Union[ - service.ListCaPoolsResponse, typing.Awaitable[service.ListCaPoolsResponse] - ], + Union[service.ListCaPoolsResponse, Awaitable[service.ListCaPoolsResponse]], ]: raise NotImplementedError() @property def delete_ca_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [service.DeleteCaPoolRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def fetch_ca_certs( self, - ) -> typing.Callable[ + ) -> Callable[ [service.FetchCaCertsRequest], - typing.Union[ - service.FetchCaCertsResponse, typing.Awaitable[service.FetchCaCertsResponse] - ], + Union[service.FetchCaCertsResponse, Awaitable[service.FetchCaCertsResponse]], ]: raise NotImplementedError() @property def get_certificate_revocation_list( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateRevocationListRequest], - typing.Union[ + Union[ resources.CertificateRevocationList, - typing.Awaitable[resources.CertificateRevocationList], + Awaitable[resources.CertificateRevocationList], ], ]: raise NotImplementedError() @@ -459,11 +513,11 @@ def get_certificate_revocation_list( @property def list_certificate_revocation_lists( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificateRevocationListsRequest], - typing.Union[ + Union[ service.ListCertificateRevocationListsResponse, - typing.Awaitable[service.ListCertificateRevocationListsResponse], + Awaitable[service.ListCertificateRevocationListsResponse], ], ]: raise NotImplementedError() @@ -471,50 +525,47 @@ def list_certificate_revocation_lists( @property def update_certificate_revocation_list( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateRevocationListRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def create_certificate_template( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCertificateTemplateRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def delete_certificate_template( self, - ) -> typing.Callable[ + ) -> Callable[ [service.DeleteCertificateTemplateRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def get_certificate_template( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateTemplateRequest], - typing.Union[ - resources.CertificateTemplate, - typing.Awaitable[resources.CertificateTemplate], - ], + Union[resources.CertificateTemplate, Awaitable[resources.CertificateTemplate]], ]: raise NotImplementedError() @property def list_certificate_templates( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificateTemplatesRequest], - typing.Union[ + Union[ service.ListCertificateTemplatesResponse, - typing.Awaitable[service.ListCertificateTemplatesResponse], + Awaitable[service.ListCertificateTemplatesResponse], ], ]: raise NotImplementedError() @@ -522,9 +573,9 @@ def list_certificate_templates( @property def update_certificate_template( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateTemplateRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py index b03498e..68885f4 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO @@ -55,7 +52,7 @@ def __init__( self, *, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -69,7 +66,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -180,7 +178,7 @@ def __init__( def create_channel( cls, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -211,13 +209,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -384,7 +384,9 @@ def update_certificate( @property def activate_certificate_authority( self, - ) -> Callable[[service.ActivateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.ActivateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the activate certificate authority method over gRPC. Activate a @@ -414,14 +416,16 @@ def activate_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority", request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["activate_certificate_authority"] @property def create_certificate_authority( self, - ) -> Callable[[service.CreateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.CreateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the create certificate authority method over gRPC. Create a new @@ -442,14 +446,16 @@ def create_certificate_authority( self._stubs["create_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateAuthority", request_serializer=service.CreateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_authority"] @property def disable_certificate_authority( self, - ) -> Callable[[service.DisableCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.DisableCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the disable certificate authority method over gRPC. Disable a @@ -471,14 +477,16 @@ def disable_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority", request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["disable_certificate_authority"] @property def enable_certificate_authority( self, - ) -> Callable[[service.EnableCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.EnableCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the enable certificate authority method over gRPC. Enable a @@ -498,7 +506,7 @@ def enable_certificate_authority( self._stubs["enable_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/EnableCertificateAuthority", request_serializer=service.EnableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["enable_certificate_authority"] @@ -606,7 +614,9 @@ def list_certificate_authorities( @property def undelete_certificate_authority( self, - ) -> Callable[[service.UndeleteCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.UndeleteCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the undelete certificate authority method over gRPC. Undelete a @@ -629,14 +639,16 @@ def undelete_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority", request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["undelete_certificate_authority"] @property def delete_certificate_authority( self, - ) -> Callable[[service.DeleteCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.DeleteCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the delete certificate authority method over gRPC. Delete a @@ -656,14 +668,16 @@ def delete_certificate_authority( self._stubs["delete_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateAuthority", request_serializer=service.DeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_certificate_authority"] @property def update_certificate_authority( self, - ) -> Callable[[service.UpdateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.UpdateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the update certificate authority method over gRPC. Update a @@ -683,14 +697,14 @@ def update_certificate_authority( self._stubs["update_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateAuthority", request_serializer=service.UpdateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_authority"] @property def create_ca_pool( self, - ) -> Callable[[service.CreateCaPoolRequest], operations.Operation]: + ) -> Callable[[service.CreateCaPoolRequest], operations_pb2.Operation]: r"""Return a callable for the create ca pool method over gRPC. Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -709,14 +723,14 @@ def create_ca_pool( self._stubs["create_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCaPool", request_serializer=service.CreateCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_ca_pool"] @property def update_ca_pool( self, - ) -> Callable[[service.UpdateCaPoolRequest], operations.Operation]: + ) -> Callable[[service.UpdateCaPoolRequest], operations_pb2.Operation]: r"""Return a callable for the update ca pool method over gRPC. Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -735,7 +749,7 @@ def update_ca_pool( self._stubs["update_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCaPool", request_serializer=service.UpdateCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_ca_pool"] @@ -792,7 +806,7 @@ def list_ca_pools( @property def delete_ca_pool( self, - ) -> Callable[[service.DeleteCaPoolRequest], operations.Operation]: + ) -> Callable[[service.DeleteCaPoolRequest], operations_pb2.Operation]: r"""Return a callable for the delete ca pool method over gRPC. Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -811,7 +825,7 @@ def delete_ca_pool( self._stubs["delete_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCaPool", request_serializer=service.DeleteCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_ca_pool"] @@ -916,7 +930,7 @@ def list_certificate_revocation_lists( def update_certificate_revocation_list( self, ) -> Callable[ - [service.UpdateCertificateRevocationListRequest], operations.Operation + [service.UpdateCertificateRevocationListRequest], operations_pb2.Operation ]: r"""Return a callable for the update certificate revocation list method over gRPC. @@ -940,14 +954,14 @@ def update_certificate_revocation_list( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList", request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_revocation_list"] @property def create_certificate_template( self, - ) -> Callable[[service.CreateCertificateTemplateRequest], operations.Operation]: + ) -> Callable[[service.CreateCertificateTemplateRequest], operations_pb2.Operation]: r"""Return a callable for the create certificate template method over gRPC. Create a new @@ -968,14 +982,14 @@ def create_certificate_template( self._stubs["create_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateTemplate", request_serializer=service.CreateCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_template"] @property def delete_certificate_template( self, - ) -> Callable[[service.DeleteCertificateTemplateRequest], operations.Operation]: + ) -> Callable[[service.DeleteCertificateTemplateRequest], operations_pb2.Operation]: r"""Return a callable for the delete certificate template method over gRPC. DeleteCertificateTemplate deletes a @@ -995,7 +1009,7 @@ def delete_certificate_template( self._stubs["delete_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateTemplate", request_serializer=service.DeleteCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_certificate_template"] @@ -1061,7 +1075,7 @@ def list_certificate_templates( @property def update_certificate_template( self, - ) -> Callable[[service.UpdateCertificateTemplateRequest], operations.Operation]: + ) -> Callable[[service.UpdateCertificateTemplateRequest], operations_pb2.Operation]: r"""Return a callable for the update certificate template method over gRPC. Update a @@ -1081,7 +1095,7 @@ def update_certificate_template( self._stubs["update_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateTemplate", request_serializer=service.UpdateCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_template"] diff --git a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py index e64a0bd..738f641 100644 --- a/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py +++ b/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .grpc import CertificateAuthorityServiceGrpcTransport @@ -60,7 +57,7 @@ class CertificateAuthorityServiceGrpcAsyncIOTransport( def create_channel( cls, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -87,13 +84,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -101,7 +100,7 @@ def __init__( self, *, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -115,7 +114,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -174,7 +174,6 @@ def __init__( # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - else: if api_mtls_endpoint: host = api_mtls_endpoint @@ -395,7 +394,8 @@ def update_certificate( def activate_certificate_authority( self, ) -> Callable[ - [service.ActivateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.ActivateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the activate certificate authority method over gRPC. @@ -426,7 +426,7 @@ def activate_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority", request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["activate_certificate_authority"] @@ -434,7 +434,7 @@ def activate_certificate_authority( def create_certificate_authority( self, ) -> Callable[ - [service.CreateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.CreateCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create certificate authority method over gRPC. @@ -456,7 +456,7 @@ def create_certificate_authority( self._stubs["create_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateAuthority", request_serializer=service.CreateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_authority"] @@ -464,7 +464,8 @@ def create_certificate_authority( def disable_certificate_authority( self, ) -> Callable[ - [service.DisableCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.DisableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the disable certificate authority method over gRPC. @@ -487,7 +488,7 @@ def disable_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority", request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["disable_certificate_authority"] @@ -495,7 +496,7 @@ def disable_certificate_authority( def enable_certificate_authority( self, ) -> Callable[ - [service.EnableCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.EnableCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the enable certificate authority method over gRPC. @@ -516,7 +517,7 @@ def enable_certificate_authority( self._stubs["enable_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/EnableCertificateAuthority", request_serializer=service.EnableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["enable_certificate_authority"] @@ -626,7 +627,8 @@ def list_certificate_authorities( def undelete_certificate_authority( self, ) -> Callable[ - [service.UndeleteCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.UndeleteCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the undelete certificate authority method over gRPC. @@ -650,7 +652,7 @@ def undelete_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority", request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["undelete_certificate_authority"] @@ -658,7 +660,7 @@ def undelete_certificate_authority( def delete_certificate_authority( self, ) -> Callable[ - [service.DeleteCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.DeleteCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the delete certificate authority method over gRPC. @@ -679,7 +681,7 @@ def delete_certificate_authority( self._stubs["delete_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateAuthority", request_serializer=service.DeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_certificate_authority"] @@ -687,7 +689,7 @@ def delete_certificate_authority( def update_certificate_authority( self, ) -> Callable[ - [service.UpdateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.UpdateCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the update certificate authority method over gRPC. @@ -708,14 +710,14 @@ def update_certificate_authority( self._stubs["update_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateAuthority", request_serializer=service.UpdateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_authority"] @property def create_ca_pool( self, - ) -> Callable[[service.CreateCaPoolRequest], Awaitable[operations.Operation]]: + ) -> Callable[[service.CreateCaPoolRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the create ca pool method over gRPC. Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -734,14 +736,14 @@ def create_ca_pool( self._stubs["create_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCaPool", request_serializer=service.CreateCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_ca_pool"] @property def update_ca_pool( self, - ) -> Callable[[service.UpdateCaPoolRequest], Awaitable[operations.Operation]]: + ) -> Callable[[service.UpdateCaPoolRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the update ca pool method over gRPC. Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -760,7 +762,7 @@ def update_ca_pool( self._stubs["update_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCaPool", request_serializer=service.UpdateCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_ca_pool"] @@ -819,7 +821,7 @@ def list_ca_pools( @property def delete_ca_pool( self, - ) -> Callable[[service.DeleteCaPoolRequest], Awaitable[operations.Operation]]: + ) -> Callable[[service.DeleteCaPoolRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the delete ca pool method over gRPC. Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. @@ -838,7 +840,7 @@ def delete_ca_pool( self._stubs["delete_ca_pool"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCaPool", request_serializer=service.DeleteCaPoolRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_ca_pool"] @@ -946,7 +948,7 @@ def update_certificate_revocation_list( self, ) -> Callable[ [service.UpdateCertificateRevocationListRequest], - Awaitable[operations.Operation], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the update certificate revocation list method over gRPC. @@ -970,7 +972,7 @@ def update_certificate_revocation_list( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList", request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_revocation_list"] @@ -978,7 +980,7 @@ def update_certificate_revocation_list( def create_certificate_template( self, ) -> Callable[ - [service.CreateCertificateTemplateRequest], Awaitable[operations.Operation] + [service.CreateCertificateTemplateRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create certificate template method over gRPC. @@ -1000,7 +1002,7 @@ def create_certificate_template( self._stubs["create_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateTemplate", request_serializer=service.CreateCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_template"] @@ -1008,7 +1010,7 @@ def create_certificate_template( def delete_certificate_template( self, ) -> Callable[ - [service.DeleteCertificateTemplateRequest], Awaitable[operations.Operation] + [service.DeleteCertificateTemplateRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the delete certificate template method over gRPC. @@ -1029,7 +1031,7 @@ def delete_certificate_template( self._stubs["delete_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateTemplate", request_serializer=service.DeleteCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_certificate_template"] @@ -1097,7 +1099,7 @@ def list_certificate_templates( def update_certificate_template( self, ) -> Callable[ - [service.UpdateCertificateTemplateRequest], Awaitable[operations.Operation] + [service.UpdateCertificateTemplateRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the update certificate template method over gRPC. @@ -1118,7 +1120,7 @@ def update_certificate_template( self._stubs["update_certificate_template"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateTemplate", request_serializer=service.UpdateCertificateTemplateRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_template"] diff --git a/google/cloud/security/privateca_v1/types/__init__.py b/google/cloud/security/privateca_v1/types/__init__.py index e0743d1..331d6fb 100644 --- a/google/cloud/security/privateca_v1/types/__init__.py +++ b/google/cloud/security/privateca_v1/types/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .resources import ( CaPool, Certificate, diff --git a/google/cloud/security/privateca_v1/types/resources.py b/google/cloud/security/privateca_v1/types/resources.py index 3852320..677600a 100644 --- a/google/cloud/security/privateca_v1/types/resources.py +++ b/google/cloud/security/privateca_v1/types/resources.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.type import expr_pb2 as expr # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import expr_pb2 # type: ignore __protobuf__ = proto.module( @@ -246,9 +243,8 @@ class AccessUrls(proto.Message): been activated. """ - ca_certificate_access_url = proto.Field(proto.STRING, number=1) - - crl_access_urls = proto.RepeatedField(proto.STRING, number=2) + ca_certificate_access_url = proto.Field(proto.STRING, number=1,) + crl_access_urls = proto.RepeatedField(proto.STRING, number=2,) class KeyVersionSpec(proto.Message): r"""A Cloud KMS key configuration that a @@ -270,8 +266,7 @@ class KeyVersionSpec(proto.Message): ``HSM``. """ - cloud_kms_key_version = proto.Field(proto.STRING, number=1, oneof="KeyVersion") - + cloud_kms_key_version = proto.Field(proto.STRING, number=1, oneof="KeyVersion",) algorithm = proto.Field( proto.ENUM, number=2, @@ -279,43 +274,35 @@ class KeyVersionSpec(proto.Message): enum="CertificateAuthority.SignHashAlgorithm", ) - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) type_ = proto.Field(proto.ENUM, number=2, enum=Type,) - config = proto.Field(proto.MESSAGE, number=3, message="CertificateConfig",) - - lifetime = proto.Field(proto.MESSAGE, number=4, message=duration.Duration,) - + lifetime = proto.Field(proto.MESSAGE, number=4, message=duration_pb2.Duration,) key_spec = proto.Field(proto.MESSAGE, number=5, message=KeyVersionSpec,) - subordinate_config = proto.Field( proto.MESSAGE, number=6, message="SubordinateConfig", ) - tier = proto.Field(proto.ENUM, number=7, enum="CaPool.Tier",) - state = proto.Field(proto.ENUM, number=8, enum=State,) - - pem_ca_certificates = proto.RepeatedField(proto.STRING, number=9) - + pem_ca_certificates = proto.RepeatedField(proto.STRING, number=9,) ca_certificate_descriptions = proto.RepeatedField( proto.MESSAGE, number=10, message="CertificateDescription", ) - - gcs_bucket = proto.Field(proto.STRING, number=11) - + gcs_bucket = proto.Field(proto.STRING, number=11,) access_urls = proto.Field(proto.MESSAGE, number=12, message=AccessUrls,) - - create_time = proto.Field(proto.MESSAGE, number=13, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=14, message=timestamp.Timestamp,) - - delete_time = proto.Field(proto.MESSAGE, number=15, message=timestamp.Timestamp,) - - expire_time = proto.Field(proto.MESSAGE, number=16, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=17) + create_time = proto.Field( + proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, number=14, message=timestamp_pb2.Timestamp, + ) + delete_time = proto.Field( + proto.MESSAGE, number=15, message=timestamp_pb2.Timestamp, + ) + expire_time = proto.Field( + proto.MESSAGE, number=16, message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField(proto.STRING, proto.STRING, number=17,) class CaPool(proto.Message): @@ -397,9 +384,8 @@ class PublishingOptions(proto.Message): shortly after a certificate is revoked. """ - publish_ca_cert = proto.Field(proto.BOOL, number=1) - - publish_crl = proto.Field(proto.BOOL, number=2) + publish_ca_cert = proto.Field(proto.BOOL, number=1,) + publish_crl = proto.Field(proto.BOOL, number=2,) class IssuancePolicy(proto.Message): r"""Defines controls over all certificate issuance within a @@ -504,9 +490,8 @@ class RsaKeyType(proto.Message): upper bound on RSA modulus sizes. """ - min_modulus_size = proto.Field(proto.INT64, number=1) - - max_modulus_size = proto.Field(proto.INT64, number=2) + min_modulus_size = proto.Field(proto.INT64, number=1,) + max_modulus_size = proto.Field(proto.INT64, number=2,) class EcKeyType(proto.Message): r"""Describes an Elliptic Curve key that may be used in a @@ -543,7 +528,6 @@ class EcSignatureAlgorithm(proto.Enum): oneof="key_type", message="CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType", ) - elliptic_curve = proto.Field( proto.MESSAGE, number=2, @@ -570,45 +554,35 @@ class IssuanceModes(proto.Message): [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig]. """ - allow_csr_based_issuance = proto.Field(proto.BOOL, number=1) - - allow_config_based_issuance = proto.Field(proto.BOOL, number=2) + allow_csr_based_issuance = proto.Field(proto.BOOL, number=1,) + allow_config_based_issuance = proto.Field(proto.BOOL, number=2,) allowed_key_types = proto.RepeatedField( proto.MESSAGE, number=1, message="CaPool.IssuancePolicy.AllowedKeyType", ) - maximum_lifetime = proto.Field( - proto.MESSAGE, number=2, message=duration.Duration, + proto.MESSAGE, number=2, message=duration_pb2.Duration, ) - allowed_issuance_modes = proto.Field( proto.MESSAGE, number=3, message="CaPool.IssuancePolicy.IssuanceModes", ) - baseline_values = proto.Field( proto.MESSAGE, number=4, message="X509Parameters", ) - identity_constraints = proto.Field( proto.MESSAGE, number=5, message="CertificateIdentityConstraints", ) - passthrough_extensions = proto.Field( proto.MESSAGE, number=6, message="CertificateExtensionConstraints", ) - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) tier = proto.Field(proto.ENUM, number=2, enum=Tier,) - issuance_policy = proto.Field(proto.MESSAGE, number=3, message=IssuancePolicy,) - publishing_options = proto.Field( proto.MESSAGE, number=4, message=PublishingOptions, ) - - labels = proto.MapField(proto.STRING, proto.STRING, number=5) + labels = proto.MapField(proto.STRING, proto.STRING, number=5,) class CertificateRevocationList(proto.Message): @@ -684,33 +658,22 @@ class RevokedCertificate(proto.Message): was revoked. """ - certificate = proto.Field(proto.STRING, number=1) - - hex_serial_number = proto.Field(proto.STRING, number=2) - + certificate = proto.Field(proto.STRING, number=1,) + hex_serial_number = proto.Field(proto.STRING, number=2,) revocation_reason = proto.Field(proto.ENUM, number=3, enum="RevocationReason",) - name = proto.Field(proto.STRING, number=1) - - sequence_number = proto.Field(proto.INT64, number=2) - + name = proto.Field(proto.STRING, number=1,) + sequence_number = proto.Field(proto.INT64, number=2,) revoked_certificates = proto.RepeatedField( proto.MESSAGE, number=3, message=RevokedCertificate, ) - - pem_crl = proto.Field(proto.STRING, number=4) - - access_url = proto.Field(proto.STRING, number=5) - + pem_crl = proto.Field(proto.STRING, number=4,) + access_url = proto.Field(proto.STRING, number=5,) state = proto.Field(proto.ENUM, number=6, enum=State,) - - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) - - revision_id = proto.Field(proto.STRING, number=9) - - labels = proto.MapField(proto.STRING, proto.STRING, number=10) + create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) + revision_id = proto.Field(proto.STRING, number=9,) + labels = proto.MapField(proto.STRING, proto.STRING, number=10,) class Certificate(proto.Message): @@ -799,47 +762,37 @@ class RevocationDetails(proto.Message): """ revocation_state = proto.Field(proto.ENUM, number=1, enum="RevocationReason",) - revocation_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp.Timestamp, + proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - name = proto.Field(proto.STRING, number=1) - - pem_csr = proto.Field(proto.STRING, number=2, oneof="certificate_config") - + name = proto.Field(proto.STRING, number=1,) + pem_csr = proto.Field(proto.STRING, number=2, oneof="certificate_config",) config = proto.Field( proto.MESSAGE, number=3, oneof="certificate_config", message="CertificateConfig", ) - - issuer_certificate_authority = proto.Field(proto.STRING, number=4) - - lifetime = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - - certificate_template = proto.Field(proto.STRING, number=6) - + issuer_certificate_authority = proto.Field(proto.STRING, number=4,) + lifetime = proto.Field(proto.MESSAGE, number=5, message=duration_pb2.Duration,) + certificate_template = proto.Field(proto.STRING, number=6,) subject_mode = proto.Field(proto.ENUM, number=7, enum="SubjectRequestMode",) - revocation_details = proto.Field( proto.MESSAGE, number=8, message=RevocationDetails, ) - - pem_certificate = proto.Field(proto.STRING, number=9) - + pem_certificate = proto.Field(proto.STRING, number=9,) certificate_description = proto.Field( proto.MESSAGE, number=10, message="CertificateDescription", ) - - pem_certificate_chain = proto.RepeatedField(proto.STRING, number=11) - - create_time = proto.Field(proto.MESSAGE, number=12, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=13, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=14) + pem_certificate_chain = proto.RepeatedField(proto.STRING, number=11,) + create_time = proto.Field( + proto.MESSAGE, number=12, message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField(proto.STRING, proto.STRING, number=14,) class CertificateTemplate(proto.Message): @@ -907,25 +860,18 @@ class CertificateTemplate(proto.Message): Optional. Labels with user-defined metadata. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) predefined_values = proto.Field(proto.MESSAGE, number=2, message="X509Parameters",) - identity_constraints = proto.Field( proto.MESSAGE, number=3, message="CertificateIdentityConstraints", ) - passthrough_extensions = proto.Field( proto.MESSAGE, number=4, message="CertificateExtensionConstraints", ) - - description = proto.Field(proto.STRING, number=5) - - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=8) + description = proto.Field(proto.STRING, number=5,) + create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + labels = proto.MapField(proto.STRING, proto.STRING, number=8,) class X509Parameters(proto.Message): @@ -958,7 +904,6 @@ class X509Parameters(proto.Message): class CaOptions(proto.Message): r"""Describes values that are relevant in a CA certificate. - Attributes: is_ca (bool): Optional. Refers to the "CA" X.509 extension, @@ -975,18 +920,13 @@ class CaOptions(proto.Message): length will be omitted from the CA certificate. """ - is_ca = proto.Field(proto.BOOL, number=1, optional=True) - - max_issuer_path_length = proto.Field(proto.INT32, number=2, optional=True) + is_ca = proto.Field(proto.BOOL, number=1, optional=True,) + max_issuer_path_length = proto.Field(proto.INT32, number=2, optional=True,) key_usage = proto.Field(proto.MESSAGE, number=1, message="KeyUsage",) - ca_options = proto.Field(proto.MESSAGE, number=2, message=CaOptions,) - policy_ids = proto.RepeatedField(proto.MESSAGE, number=3, message="ObjectId",) - - aia_ocsp_servers = proto.RepeatedField(proto.STRING, number=4) - + aia_ocsp_servers = proto.RepeatedField(proto.STRING, number=4,) additional_extensions = proto.RepeatedField( proto.MESSAGE, number=5, message="X509Extension", ) @@ -1024,12 +964,11 @@ class SubordinateConfigChain(proto.Message): order according to RFC 5246. """ - pem_certificates = proto.RepeatedField(proto.STRING, number=1) + pem_certificates = proto.RepeatedField(proto.STRING, number=1,) certificate_authority = proto.Field( - proto.STRING, number=1, oneof="subordinate_config" + proto.STRING, number=1, oneof="subordinate_config", ) - pem_issuer_chain = proto.Field( proto.MESSAGE, number=2, @@ -1058,8 +997,7 @@ class KeyFormat(proto.Enum): KEY_FORMAT_UNSPECIFIED = 0 PEM = 1 - key = proto.Field(proto.BYTES, number=1) - + key = proto.Field(proto.BYTES, number=1,) format_ = proto.Field(proto.ENUM, number=2, enum=KeyFormat,) @@ -1103,15 +1041,12 @@ class SubjectConfig(proto.Message): """ subject = proto.Field(proto.MESSAGE, number=1, message="Subject",) - subject_alt_name = proto.Field( proto.MESSAGE, number=2, message="SubjectAltNames", ) subject_config = proto.Field(proto.MESSAGE, number=1, message=SubjectConfig,) - x509_config = proto.Field(proto.MESSAGE, number=2, message="X509Parameters",) - public_key = proto.Field(proto.MESSAGE, number=3, message="PublicKey",) @@ -1177,21 +1112,16 @@ class SubjectDescription(proto.Message): """ subject = proto.Field(proto.MESSAGE, number=1, message="Subject",) - subject_alt_name = proto.Field( proto.MESSAGE, number=2, message="SubjectAltNames", ) - - hex_serial_number = proto.Field(proto.STRING, number=3) - - lifetime = proto.Field(proto.MESSAGE, number=4, message=duration.Duration,) - + hex_serial_number = proto.Field(proto.STRING, number=3,) + lifetime = proto.Field(proto.MESSAGE, number=4, message=duration_pb2.Duration,) not_before_time = proto.Field( - proto.MESSAGE, number=5, message=timestamp.Timestamp, + proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - not_after_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp.Timestamp, + proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) class KeyId(proto.Message): @@ -1205,35 +1135,27 @@ class KeyId(proto.Message): 160 bit SHA-1 hash of the public key. """ - key_id = proto.Field(proto.STRING, number=1) + key_id = proto.Field(proto.STRING, number=1,) class CertificateFingerprint(proto.Message): r"""A group of fingerprints for the x509 certificate. - Attributes: sha256_hash (str): The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. """ - sha256_hash = proto.Field(proto.STRING, number=1) + sha256_hash = proto.Field(proto.STRING, number=1,) subject_description = proto.Field( proto.MESSAGE, number=1, message=SubjectDescription, ) - x509_description = proto.Field(proto.MESSAGE, number=2, message="X509Parameters",) - public_key = proto.Field(proto.MESSAGE, number=3, message="PublicKey",) - subject_key_id = proto.Field(proto.MESSAGE, number=4, message=KeyId,) - authority_key_id = proto.Field(proto.MESSAGE, number=5, message=KeyId,) - - crl_distribution_points = proto.RepeatedField(proto.STRING, number=6) - - aia_issuing_certificate_urls = proto.RepeatedField(proto.STRING, number=7) - + crl_distribution_points = proto.RepeatedField(proto.STRING, number=6,) + aia_issuing_certificate_urls = proto.RepeatedField(proto.STRING, number=7,) cert_fingerprint = proto.Field( proto.MESSAGE, number=8, message=CertificateFingerprint, ) @@ -1250,7 +1172,7 @@ class ObjectId(proto.Message): significant parts of the path come first. """ - object_id_path = proto.RepeatedField(proto.INT32, number=1) + object_id_path = proto.RepeatedField(proto.INT32, number=1,) class X509Extension(proto.Message): @@ -1271,10 +1193,8 @@ class X509Extension(proto.Message): """ object_id = proto.Field(proto.MESSAGE, number=1, message="ObjectId",) - - critical = proto.Field(proto.BOOL, number=2) - - value = proto.Field(proto.BYTES, number=3) + critical = proto.Field(proto.BOOL, number=2,) + value = proto.Field(proto.BYTES, number=3,) class KeyUsage(proto.Message): @@ -1325,23 +1245,15 @@ class KeyUsageOptions(proto.Message): The key may be used to decipher only. """ - digital_signature = proto.Field(proto.BOOL, number=1) - - content_commitment = proto.Field(proto.BOOL, number=2) - - key_encipherment = proto.Field(proto.BOOL, number=3) - - data_encipherment = proto.Field(proto.BOOL, number=4) - - key_agreement = proto.Field(proto.BOOL, number=5) - - cert_sign = proto.Field(proto.BOOL, number=6) - - crl_sign = proto.Field(proto.BOOL, number=7) - - encipher_only = proto.Field(proto.BOOL, number=8) - - decipher_only = proto.Field(proto.BOOL, number=9) + digital_signature = proto.Field(proto.BOOL, number=1,) + content_commitment = proto.Field(proto.BOOL, number=2,) + key_encipherment = proto.Field(proto.BOOL, number=3,) + data_encipherment = proto.Field(proto.BOOL, number=4,) + key_agreement = proto.Field(proto.BOOL, number=5,) + cert_sign = proto.Field(proto.BOOL, number=6,) + crl_sign = proto.Field(proto.BOOL, number=7,) + encipher_only = proto.Field(proto.BOOL, number=8,) + decipher_only = proto.Field(proto.BOOL, number=9,) class ExtendedKeyUsageOptions(proto.Message): r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] @@ -1376,24 +1288,17 @@ class ExtendedKeyUsageOptions(proto.Message): responses". """ - server_auth = proto.Field(proto.BOOL, number=1) - - client_auth = proto.Field(proto.BOOL, number=2) - - code_signing = proto.Field(proto.BOOL, number=3) - - email_protection = proto.Field(proto.BOOL, number=4) - - time_stamping = proto.Field(proto.BOOL, number=5) - - ocsp_signing = proto.Field(proto.BOOL, number=6) + server_auth = proto.Field(proto.BOOL, number=1,) + client_auth = proto.Field(proto.BOOL, number=2,) + code_signing = proto.Field(proto.BOOL, number=3,) + email_protection = proto.Field(proto.BOOL, number=4,) + time_stamping = proto.Field(proto.BOOL, number=5,) + ocsp_signing = proto.Field(proto.BOOL, number=6,) base_key_usage = proto.Field(proto.MESSAGE, number=1, message=KeyUsageOptions,) - extended_key_usage = proto.Field( proto.MESSAGE, number=2, message=ExtendedKeyUsageOptions, ) - unknown_extended_key_usages = proto.RepeatedField( proto.MESSAGE, number=3, message="ObjectId", ) @@ -1424,21 +1329,14 @@ class Subject(proto.Message): The postal code of the subject. """ - common_name = proto.Field(proto.STRING, number=1) - - country_code = proto.Field(proto.STRING, number=2) - - organization = proto.Field(proto.STRING, number=3) - - organizational_unit = proto.Field(proto.STRING, number=4) - - locality = proto.Field(proto.STRING, number=5) - - province = proto.Field(proto.STRING, number=6) - - street_address = proto.Field(proto.STRING, number=7) - - postal_code = proto.Field(proto.STRING, number=8) + common_name = proto.Field(proto.STRING, number=1,) + country_code = proto.Field(proto.STRING, number=2,) + organization = proto.Field(proto.STRING, number=3,) + organizational_unit = proto.Field(proto.STRING, number=4,) + locality = proto.Field(proto.STRING, number=5,) + province = proto.Field(proto.STRING, number=6,) + street_address = proto.Field(proto.STRING, number=7,) + postal_code = proto.Field(proto.STRING, number=8,) class SubjectAltNames(proto.Message): @@ -1464,14 +1362,10 @@ class SubjectAltNames(proto.Message): values. """ - dns_names = proto.RepeatedField(proto.STRING, number=1) - - uris = proto.RepeatedField(proto.STRING, number=2) - - email_addresses = proto.RepeatedField(proto.STRING, number=3) - - ip_addresses = proto.RepeatedField(proto.STRING, number=4) - + dns_names = proto.RepeatedField(proto.STRING, number=1,) + uris = proto.RepeatedField(proto.STRING, number=2,) + email_addresses = proto.RepeatedField(proto.STRING, number=3,) + ip_addresses = proto.RepeatedField(proto.STRING, number=4,) custom_sans = proto.RepeatedField(proto.MESSAGE, number=5, message="X509Extension",) @@ -1491,26 +1385,30 @@ class CertificateIdentityConstraints(proto.Message): https://cloud.google.com/certificate-authority- service/docs/cel-guide allow_subject_passthrough (bool): - Optional. If this is set, the + Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject] will - be discarded. + be discarded. The bool is optional to indicate an unset + field, which suggests a forgotten value that needs to be set + by the caller. allow_subject_alt_names_passthrough (bool): - Optional. If this is set, the + Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a certificate request into the signed certificate. Otherwise, the requested [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - will be discarded. + will be discarded. The bool is optional to indicate an unset + field, which suggests a forgotten value that needs to be set + by the caller. """ - cel_expression = proto.Field(proto.MESSAGE, number=1, message=expr.Expr,) - - allow_subject_passthrough = proto.Field(proto.BOOL, number=2) - - allow_subject_alt_names_passthrough = proto.Field(proto.BOOL, number=3) + cel_expression = proto.Field(proto.MESSAGE, number=1, message=expr_pb2.Expr,) + allow_subject_passthrough = proto.Field(proto.BOOL, number=2, optional=True,) + allow_subject_alt_names_passthrough = proto.Field( + proto.BOOL, number=3, optional=True, + ) class CertificateExtensionConstraints(proto.Message): @@ -1548,7 +1446,6 @@ class KnownCertificateExtension(proto.Enum): known_extensions = proto.RepeatedField( proto.ENUM, number=1, enum=KnownCertificateExtension, ) - additional_extensions = proto.RepeatedField( proto.MESSAGE, number=2, message="ObjectId", ) diff --git a/google/cloud/security/privateca_v1/types/service.py b/google/cloud/security/privateca_v1/types/service.py index ef02a01..e1c3142 100644 --- a/google/cloud/security/privateca_v1/types/service.py +++ b/google/cloud/security/privateca_v1/types/service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - from google.cloud.security.privateca_v1.types import resources -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( @@ -145,17 +142,12 @@ class CreateCertificateRequest(proto.Message): to "my-ca". """ - parent = proto.Field(proto.STRING, number=1) - - certificate_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + certificate_id = proto.Field(proto.STRING, number=2,) certificate = proto.Field(proto.MESSAGE, number=3, message=resources.Certificate,) - - request_id = proto.Field(proto.STRING, number=4) - - validate_only = proto.Field(proto.BOOL, number=5) - - issuing_certificate_authority_id = proto.Field(proto.STRING, number=6) + request_id = proto.Field(proto.STRING, number=4,) + validate_only = proto.Field(proto.BOOL, number=5,) + issuing_certificate_authority_id = proto.Field(proto.STRING, number=6,) class GetCertificateRequest(proto.Message): @@ -171,7 +163,7 @@ class GetCertificateRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificatesRequest(proto.Message): @@ -208,15 +200,11 @@ class ListCertificatesRequest(proto.Message): documentation `__. """ - 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 ListCertificatesResponse(proto.Message): @@ -243,10 +231,8 @@ def raw_page(self): certificates = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.Certificate, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class RevokeCertificateRequest(proto.Message): @@ -284,11 +270,9 @@ class RevokeCertificateRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) reason = proto.Field(proto.ENUM, number=2, enum=resources.RevocationReason,) - - request_id = proto.Field(proto.STRING, number=3) + request_id = proto.Field(proto.STRING, number=3,) class UpdateCertificateRequest(proto.Message): @@ -325,10 +309,10 @@ class UpdateCertificateRequest(proto.Message): """ certificate = proto.Field(proto.MESSAGE, number=1, message=resources.Certificate,) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class ActivateCertificateAuthorityRequest(proto.Message): @@ -369,15 +353,12 @@ class ActivateCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - pem_ca_certificate = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + pem_ca_certificate = proto.Field(proto.STRING, number=2,) subordinate_config = proto.Field( proto.MESSAGE, number=3, message=resources.SubordinateConfig, ) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class CreateCertificateAuthorityRequest(proto.Message): @@ -419,15 +400,12 @@ class CreateCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1) - - certificate_authority_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + certificate_authority_id = proto.Field(proto.STRING, number=2,) certificate_authority = proto.Field( proto.MESSAGE, number=3, message=resources.CertificateAuthority, ) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class DisableCertificateAuthorityRequest(proto.Message): @@ -461,9 +439,8 @@ class DisableCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class EnableCertificateAuthorityRequest(proto.Message): @@ -497,9 +474,8 @@ class EnableCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class FetchCertificateAuthorityCsrRequest(proto.Message): @@ -514,7 +490,7 @@ class FetchCertificateAuthorityCsrRequest(proto.Message): ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class FetchCertificateAuthorityCsrResponse(proto.Message): @@ -527,7 +503,7 @@ class FetchCertificateAuthorityCsrResponse(proto.Message): certificate signing request (CSR). """ - pem_csr = proto.Field(proto.STRING, number=1) + pem_csr = proto.Field(proto.STRING, number=1,) class GetCertificateAuthorityRequest(proto.Message): @@ -543,7 +519,7 @@ class GetCertificateAuthorityRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificateAuthoritiesRequest(proto.Message): @@ -577,15 +553,11 @@ class ListCertificateAuthoritiesRequest(proto.Message): sorted. """ - 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 ListCertificateAuthoritiesResponse(proto.Message): @@ -612,10 +584,8 @@ def raw_page(self): certificate_authorities = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CertificateAuthority, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class UndeleteCertificateAuthorityRequest(proto.Message): @@ -649,9 +619,8 @@ class UndeleteCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class DeleteCertificateAuthorityRequest(proto.Message): @@ -690,11 +659,9 @@ class DeleteCertificateAuthorityRequest(proto.Message): certs. """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) - - ignore_active_certificates = proto.Field(proto.BOOL, number=4) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) + ignore_active_certificates = proto.Field(proto.BOOL, number=4,) class UpdateCertificateAuthorityRequest(proto.Message): @@ -733,10 +700,10 @@ class UpdateCertificateAuthorityRequest(proto.Message): certificate_authority = proto.Field( proto.MESSAGE, number=1, message=resources.CertificateAuthority, ) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class CreateCaPoolRequest(proto.Message): @@ -776,13 +743,10 @@ class CreateCaPoolRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1) - - ca_pool_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + ca_pool_id = proto.Field(proto.STRING, number=2,) ca_pool = proto.Field(proto.MESSAGE, number=3, message=resources.CaPool,) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class UpdateCaPoolRequest(proto.Message): @@ -819,10 +783,10 @@ class UpdateCaPoolRequest(proto.Message): """ ca_pool = proto.Field(proto.MESSAGE, number=1, message=resources.CaPool,) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class DeleteCaPoolRequest(proto.Message): @@ -855,9 +819,8 @@ class DeleteCaPoolRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class FetchCaCertsRequest(proto.Message): @@ -890,9 +853,8 @@ class FetchCaCertsRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - ca_pool = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + ca_pool = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class FetchCaCertsResponse(proto.Message): @@ -910,14 +872,13 @@ class FetchCaCertsResponse(proto.Message): class CertChain(proto.Message): r""" - Attributes: certificates (Sequence[str]): The certificates that form the CA chain, from leaf to root order. """ - certificates = proto.RepeatedField(proto.STRING, number=1) + certificates = proto.RepeatedField(proto.STRING, number=1,) ca_certs = proto.RepeatedField(proto.MESSAGE, number=1, message=CertChain,) @@ -934,7 +895,7 @@ class GetCaPoolRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCaPoolsRequest(proto.Message): @@ -966,15 +927,11 @@ class ListCaPoolsRequest(proto.Message): sorted. """ - 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 ListCaPoolsResponse(proto.Message): @@ -999,10 +956,8 @@ def raw_page(self): return self ca_pools = proto.RepeatedField(proto.MESSAGE, number=1, message=resources.CaPool,) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetCertificateRevocationListRequest(proto.Message): @@ -1018,7 +973,7 @@ class GetCertificateRevocationListRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificateRevocationListsRequest(proto.Message): @@ -1052,15 +1007,11 @@ class ListCertificateRevocationListsRequest(proto.Message): sorted. """ - 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 ListCertificateRevocationListsResponse(proto.Message): @@ -1087,10 +1038,8 @@ def raw_page(self): certificate_revocation_lists = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CertificateRevocationList, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class UpdateCertificateRevocationListRequest(proto.Message): @@ -1129,10 +1078,10 @@ class UpdateCertificateRevocationListRequest(proto.Message): certificate_revocation_list = proto.Field( proto.MESSAGE, number=1, message=resources.CertificateRevocationList, ) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class CreateCertificateTemplateRequest(proto.Message): @@ -1173,15 +1122,12 @@ class CreateCertificateTemplateRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1) - - certificate_template_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + certificate_template_id = proto.Field(proto.STRING, number=2,) certificate_template = proto.Field( proto.MESSAGE, number=3, message=resources.CertificateTemplate, ) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class DeleteCertificateTemplateRequest(proto.Message): @@ -1215,9 +1161,8 @@ class DeleteCertificateTemplateRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class GetCertificateTemplateRequest(proto.Message): @@ -1233,7 +1178,7 @@ class GetCertificateTemplateRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificateTemplatesRequest(proto.Message): @@ -1266,15 +1211,11 @@ class ListCertificateTemplatesRequest(proto.Message): sorted. """ - 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 ListCertificateTemplatesResponse(proto.Message): @@ -1301,10 +1242,8 @@ def raw_page(self): certificate_templates = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CertificateTemplate, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class UpdateCertificateTemplateRequest(proto.Message): @@ -1343,15 +1282,14 @@ class UpdateCertificateTemplateRequest(proto.Message): certificate_template = proto.Field( proto.MESSAGE, number=1, message=resources.CertificateTemplate, ) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class OperationMetadata(proto.Message): r"""Represents the metadata of the long-running operation. - Attributes: create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time the operation was @@ -1379,19 +1317,13 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) - - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) - - target = proto.Field(proto.STRING, number=3) - - verb = proto.Field(proto.STRING, number=4) - - status_message = proto.Field(proto.STRING, number=5) - - requested_cancellation = proto.Field(proto.BOOL, number=6) - - api_version = proto.Field(proto.STRING, number=7) + create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + target = proto.Field(proto.STRING, number=3,) + verb = proto.Field(proto.STRING, number=4,) + status_message = proto.Field(proto.STRING, number=5,) + requested_cancellation = proto.Field(proto.BOOL, number=6,) + api_version = proto.Field(proto.STRING, number=7,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/security/privateca_v1beta1/__init__.py b/google/cloud/security/privateca_v1beta1/__init__.py index 9481b33..9258c1e 100644 --- a/google/cloud/security/privateca_v1beta1/__init__.py +++ b/google/cloud/security/privateca_v1beta1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +15,10 @@ # from .services.certificate_authority_service import CertificateAuthorityServiceClient +from .services.certificate_authority_service import ( + CertificateAuthorityServiceAsyncClient, +) + from .types.resources import Certificate from .types.resources import CertificateAuthority from .types.resources import CertificateConfig @@ -27,11 +30,11 @@ from .types.resources import ReusableConfig from .types.resources import ReusableConfigValues from .types.resources import ReusableConfigWrapper -from .types.resources import RevocationReason from .types.resources import Subject from .types.resources import SubjectAltNames from .types.resources import SubordinateConfig from .types.resources import X509Extension +from .types.resources import RevocationReason from .types.service import ActivateCertificateAuthorityRequest from .types.service import CreateCertificateAuthorityRequest from .types.service import CreateCertificateRequest @@ -59,11 +62,12 @@ from .types.service import UpdateCertificateRequest from .types.service import UpdateCertificateRevocationListRequest - __all__ = ( + "CertificateAuthorityServiceAsyncClient", "ActivateCertificateAuthorityRequest", "Certificate", "CertificateAuthority", + "CertificateAuthorityServiceClient", "CertificateConfig", "CertificateDescription", "CertificateRevocationList", @@ -103,5 +107,4 @@ "UpdateCertificateRequest", "UpdateCertificateRevocationListRequest", "X509Extension", - "CertificateAuthorityServiceClient", ) diff --git a/google/cloud/security/privateca_v1beta1/gapic_metadata.json b/google/cloud/security/privateca_v1beta1/gapic_metadata.json new file mode 100644 index 0000000..3406d51 --- /dev/null +++ b/google/cloud/security/privateca_v1beta1/gapic_metadata.json @@ -0,0 +1,223 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.security.privateca_v1beta1", + "protoPackage": "google.cloud.security.privateca.v1beta1", + "schema": "1.0", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityServiceClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ + "activate_certificate_authority" + ] + }, + "CreateCertificate": { + "methods": [ + "create_certificate" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "create_certificate_authority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disable_certificate_authority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enable_certificate_authority" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetch_certificate_authority_csr" + ] + }, + "GetCertificate": { + "methods": [ + "get_certificate" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "get_certificate_authority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "get_certificate_revocation_list" + ] + }, + "GetReusableConfig": { + "methods": [ + "get_reusable_config" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "list_certificate_authorities" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "list_certificate_revocation_lists" + ] + }, + "ListCertificates": { + "methods": [ + "list_certificates" + ] + }, + "ListReusableConfigs": { + "methods": [ + "list_reusable_configs" + ] + }, + "RestoreCertificateAuthority": { + "methods": [ + "restore_certificate_authority" + ] + }, + "RevokeCertificate": { + "methods": [ + "revoke_certificate" + ] + }, + "ScheduleDeleteCertificateAuthority": { + "methods": [ + "schedule_delete_certificate_authority" + ] + }, + "UpdateCertificate": { + "methods": [ + "update_certificate" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "update_certificate_authority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "update_certificate_revocation_list" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CertificateAuthorityServiceAsyncClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ + "activate_certificate_authority" + ] + }, + "CreateCertificate": { + "methods": [ + "create_certificate" + ] + }, + "CreateCertificateAuthority": { + "methods": [ + "create_certificate_authority" + ] + }, + "DisableCertificateAuthority": { + "methods": [ + "disable_certificate_authority" + ] + }, + "EnableCertificateAuthority": { + "methods": [ + "enable_certificate_authority" + ] + }, + "FetchCertificateAuthorityCsr": { + "methods": [ + "fetch_certificate_authority_csr" + ] + }, + "GetCertificate": { + "methods": [ + "get_certificate" + ] + }, + "GetCertificateAuthority": { + "methods": [ + "get_certificate_authority" + ] + }, + "GetCertificateRevocationList": { + "methods": [ + "get_certificate_revocation_list" + ] + }, + "GetReusableConfig": { + "methods": [ + "get_reusable_config" + ] + }, + "ListCertificateAuthorities": { + "methods": [ + "list_certificate_authorities" + ] + }, + "ListCertificateRevocationLists": { + "methods": [ + "list_certificate_revocation_lists" + ] + }, + "ListCertificates": { + "methods": [ + "list_certificates" + ] + }, + "ListReusableConfigs": { + "methods": [ + "list_reusable_configs" + ] + }, + "RestoreCertificateAuthority": { + "methods": [ + "restore_certificate_authority" + ] + }, + "RevokeCertificate": { + "methods": [ + "revoke_certificate" + ] + }, + "ScheduleDeleteCertificateAuthority": { + "methods": [ + "schedule_delete_certificate_authority" + ] + }, + "UpdateCertificate": { + "methods": [ + "update_certificate" + ] + }, + "UpdateCertificateAuthority": { + "methods": [ + "update_certificate_authority" + ] + }, + "UpdateCertificateRevocationList": { + "methods": [ + "update_certificate_revocation_list" + ] + } + } + } + } + } + } +} diff --git a/google/cloud/security/privateca_v1beta1/services/__init__.py b/google/cloud/security/privateca_v1beta1/services/__init__.py index 42ffdf2..4de6597 100644 --- a/google/cloud/security/privateca_v1beta1/services/__init__.py +++ b/google/cloud/security/privateca_v1beta1/services/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py index d837719..f519622 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import CertificateAuthorityServiceClient from .async_client import CertificateAuthorityServiceAsyncClient diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py index f55d241..409041d 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation # type: ignore @@ -35,10 +33,9 @@ ) from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport from .client import CertificateAuthorityServiceClient @@ -77,35 +74,30 @@ class CertificateAuthorityServiceAsyncClient: parse_reusable_config_path = staticmethod( CertificateAuthorityServiceClient.parse_reusable_config_path ) - common_billing_account_path = staticmethod( CertificateAuthorityServiceClient.common_billing_account_path ) parse_common_billing_account_path = staticmethod( CertificateAuthorityServiceClient.parse_common_billing_account_path ) - common_folder_path = staticmethod( CertificateAuthorityServiceClient.common_folder_path ) parse_common_folder_path = staticmethod( CertificateAuthorityServiceClient.parse_common_folder_path ) - common_organization_path = staticmethod( CertificateAuthorityServiceClient.common_organization_path ) parse_common_organization_path = staticmethod( CertificateAuthorityServiceClient.parse_common_organization_path ) - common_project_path = staticmethod( CertificateAuthorityServiceClient.common_project_path ) parse_common_project_path = staticmethod( CertificateAuthorityServiceClient.parse_common_project_path ) - common_location_path = staticmethod( CertificateAuthorityServiceClient.common_location_path ) @@ -115,7 +107,8 @@ class CertificateAuthorityServiceAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -130,7 +123,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -147,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> CertificateAuthorityServiceTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: CertificateAuthorityServiceTransport: The transport used by the client instance. @@ -162,12 +155,12 @@ def transport(self) -> CertificateAuthorityServiceTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the certificate authority service client. + """Instantiates the certificate authority service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -199,7 +192,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = CertificateAuthorityServiceClient( credentials=credentials, transport=transport, @@ -258,7 +250,6 @@ async def create_certificate( This corresponds to the ``certificate_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -285,7 +276,6 @@ async def create_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate is not None: @@ -339,7 +329,6 @@ async def get_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -366,7 +355,6 @@ async def get_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -416,7 +404,6 @@ async def list_certificates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -446,7 +433,6 @@ async def list_certificates( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -501,7 +487,6 @@ async def revoke_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -528,7 +513,6 @@ async def revoke_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -557,7 +541,7 @@ async def update_certificate( request: service.UpdateCertificateRequest = None, *, certificate: resources.Certificate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -587,7 +571,6 @@ async def update_certificate( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -614,7 +597,6 @@ async def update_certificate( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate is not None: request.certificate = certificate if update_mask is not None: @@ -675,7 +657,6 @@ async def activate_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -707,7 +688,6 @@ async def activate_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -782,7 +762,6 @@ async def create_certificate_authority( This corresponds to the ``certificate_authority_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -816,7 +795,6 @@ async def create_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_authority is not None: @@ -877,7 +855,6 @@ async def disable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -909,7 +886,6 @@ async def disable_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -966,7 +942,6 @@ async def enable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -998,7 +973,6 @@ async def enable_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1064,7 +1038,6 @@ async def fetch_certificate_authority_csr( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1091,7 +1064,6 @@ async def fetch_certificate_authority_csr( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1141,7 +1113,6 @@ async def get_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1171,7 +1142,6 @@ async def get_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1220,7 +1190,6 @@ async def list_certificate_authorities( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1250,7 +1219,6 @@ async def list_certificate_authorities( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1306,7 +1274,6 @@ async def restore_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1338,7 +1305,6 @@ async def restore_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1396,7 +1362,6 @@ async def schedule_delete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1428,7 +1393,6 @@ async def schedule_delete_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1465,7 +1429,7 @@ async def update_certificate_authority( request: service.UpdateCertificateAuthorityRequest = None, *, certificate_authority: resources.CertificateAuthority = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1492,7 +1456,6 @@ async def update_certificate_authority( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1524,7 +1487,6 @@ async def update_certificate_authority( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_authority is not None: request.certificate_authority = certificate_authority if update_mask is not None: @@ -1586,7 +1548,6 @@ async def get_certificate_revocation_list( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1615,7 +1576,6 @@ async def get_certificate_revocation_list( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1665,7 +1625,6 @@ async def list_certificate_revocation_lists( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1695,7 +1654,6 @@ async def list_certificate_revocation_lists( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1730,7 +1688,7 @@ async def update_certificate_revocation_list( request: service.UpdateCertificateRevocationListRequest = None, *, certificate_revocation_list: resources.CertificateRevocationList = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1757,7 +1715,6 @@ async def update_certificate_revocation_list( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1788,7 +1745,6 @@ async def update_certificate_revocation_list( # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_revocation_list is not None: request.certificate_revocation_list = certificate_revocation_list if update_mask is not None: @@ -1852,7 +1808,6 @@ async def get_reusable_config( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1882,7 +1837,6 @@ async def get_reusable_config( # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1931,7 +1885,6 @@ async def list_reusable_configs( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1961,7 +1914,6 @@ async def list_reusable_configs( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py index f48b187..4187da0 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore @@ -39,10 +37,9 @@ ) from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import CertificateAuthorityServiceGrpcTransport from .transports.grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport @@ -67,7 +64,7 @@ class CertificateAuthorityServiceClientMeta(type): def get_transport_class( cls, label: str = None, ) -> Type[CertificateAuthorityServiceTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -95,7 +92,8 @@ class CertificateAuthorityServiceClient( @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. + """Converts api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. Args: @@ -129,7 +127,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -146,7 +145,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -165,10 +164,11 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> CertificateAuthorityServiceTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - CertificateAuthorityServiceTransport: The transport used by the client instance. + CertificateAuthorityServiceTransport: The transport used by the client + instance. """ return self._transport @@ -176,7 +176,7 @@ def transport(self) -> CertificateAuthorityServiceTransport: def certificate_path( project: str, location: str, certificate_authority: str, certificate: str, ) -> str: - """Return a fully-qualified certificate string.""" + """Returns a fully-qualified certificate string.""" return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format( project=project, location=location, @@ -186,7 +186,7 @@ def certificate_path( @staticmethod def parse_certificate_path(path: str) -> Dict[str, str]: - """Parse a certificate path into its component segments.""" + """Parses a certificate path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificates/(?P.+?)$", path, @@ -197,7 +197,7 @@ def parse_certificate_path(path: str) -> Dict[str, str]: def certificate_authority_path( project: str, location: str, certificate_authority: str, ) -> str: - """Return a fully-qualified certificate_authority string.""" + """Returns a fully-qualified certificate_authority string.""" return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}".format( project=project, location=location, @@ -206,7 +206,7 @@ def certificate_authority_path( @staticmethod def parse_certificate_authority_path(path: str) -> Dict[str, str]: - """Parse a certificate_authority path into its component segments.""" + """Parses a certificate_authority path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)$", path, @@ -220,7 +220,7 @@ def certificate_revocation_list_path( certificate_authority: str, certificate_revocation_list: str, ) -> str: - """Return a fully-qualified certificate_revocation_list string.""" + """Returns a fully-qualified certificate_revocation_list string.""" return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}".format( project=project, location=location, @@ -230,7 +230,7 @@ def certificate_revocation_list_path( @staticmethod def parse_certificate_revocation_list_path(path: str) -> Dict[str, str]: - """Parse a certificate_revocation_list path into its component segments.""" + """Parses a certificate_revocation_list path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificateRevocationLists/(?P.+?)$", path, @@ -239,14 +239,14 @@ def parse_certificate_revocation_list_path(path: str) -> Dict[str, str]: @staticmethod def reusable_config_path(project: str, location: str, reusable_config: str,) -> str: - """Return a fully-qualified reusable_config string.""" + """Returns a fully-qualified reusable_config string.""" return "projects/{project}/locations/{location}/reusableConfigs/{reusable_config}".format( project=project, location=location, reusable_config=reusable_config, ) @staticmethod def parse_reusable_config_path(path: str) -> Dict[str, str]: - """Parse a reusable_config path into its component segments.""" + """Parses a reusable_config path into its component segments.""" m = re.match( r"^projects/(?P.+?)/locations/(?P.+?)/reusableConfigs/(?P.+?)$", path, @@ -255,7 +255,7 @@ def parse_reusable_config_path(path: str) -> Dict[str, str]: @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -268,7 +268,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -279,7 +279,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -290,7 +290,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -301,7 +301,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -315,12 +315,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, CertificateAuthorityServiceTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the certificate authority service client. + """Instantiates the certificate authority service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -375,9 +375,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -389,12 +390,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -409,8 +412,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -476,7 +479,6 @@ def create_certificate( This corresponds to the ``certificate_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -505,10 +507,8 @@ def create_certificate( # there are no flattened fields. if not isinstance(request, service.CreateCertificateRequest): request = service.CreateCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate is not None: @@ -558,7 +558,6 @@ def get_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -587,10 +586,8 @@ def get_certificate( # there are no flattened fields. if not isinstance(request, service.GetCertificateRequest): request = service.GetCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -636,7 +633,6 @@ def list_certificates( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -668,10 +664,8 @@ def list_certificates( # there are no flattened fields. if not isinstance(request, service.ListCertificatesRequest): request = service.ListCertificatesRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -722,7 +716,6 @@ def revoke_certificate( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -751,10 +744,8 @@ def revoke_certificate( # there are no flattened fields. if not isinstance(request, service.RevokeCertificateRequest): request = service.RevokeCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -779,7 +770,7 @@ def update_certificate( request: service.UpdateCertificateRequest = None, *, certificate: resources.Certificate = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -809,7 +800,6 @@ def update_certificate( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -838,10 +828,8 @@ def update_certificate( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateRequest): request = service.UpdateCertificateRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate is not None: request.certificate = certificate if update_mask is not None: @@ -898,7 +886,6 @@ def activate_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -932,10 +919,8 @@ def activate_certificate_authority( # there are no flattened fields. if not isinstance(request, service.ActivateCertificateAuthorityRequest): request = service.ActivateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1008,7 +993,6 @@ def create_certificate_authority( This corresponds to the ``certificate_authority_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1044,10 +1028,8 @@ def create_certificate_authority( # there are no flattened fields. if not isinstance(request, service.CreateCertificateAuthorityRequest): request = service.CreateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent if certificate_authority is not None: @@ -1106,7 +1088,6 @@ def disable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1140,10 +1121,8 @@ def disable_certificate_authority( # there are no flattened fields. if not isinstance(request, service.DisableCertificateAuthorityRequest): request = service.DisableCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1198,7 +1177,6 @@ def enable_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1232,10 +1210,8 @@ def enable_certificate_authority( # there are no flattened fields. if not isinstance(request, service.EnableCertificateAuthorityRequest): request = service.EnableCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1299,7 +1275,6 @@ def fetch_certificate_authority_csr( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1328,10 +1303,8 @@ def fetch_certificate_authority_csr( # there are no flattened fields. if not isinstance(request, service.FetchCertificateAuthorityCsrRequest): request = service.FetchCertificateAuthorityCsrRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1379,7 +1352,6 @@ def get_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1411,10 +1383,8 @@ def get_certificate_authority( # there are no flattened fields. if not isinstance(request, service.GetCertificateAuthorityRequest): request = service.GetCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1461,7 +1431,6 @@ def list_certificate_authorities( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1493,10 +1462,8 @@ def list_certificate_authorities( # there are no flattened fields. if not isinstance(request, service.ListCertificateAuthoritiesRequest): request = service.ListCertificateAuthoritiesRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1550,7 +1517,6 @@ def restore_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1584,10 +1550,8 @@ def restore_certificate_authority( # there are no flattened fields. if not isinstance(request, service.RestoreCertificateAuthorityRequest): request = service.RestoreCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1643,7 +1607,6 @@ def schedule_delete_certificate_authority( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1677,10 +1640,8 @@ def schedule_delete_certificate_authority( # there are no flattened fields. if not isinstance(request, service.ScheduleDeleteCertificateAuthorityRequest): request = service.ScheduleDeleteCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1715,7 +1676,7 @@ def update_certificate_authority( request: service.UpdateCertificateAuthorityRequest = None, *, certificate_authority: resources.CertificateAuthority = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1742,7 +1703,6 @@ def update_certificate_authority( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1776,10 +1736,8 @@ def update_certificate_authority( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateAuthorityRequest): request = service.UpdateCertificateAuthorityRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_authority is not None: request.certificate_authority = certificate_authority if update_mask is not None: @@ -1839,7 +1797,6 @@ def get_certificate_revocation_list( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1870,10 +1827,8 @@ def get_certificate_revocation_list( # there are no flattened fields. if not isinstance(request, service.GetCertificateRevocationListRequest): request = service.GetCertificateRevocationListRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -1921,7 +1876,6 @@ def list_certificate_revocation_lists( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1953,10 +1907,8 @@ def list_certificate_revocation_lists( # there are no flattened fields. if not isinstance(request, service.ListCertificateRevocationListsRequest): request = service.ListCertificateRevocationListsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -1989,7 +1941,7 @@ def update_certificate_revocation_list( request: service.UpdateCertificateRevocationListRequest = None, *, certificate_revocation_list: resources.CertificateRevocationList = None, - update_mask: field_mask.FieldMask = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -2016,7 +1968,6 @@ def update_certificate_revocation_list( This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2049,10 +2000,8 @@ def update_certificate_revocation_list( # there are no flattened fields. if not isinstance(request, service.UpdateCertificateRevocationListRequest): request = service.UpdateCertificateRevocationListRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if certificate_revocation_list is not None: request.certificate_revocation_list = certificate_revocation_list if update_mask is not None: @@ -2114,7 +2063,6 @@ def get_reusable_config( This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2146,10 +2094,8 @@ def get_reusable_config( # there are no flattened fields. if not isinstance(request, service.GetReusableConfigRequest): request = service.GetReusableConfigRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: request.name = name @@ -2194,7 +2140,6 @@ def list_reusable_configs( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2226,10 +2171,8 @@ def list_reusable_configs( # there are no flattened fields. if not isinstance(request, service.ListReusableConfigsRequest): request = service.ListReusableConfigsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py index f315d76..d8c14ca 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -246,7 +244,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -376,7 +374,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and @@ -506,7 +504,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py index 3a3aa46..ab66300 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py index 3f444e1..e47a764 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,27 +39,41 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class CertificateAuthorityServiceTransport(abc.ABC): """Abstract transport class for CertificateAuthorityService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + DEFAULT_HOST: str = "privateca.googleapis.com" + def __init__( self, *, - host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -69,7 +82,7 @@ def __init__( credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is mutually exclusive with credentials. - scope (Optional[Sequence[str]]): A list of scopes. + scopes (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -83,29 +96,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -207,29 +267,29 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def create_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def get_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def list_certificates( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificatesRequest], - typing.Union[ + Union[ service.ListCertificatesResponse, - typing.Awaitable[service.ListCertificatesResponse], + Awaitable[service.ListCertificatesResponse], ], ]: raise NotImplementedError() @@ -237,65 +297,65 @@ def list_certificates( @property def revoke_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.RevokeCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def update_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateRequest], - typing.Union[resources.Certificate, typing.Awaitable[resources.Certificate]], + Union[resources.Certificate, Awaitable[resources.Certificate]], ]: raise NotImplementedError() @property def activate_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ActivateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def create_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.CreateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def disable_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.DisableCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def enable_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.EnableCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def fetch_certificate_authority_csr( self, - ) -> typing.Callable[ + ) -> Callable[ [service.FetchCertificateAuthorityCsrRequest], - typing.Union[ + Union[ service.FetchCertificateAuthorityCsrResponse, - typing.Awaitable[service.FetchCertificateAuthorityCsrResponse], + Awaitable[service.FetchCertificateAuthorityCsrResponse], ], ]: raise NotImplementedError() @@ -303,11 +363,10 @@ def fetch_certificate_authority_csr( @property def get_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateAuthorityRequest], - typing.Union[ - resources.CertificateAuthority, - typing.Awaitable[resources.CertificateAuthority], + Union[ + resources.CertificateAuthority, Awaitable[resources.CertificateAuthority] ], ]: raise NotImplementedError() @@ -315,11 +374,11 @@ def get_certificate_authority( @property def list_certificate_authorities( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificateAuthoritiesRequest], - typing.Union[ + Union[ service.ListCertificateAuthoritiesResponse, - typing.Awaitable[service.ListCertificateAuthoritiesResponse], + Awaitable[service.ListCertificateAuthoritiesResponse], ], ]: raise NotImplementedError() @@ -327,38 +386,38 @@ def list_certificate_authorities( @property def restore_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.RestoreCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def schedule_delete_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ScheduleDeleteCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_certificate_authority( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateAuthorityRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def get_certificate_revocation_list( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetCertificateRevocationListRequest], - typing.Union[ + Union[ resources.CertificateRevocationList, - typing.Awaitable[resources.CertificateRevocationList], + Awaitable[resources.CertificateRevocationList], ], ]: raise NotImplementedError() @@ -366,11 +425,11 @@ def get_certificate_revocation_list( @property def list_certificate_revocation_lists( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListCertificateRevocationListsRequest], - typing.Union[ + Union[ service.ListCertificateRevocationListsResponse, - typing.Awaitable[service.ListCertificateRevocationListsResponse], + Awaitable[service.ListCertificateRevocationListsResponse], ], ]: raise NotImplementedError() @@ -378,31 +437,29 @@ def list_certificate_revocation_lists( @property def update_certificate_revocation_list( self, - ) -> typing.Callable[ + ) -> Callable[ [service.UpdateCertificateRevocationListRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def get_reusable_config( self, - ) -> typing.Callable[ + ) -> Callable[ [service.GetReusableConfigRequest], - typing.Union[ - resources.ReusableConfig, typing.Awaitable[resources.ReusableConfig] - ], + Union[resources.ReusableConfig, Awaitable[resources.ReusableConfig]], ]: raise NotImplementedError() @property def list_reusable_configs( self, - ) -> typing.Callable[ + ) -> Callable[ [service.ListReusableConfigsRequest], - typing.Union[ + Union[ service.ListReusableConfigsResponse, - typing.Awaitable[service.ListReusableConfigsResponse], + Awaitable[service.ListReusableConfigsResponse], ], ]: raise NotImplementedError() diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py index 81f9aca..dfbd38f 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO @@ -55,7 +52,7 @@ def __init__( self, *, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -69,7 +66,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -180,7 +178,7 @@ def __init__( def create_channel( cls, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -211,13 +209,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -384,7 +384,9 @@ def update_certificate( @property def activate_certificate_authority( self, - ) -> Callable[[service.ActivateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.ActivateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the activate certificate authority method over gRPC. Activate a @@ -414,14 +416,16 @@ def activate_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority", request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["activate_certificate_authority"] @property def create_certificate_authority( self, - ) -> Callable[[service.CreateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.CreateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the create certificate authority method over gRPC. Create a new @@ -442,14 +446,16 @@ def create_certificate_authority( self._stubs["create_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificateAuthority", request_serializer=service.CreateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_authority"] @property def disable_certificate_authority( self, - ) -> Callable[[service.DisableCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.DisableCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the disable certificate authority method over gRPC. Disable a @@ -471,14 +477,16 @@ def disable_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority", request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["disable_certificate_authority"] @property def enable_certificate_authority( self, - ) -> Callable[[service.EnableCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.EnableCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the enable certificate authority method over gRPC. Enable a @@ -498,7 +506,7 @@ def enable_certificate_authority( self._stubs["enable_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/EnableCertificateAuthority", request_serializer=service.EnableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["enable_certificate_authority"] @@ -606,7 +614,9 @@ def list_certificate_authorities( @property def restore_certificate_authority( self, - ) -> Callable[[service.RestoreCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.RestoreCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the restore certificate authority method over gRPC. Restore a @@ -629,7 +639,7 @@ def restore_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority", request_serializer=service.RestoreCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["restore_certificate_authority"] @@ -637,7 +647,7 @@ def restore_certificate_authority( def schedule_delete_certificate_authority( self, ) -> Callable[ - [service.ScheduleDeleteCertificateAuthorityRequest], operations.Operation + [service.ScheduleDeleteCertificateAuthorityRequest], operations_pb2.Operation ]: r"""Return a callable for the schedule delete certificate authority method over gRPC. @@ -662,14 +672,16 @@ def schedule_delete_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority", request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["schedule_delete_certificate_authority"] @property def update_certificate_authority( self, - ) -> Callable[[service.UpdateCertificateAuthorityRequest], operations.Operation]: + ) -> Callable[ + [service.UpdateCertificateAuthorityRequest], operations_pb2.Operation + ]: r"""Return a callable for the update certificate authority method over gRPC. Update a @@ -689,7 +701,7 @@ def update_certificate_authority( self._stubs["update_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateAuthority", request_serializer=service.UpdateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_authority"] @@ -763,7 +775,7 @@ def list_certificate_revocation_lists( def update_certificate_revocation_list( self, ) -> Callable[ - [service.UpdateCertificateRevocationListRequest], operations.Operation + [service.UpdateCertificateRevocationListRequest], operations_pb2.Operation ]: r"""Return a callable for the update certificate revocation list method over gRPC. @@ -787,7 +799,7 @@ def update_certificate_revocation_list( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList", request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_revocation_list"] diff --git a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py index 9b6a1e5..88f8ced 100644 --- a/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py +++ b/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO from .grpc import CertificateAuthorityServiceGrpcTransport @@ -60,7 +57,7 @@ class CertificateAuthorityServiceGrpcAsyncIOTransport( def create_channel( cls, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -87,13 +84,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -101,7 +100,7 @@ def __init__( self, *, host: str = "privateca.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -115,7 +114,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -174,7 +174,6 @@ def __init__( # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - else: if api_mtls_endpoint: host = api_mtls_endpoint @@ -395,7 +394,8 @@ def update_certificate( def activate_certificate_authority( self, ) -> Callable[ - [service.ActivateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.ActivateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the activate certificate authority method over gRPC. @@ -426,7 +426,7 @@ def activate_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority", request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["activate_certificate_authority"] @@ -434,7 +434,7 @@ def activate_certificate_authority( def create_certificate_authority( self, ) -> Callable[ - [service.CreateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.CreateCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create certificate authority method over gRPC. @@ -456,7 +456,7 @@ def create_certificate_authority( self._stubs["create_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificateAuthority", request_serializer=service.CreateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_certificate_authority"] @@ -464,7 +464,8 @@ def create_certificate_authority( def disable_certificate_authority( self, ) -> Callable[ - [service.DisableCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.DisableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the disable certificate authority method over gRPC. @@ -487,7 +488,7 @@ def disable_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority", request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["disable_certificate_authority"] @@ -495,7 +496,7 @@ def disable_certificate_authority( def enable_certificate_authority( self, ) -> Callable[ - [service.EnableCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.EnableCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the enable certificate authority method over gRPC. @@ -516,7 +517,7 @@ def enable_certificate_authority( self._stubs["enable_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/EnableCertificateAuthority", request_serializer=service.EnableCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["enable_certificate_authority"] @@ -626,7 +627,8 @@ def list_certificate_authorities( def restore_certificate_authority( self, ) -> Callable[ - [service.RestoreCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.RestoreCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the restore certificate authority method over gRPC. @@ -650,7 +652,7 @@ def restore_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority", request_serializer=service.RestoreCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["restore_certificate_authority"] @@ -659,7 +661,7 @@ def schedule_delete_certificate_authority( self, ) -> Callable[ [service.ScheduleDeleteCertificateAuthorityRequest], - Awaitable[operations.Operation], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the schedule delete certificate authority method over gRPC. @@ -684,7 +686,7 @@ def schedule_delete_certificate_authority( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority", request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["schedule_delete_certificate_authority"] @@ -692,7 +694,7 @@ def schedule_delete_certificate_authority( def update_certificate_authority( self, ) -> Callable[ - [service.UpdateCertificateAuthorityRequest], Awaitable[operations.Operation] + [service.UpdateCertificateAuthorityRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the update certificate authority method over gRPC. @@ -713,7 +715,7 @@ def update_certificate_authority( self._stubs["update_certificate_authority"] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateAuthority", request_serializer=service.UpdateCertificateAuthorityRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_authority"] @@ -788,7 +790,7 @@ def update_certificate_revocation_list( self, ) -> Callable[ [service.UpdateCertificateRevocationListRequest], - Awaitable[operations.Operation], + Awaitable[operations_pb2.Operation], ]: r"""Return a callable for the update certificate revocation list method over gRPC. @@ -812,7 +814,7 @@ def update_certificate_revocation_list( ] = self.grpc_channel.unary_unary( "/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList", request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_certificate_revocation_list"] diff --git a/google/cloud/security/privateca_v1beta1/types/__init__.py b/google/cloud/security/privateca_v1beta1/types/__init__.py index 81ae506..af03f43 100644 --- a/google/cloud/security/privateca_v1beta1/types/__init__.py +++ b/google/cloud/security/privateca_v1beta1/types/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .resources import ( Certificate, CertificateAuthority, diff --git a/google/cloud/security/privateca_v1beta1/types/resources.py b/google/cloud/security/privateca_v1beta1/types/resources.py index c045068..d8ebf2c 100644 --- a/google/cloud/security/privateca_v1beta1/types/resources.py +++ b/google/cloud/security/privateca_v1beta1/types/resources.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore __protobuf__ = proto.module( @@ -244,9 +241,8 @@ class IssuingOptions(proto.Message): certificate is revoked. """ - include_ca_cert_url = proto.Field(proto.BOOL, number=1) - - include_crl_access_url = proto.Field(proto.BOOL, number=2) + include_ca_cert_url = proto.Field(proto.BOOL, number=1,) + include_crl_access_url = proto.Field(proto.BOOL, number=2,) class CertificateAuthorityPolicy(proto.Message): r"""The issuing policy for a @@ -323,7 +319,6 @@ class CertificateAuthorityPolicy(proto.Message): class AllowedConfigList(proto.Message): r""" - Attributes: allowed_config_values (Sequence[google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper]): Required. All @@ -385,17 +380,12 @@ class AllowedSubjectAltNames(proto.Message): X509Extension values. """ - allowed_dns_names = proto.RepeatedField(proto.STRING, number=1) - - allowed_uris = proto.RepeatedField(proto.STRING, number=2) - - allowed_email_addresses = proto.RepeatedField(proto.STRING, number=3) - - allowed_ips = proto.RepeatedField(proto.STRING, number=4) - - allow_globbing_dns_wildcards = proto.Field(proto.BOOL, number=5) - - allow_custom_sans = proto.Field(proto.BOOL, number=6) + allowed_dns_names = proto.RepeatedField(proto.STRING, number=1,) + allowed_uris = proto.RepeatedField(proto.STRING, number=2,) + allowed_email_addresses = proto.RepeatedField(proto.STRING, number=3,) + allowed_ips = proto.RepeatedField(proto.STRING, number=4,) + allow_globbing_dns_wildcards = proto.Field(proto.BOOL, number=5,) + allow_custom_sans = proto.Field(proto.BOOL, number=6,) class IssuanceModes(proto.Message): r"""[IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] @@ -416,9 +406,8 @@ class IssuanceModes(proto.Message): [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig]. """ - allow_csr_based_issuance = proto.Field(proto.BOOL, number=1) - - allow_config_based_issuance = proto.Field(proto.BOOL, number=2) + allow_csr_based_issuance = proto.Field(proto.BOOL, number=1,) + allow_config_based_issuance = proto.Field(proto.BOOL, number=2,) allowed_config_list = proto.Field( proto.MESSAGE, @@ -426,30 +415,24 @@ class IssuanceModes(proto.Message): oneof="config_policy", message="CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList", ) - overwrite_config_values = proto.Field( proto.MESSAGE, number=2, oneof="config_policy", message="ReusableConfigWrapper", ) - allowed_locations_and_organizations = proto.RepeatedField( proto.MESSAGE, number=3, message="Subject", ) - - allowed_common_names = proto.RepeatedField(proto.STRING, number=4) - + allowed_common_names = proto.RepeatedField(proto.STRING, number=4,) allowed_sans = proto.Field( proto.MESSAGE, number=5, message="CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames", ) - maximum_lifetime = proto.Field( - proto.MESSAGE, number=6, message=duration.Duration, + proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - allowed_issuance_modes = proto.Field( proto.MESSAGE, number=8, @@ -474,9 +457,8 @@ class AccessUrls(proto.Message): been activated. """ - ca_certificate_access_url = proto.Field(proto.STRING, number=1) - - crl_access_url = proto.Field(proto.STRING, number=2) + ca_certificate_access_url = proto.Field(proto.STRING, number=1,) + crl_access_url = proto.Field(proto.STRING, number=2,) class KeyVersionSpec(proto.Message): r"""A Cloud KMS key configuration that a @@ -498,8 +480,7 @@ class KeyVersionSpec(proto.Message): ``HSM``. """ - cloud_kms_key_version = proto.Field(proto.STRING, number=1, oneof="KeyVersion") - + cloud_kms_key_version = proto.Field(proto.STRING, number=1, oneof="KeyVersion",) algorithm = proto.Field( proto.ENUM, number=2, @@ -507,47 +488,36 @@ class KeyVersionSpec(proto.Message): enum="CertificateAuthority.SignHashAlgorithm", ) - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) type_ = proto.Field(proto.ENUM, number=2, enum=Type,) - tier = proto.Field(proto.ENUM, number=3, enum=Tier,) - config = proto.Field(proto.MESSAGE, number=4, message="CertificateConfig",) - - lifetime = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - + lifetime = proto.Field(proto.MESSAGE, number=5, message=duration_pb2.Duration,) key_spec = proto.Field(proto.MESSAGE, number=6, message=KeyVersionSpec,) - certificate_policy = proto.Field( proto.MESSAGE, number=7, message=CertificateAuthorityPolicy, ) - issuing_options = proto.Field(proto.MESSAGE, number=8, message=IssuingOptions,) - subordinate_config = proto.Field( proto.MESSAGE, number=19, message="SubordinateConfig", ) - state = proto.Field(proto.ENUM, number=10, enum=State,) - - pem_ca_certificates = proto.RepeatedField(proto.STRING, number=9) - + pem_ca_certificates = proto.RepeatedField(proto.STRING, number=9,) ca_certificate_descriptions = proto.RepeatedField( proto.MESSAGE, number=12, message="CertificateDescription", ) - - gcs_bucket = proto.Field(proto.STRING, number=13) - + gcs_bucket = proto.Field(proto.STRING, number=13,) access_urls = proto.Field(proto.MESSAGE, number=14, message=AccessUrls,) - - create_time = proto.Field(proto.MESSAGE, number=15, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=16, message=timestamp.Timestamp,) - - delete_time = proto.Field(proto.MESSAGE, number=17, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=18) + create_time = proto.Field( + proto.MESSAGE, number=15, message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, number=16, message=timestamp_pb2.Timestamp, + ) + delete_time = proto.Field( + proto.MESSAGE, number=17, message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField(proto.STRING, proto.STRING, number=18,) class CertificateRevocationList(proto.Message): @@ -618,31 +588,21 @@ class RevokedCertificate(proto.Message): was revoked. """ - certificate = proto.Field(proto.STRING, number=1) - - hex_serial_number = proto.Field(proto.STRING, number=2) - + certificate = proto.Field(proto.STRING, number=1,) + hex_serial_number = proto.Field(proto.STRING, number=2,) revocation_reason = proto.Field(proto.ENUM, number=3, enum="RevocationReason",) - name = proto.Field(proto.STRING, number=1) - - sequence_number = proto.Field(proto.INT64, number=2) - + name = proto.Field(proto.STRING, number=1,) + sequence_number = proto.Field(proto.INT64, number=2,) revoked_certificates = proto.RepeatedField( proto.MESSAGE, number=3, message=RevokedCertificate, ) - - pem_crl = proto.Field(proto.STRING, number=4) - - access_url = proto.Field(proto.STRING, number=5) - + pem_crl = proto.Field(proto.STRING, number=4,) + access_url = proto.Field(proto.STRING, number=5,) state = proto.Field(proto.ENUM, number=6, enum=State,) - - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=9) + create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) + labels = proto.MapField(proto.STRING, proto.STRING, number=9,) class Certificate(proto.Message): @@ -712,41 +672,32 @@ class RevocationDetails(proto.Message): """ revocation_state = proto.Field(proto.ENUM, number=1, enum="RevocationReason",) - revocation_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp.Timestamp, + proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - name = proto.Field(proto.STRING, number=1) - - pem_csr = proto.Field(proto.STRING, number=2, oneof="certificate_config") - + name = proto.Field(proto.STRING, number=1,) + pem_csr = proto.Field(proto.STRING, number=2, oneof="certificate_config",) config = proto.Field( proto.MESSAGE, number=3, oneof="certificate_config", message="CertificateConfig", ) - - lifetime = proto.Field(proto.MESSAGE, number=4, message=duration.Duration,) - + lifetime = proto.Field(proto.MESSAGE, number=4, message=duration_pb2.Duration,) revocation_details = proto.Field( proto.MESSAGE, number=5, message=RevocationDetails, ) - - pem_certificate = proto.Field(proto.STRING, number=6) - + pem_certificate = proto.Field(proto.STRING, number=6,) certificate_description = proto.Field( proto.MESSAGE, number=7, message="CertificateDescription", ) - - pem_certificate_chain = proto.RepeatedField(proto.STRING, number=8) - - create_time = proto.Field(proto.MESSAGE, number=9, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=10, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=11) + pem_certificate_chain = proto.RepeatedField(proto.STRING, number=8,) + create_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,) + update_time = proto.Field( + proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField(proto.STRING, proto.STRING, number=11,) class ReusableConfig(proto.Message): @@ -781,17 +732,12 @@ class ReusableConfig(proto.Message): Optional. Labels with user-defined metadata. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) values = proto.Field(proto.MESSAGE, number=2, message="ReusableConfigValues",) - - description = proto.Field(proto.STRING, number=3) - - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp.Timestamp,) - - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) - - labels = proto.MapField(proto.STRING, proto.STRING, number=6) + description = proto.Field(proto.STRING, number=3,) + create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) + labels = proto.MapField(proto.STRING, proto.STRING, number=6,) class ReusableConfigValues(proto.Message): @@ -824,7 +770,6 @@ class ReusableConfigValues(proto.Message): class CaOptions(proto.Message): r"""Describes values that are relevant in a CA certificate. - Attributes: is_ca (google.protobuf.wrappers_pb2.BoolValue): Optional. Refers to the "CA" X.509 extension, @@ -841,20 +786,15 @@ class CaOptions(proto.Message): length will be omitted from the CA certificate. """ - is_ca = proto.Field(proto.MESSAGE, number=1, message=wrappers.BoolValue,) - + is_ca = proto.Field(proto.MESSAGE, number=1, message=wrappers_pb2.BoolValue,) max_issuer_path_length = proto.Field( - proto.MESSAGE, number=2, message=wrappers.Int32Value, + proto.MESSAGE, number=2, message=wrappers_pb2.Int32Value, ) key_usage = proto.Field(proto.MESSAGE, number=1, message="KeyUsage",) - ca_options = proto.Field(proto.MESSAGE, number=2, message=CaOptions,) - policy_ids = proto.RepeatedField(proto.MESSAGE, number=3, message="ObjectId",) - - aia_ocsp_servers = proto.RepeatedField(proto.STRING, number=4) - + aia_ocsp_servers = proto.RepeatedField(proto.STRING, number=4,) additional_extensions = proto.RepeatedField( proto.MESSAGE, number=5, message="X509Extension", ) @@ -876,8 +816,7 @@ class ReusableConfigWrapper(proto.Message): [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. """ - reusable_config = proto.Field(proto.STRING, number=1, oneof="config_values") - + reusable_config = proto.Field(proto.STRING, number=1, oneof="config_values",) reusable_config_values = proto.Field( proto.MESSAGE, number=2, oneof="config_values", message="ReusableConfigValues", ) @@ -915,12 +854,11 @@ class SubordinateConfigChain(proto.Message): order according to RFC 5246. """ - pem_certificates = proto.RepeatedField(proto.STRING, number=1) + pem_certificates = proto.RepeatedField(proto.STRING, number=1,) certificate_authority = proto.Field( - proto.STRING, number=1, oneof="subordinate_config" + proto.STRING, number=1, oneof="subordinate_config", ) - pem_issuer_chain = proto.Field( proto.MESSAGE, number=2, @@ -952,8 +890,7 @@ class KeyType(proto.Enum): PEM_EC_KEY = 2 type_ = proto.Field(proto.ENUM, number=1, enum=KeyType,) - - key = proto.Field(proto.BYTES, number=2) + key = proto.Field(proto.BYTES, number=2,) class CertificateConfig(proto.Message): @@ -997,19 +934,15 @@ class SubjectConfig(proto.Message): """ subject = proto.Field(proto.MESSAGE, number=1, message="Subject",) - - common_name = proto.Field(proto.STRING, number=2) - + common_name = proto.Field(proto.STRING, number=2,) subject_alt_name = proto.Field( proto.MESSAGE, number=3, message="SubjectAltNames", ) subject_config = proto.Field(proto.MESSAGE, number=1, message=SubjectConfig,) - reusable_config = proto.Field( proto.MESSAGE, number=2, message="ReusableConfigWrapper", ) - public_key = proto.Field(proto.MESSAGE, number=3, message="PublicKey",) @@ -1077,23 +1010,17 @@ class SubjectDescription(proto.Message): """ subject = proto.Field(proto.MESSAGE, number=1, message="Subject",) - - common_name = proto.Field(proto.STRING, number=2) - + common_name = proto.Field(proto.STRING, number=2,) subject_alt_name = proto.Field( proto.MESSAGE, number=3, message="SubjectAltNames", ) - - hex_serial_number = proto.Field(proto.STRING, number=4) - - lifetime = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - + hex_serial_number = proto.Field(proto.STRING, number=4,) + lifetime = proto.Field(proto.MESSAGE, number=5, message=duration_pb2.Duration,) not_before_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp.Timestamp, + proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - not_after_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp.Timestamp, + proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) class KeyId(proto.Message): @@ -1107,37 +1034,29 @@ class KeyId(proto.Message): 160 bit SHA-1 hash of the public key. """ - key_id = proto.Field(proto.STRING, number=1) + key_id = proto.Field(proto.STRING, number=1,) class CertificateFingerprint(proto.Message): r"""A group of fingerprints for the x509 certificate. - Attributes: sha256_hash (str): The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate. """ - sha256_hash = proto.Field(proto.STRING, number=1) + sha256_hash = proto.Field(proto.STRING, number=1,) subject_description = proto.Field( proto.MESSAGE, number=1, message=SubjectDescription, ) - config_values = proto.Field( proto.MESSAGE, number=2, message="ReusableConfigValues", ) - public_key = proto.Field(proto.MESSAGE, number=3, message="PublicKey",) - subject_key_id = proto.Field(proto.MESSAGE, number=4, message=KeyId,) - authority_key_id = proto.Field(proto.MESSAGE, number=5, message=KeyId,) - - crl_distribution_points = proto.RepeatedField(proto.STRING, number=6) - - aia_issuing_certificate_urls = proto.RepeatedField(proto.STRING, number=7) - + crl_distribution_points = proto.RepeatedField(proto.STRING, number=6,) + aia_issuing_certificate_urls = proto.RepeatedField(proto.STRING, number=7,) cert_fingerprint = proto.Field( proto.MESSAGE, number=8, message=CertificateFingerprint, ) @@ -1154,7 +1073,7 @@ class ObjectId(proto.Message): significant parts of the path come first. """ - object_id_path = proto.RepeatedField(proto.INT32, number=1) + object_id_path = proto.RepeatedField(proto.INT32, number=1,) class X509Extension(proto.Message): @@ -1176,10 +1095,8 @@ class X509Extension(proto.Message): """ object_id = proto.Field(proto.MESSAGE, number=1, message="ObjectId",) - - critical = proto.Field(proto.BOOL, number=2) - - value = proto.Field(proto.BYTES, number=3) + critical = proto.Field(proto.BOOL, number=2,) + value = proto.Field(proto.BYTES, number=3,) class KeyUsage(proto.Message): @@ -1230,23 +1147,15 @@ class KeyUsageOptions(proto.Message): The key may be used to decipher only. """ - digital_signature = proto.Field(proto.BOOL, number=1) - - content_commitment = proto.Field(proto.BOOL, number=2) - - key_encipherment = proto.Field(proto.BOOL, number=3) - - data_encipherment = proto.Field(proto.BOOL, number=4) - - key_agreement = proto.Field(proto.BOOL, number=5) - - cert_sign = proto.Field(proto.BOOL, number=6) - - crl_sign = proto.Field(proto.BOOL, number=7) - - encipher_only = proto.Field(proto.BOOL, number=8) - - decipher_only = proto.Field(proto.BOOL, number=9) + digital_signature = proto.Field(proto.BOOL, number=1,) + content_commitment = proto.Field(proto.BOOL, number=2,) + key_encipherment = proto.Field(proto.BOOL, number=3,) + data_encipherment = proto.Field(proto.BOOL, number=4,) + key_agreement = proto.Field(proto.BOOL, number=5,) + cert_sign = proto.Field(proto.BOOL, number=6,) + crl_sign = proto.Field(proto.BOOL, number=7,) + encipher_only = proto.Field(proto.BOOL, number=8,) + decipher_only = proto.Field(proto.BOOL, number=9,) class ExtendedKeyUsageOptions(proto.Message): r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] @@ -1281,24 +1190,17 @@ class ExtendedKeyUsageOptions(proto.Message): responses". """ - server_auth = proto.Field(proto.BOOL, number=1) - - client_auth = proto.Field(proto.BOOL, number=2) - - code_signing = proto.Field(proto.BOOL, number=3) - - email_protection = proto.Field(proto.BOOL, number=4) - - time_stamping = proto.Field(proto.BOOL, number=5) - - ocsp_signing = proto.Field(proto.BOOL, number=6) + server_auth = proto.Field(proto.BOOL, number=1,) + client_auth = proto.Field(proto.BOOL, number=2,) + code_signing = proto.Field(proto.BOOL, number=3,) + email_protection = proto.Field(proto.BOOL, number=4,) + time_stamping = proto.Field(proto.BOOL, number=5,) + ocsp_signing = proto.Field(proto.BOOL, number=6,) base_key_usage = proto.Field(proto.MESSAGE, number=1, message=KeyUsageOptions,) - extended_key_usage = proto.Field( proto.MESSAGE, number=2, message=ExtendedKeyUsageOptions, ) - unknown_extended_key_usages = proto.RepeatedField( proto.MESSAGE, number=3, message="ObjectId", ) @@ -1327,19 +1229,13 @@ class Subject(proto.Message): The postal code of the subject. """ - country_code = proto.Field(proto.STRING, number=1) - - organization = proto.Field(proto.STRING, number=2) - - organizational_unit = proto.Field(proto.STRING, number=3) - - locality = proto.Field(proto.STRING, number=4) - - province = proto.Field(proto.STRING, number=5) - - street_address = proto.Field(proto.STRING, number=6) - - postal_code = proto.Field(proto.STRING, number=7) + country_code = proto.Field(proto.STRING, number=1,) + organization = proto.Field(proto.STRING, number=2,) + organizational_unit = proto.Field(proto.STRING, number=3,) + locality = proto.Field(proto.STRING, number=4,) + province = proto.Field(proto.STRING, number=5,) + street_address = proto.Field(proto.STRING, number=6,) + postal_code = proto.Field(proto.STRING, number=7,) class SubjectAltNames(proto.Message): @@ -1365,14 +1261,10 @@ class SubjectAltNames(proto.Message): values. """ - dns_names = proto.RepeatedField(proto.STRING, number=1) - - uris = proto.RepeatedField(proto.STRING, number=2) - - email_addresses = proto.RepeatedField(proto.STRING, number=3) - - ip_addresses = proto.RepeatedField(proto.STRING, number=4) - + dns_names = proto.RepeatedField(proto.STRING, number=1,) + uris = proto.RepeatedField(proto.STRING, number=2,) + email_addresses = proto.RepeatedField(proto.STRING, number=3,) + ip_addresses = proto.RepeatedField(proto.STRING, number=4,) custom_sans = proto.RepeatedField(proto.MESSAGE, number=5, message="X509Extension",) diff --git a/google/cloud/security/privateca_v1beta1/types/service.py b/google/cloud/security/privateca_v1beta1/types/service.py index 1c5977c..8296e84 100644 --- a/google/cloud/security/privateca_v1beta1/types/service.py +++ b/google/cloud/security/privateca_v1beta1/types/service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - from google.cloud.security.privateca_v1beta1.types import resources -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( @@ -101,13 +98,10 @@ class CreateCertificateRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1) - - certificate_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + certificate_id = proto.Field(proto.STRING, number=2,) certificate = proto.Field(proto.MESSAGE, number=3, message=resources.Certificate,) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class GetCertificateRequest(proto.Message): @@ -123,7 +117,7 @@ class GetCertificateRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificatesRequest(proto.Message): @@ -161,15 +155,11 @@ class ListCertificatesRequest(proto.Message): documentation `__. """ - 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 ListCertificatesResponse(proto.Message): @@ -196,10 +186,8 @@ def raw_page(self): certificates = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.Certificate, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class RevokeCertificateRequest(proto.Message): @@ -237,11 +225,9 @@ class RevokeCertificateRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) reason = proto.Field(proto.ENUM, number=2, enum=resources.RevocationReason,) - - request_id = proto.Field(proto.STRING, number=3) + request_id = proto.Field(proto.STRING, number=3,) class UpdateCertificateRequest(proto.Message): @@ -278,10 +264,10 @@ class UpdateCertificateRequest(proto.Message): """ certificate = proto.Field(proto.MESSAGE, number=1, message=resources.Certificate,) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class ActivateCertificateAuthorityRequest(proto.Message): @@ -322,15 +308,12 @@ class ActivateCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - pem_ca_certificate = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + pem_ca_certificate = proto.Field(proto.STRING, number=2,) subordinate_config = proto.Field( proto.MESSAGE, number=3, message=resources.SubordinateConfig, ) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class CreateCertificateAuthorityRequest(proto.Message): @@ -371,15 +354,12 @@ class CreateCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1) - - certificate_authority_id = proto.Field(proto.STRING, number=2) - + parent = proto.Field(proto.STRING, number=1,) + certificate_authority_id = proto.Field(proto.STRING, number=2,) certificate_authority = proto.Field( proto.MESSAGE, number=3, message=resources.CertificateAuthority, ) - - request_id = proto.Field(proto.STRING, number=4) + request_id = proto.Field(proto.STRING, number=4,) class DisableCertificateAuthorityRequest(proto.Message): @@ -413,9 +393,8 @@ class DisableCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class EnableCertificateAuthorityRequest(proto.Message): @@ -449,9 +428,8 @@ class EnableCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class FetchCertificateAuthorityCsrRequest(proto.Message): @@ -466,7 +444,7 @@ class FetchCertificateAuthorityCsrRequest(proto.Message): ``projects/*/locations/*/certificateAuthorities/*``. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class FetchCertificateAuthorityCsrResponse(proto.Message): @@ -479,7 +457,7 @@ class FetchCertificateAuthorityCsrResponse(proto.Message): certificate signing request (CSR). """ - pem_csr = proto.Field(proto.STRING, number=1) + pem_csr = proto.Field(proto.STRING, number=1,) class GetCertificateAuthorityRequest(proto.Message): @@ -495,7 +473,7 @@ class GetCertificateAuthorityRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificateAuthoritiesRequest(proto.Message): @@ -528,15 +506,11 @@ class ListCertificateAuthoritiesRequest(proto.Message): sorted. """ - 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 ListCertificateAuthoritiesResponse(proto.Message): @@ -563,10 +537,8 @@ def raw_page(self): certificate_authorities = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CertificateAuthority, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class RestoreCertificateAuthorityRequest(proto.Message): @@ -600,9 +572,8 @@ class RestoreCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class ScheduleDeleteCertificateAuthorityRequest(proto.Message): @@ -636,9 +607,8 @@ class ScheduleDeleteCertificateAuthorityRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1) - - request_id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + request_id = proto.Field(proto.STRING, number=2,) class UpdateCertificateAuthorityRequest(proto.Message): @@ -677,10 +647,10 @@ class UpdateCertificateAuthorityRequest(proto.Message): certificate_authority = proto.Field( proto.MESSAGE, number=1, message=resources.CertificateAuthority, ) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class GetCertificateRevocationListRequest(proto.Message): @@ -696,7 +666,7 @@ class GetCertificateRevocationListRequest(proto.Message): to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListCertificateRevocationListsRequest(proto.Message): @@ -730,15 +700,11 @@ class ListCertificateRevocationListsRequest(proto.Message): sorted. """ - 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 ListCertificateRevocationListsResponse(proto.Message): @@ -765,10 +731,8 @@ def raw_page(self): certificate_revocation_lists = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CertificateRevocationList, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class UpdateCertificateRevocationListRequest(proto.Message): @@ -807,10 +771,10 @@ class UpdateCertificateRevocationListRequest(proto.Message): certificate_revocation_list = proto.Field( proto.MESSAGE, number=1, message=resources.CertificateRevocationList, ) - - update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) - - request_id = proto.Field(proto.STRING, number=3) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + request_id = proto.Field(proto.STRING, number=3,) class GetReusableConfigRequest(proto.Message): @@ -823,7 +787,7 @@ class GetReusableConfigRequest(proto.Message): [ReusableConfigs][] to get. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class ListReusableConfigsRequest(proto.Message): @@ -856,15 +820,11 @@ class ListReusableConfigsRequest(proto.Message): sorted. """ - 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 ListReusableConfigsResponse(proto.Message): @@ -891,15 +851,12 @@ def raw_page(self): reusable_configs = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.ReusableConfig, ) - - next_page_token = proto.Field(proto.STRING, number=2) - - unreachable = proto.RepeatedField(proto.STRING, number=3) + next_page_token = proto.Field(proto.STRING, number=2,) + unreachable = proto.RepeatedField(proto.STRING, number=3,) class OperationMetadata(proto.Message): r"""Represents the metadata of the long-running operation. - Attributes: create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time the operation was @@ -927,19 +884,13 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) - - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) - - target = proto.Field(proto.STRING, number=3) - - verb = proto.Field(proto.STRING, number=4) - - status_message = proto.Field(proto.STRING, number=5) - - requested_cancellation = proto.Field(proto.BOOL, number=6) - - api_version = proto.Field(proto.STRING, number=7) + create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + target = proto.Field(proto.STRING, number=3,) + verb = proto.Field(proto.STRING, number=4,) + status_message = proto.Field(proto.STRING, number=5,) + requested_cancellation = proto.Field(proto.BOOL, number=6,) + api_version = proto.Field(proto.STRING, number=7,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/scripts/fixup_privateca_v1_keywords.py b/scripts/fixup_privateca_v1_keywords.py index 21095f3..65447c5 100644 --- a/scripts/fixup_privateca_v1_keywords.py +++ b/scripts/fixup_privateca_v1_keywords.py @@ -1,6 +1,5 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import argparse import os import libcst as cst @@ -41,36 +39,35 @@ def partition( class privatecaCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'activate_certificate_authority': ('name', 'pem_ca_certificate', 'subordinate_config', 'request_id', ), - 'create_ca_pool': ('parent', 'ca_pool_id', 'ca_pool', 'request_id', ), - 'create_certificate': ('parent', 'certificate', 'certificate_id', 'request_id', 'validate_only', 'issuing_certificate_authority_id', ), - 'create_certificate_authority': ('parent', 'certificate_authority_id', 'certificate_authority', 'request_id', ), - 'create_certificate_template': ('parent', 'certificate_template_id', 'certificate_template', 'request_id', ), - 'delete_ca_pool': ('name', 'request_id', ), - 'delete_certificate_authority': ('name', 'request_id', 'ignore_active_certificates', ), - 'delete_certificate_template': ('name', 'request_id', ), - 'disable_certificate_authority': ('name', 'request_id', ), - 'enable_certificate_authority': ('name', 'request_id', ), - 'fetch_ca_certs': ('ca_pool', 'request_id', ), - 'fetch_certificate_authority_csr': ('name', ), - 'get_ca_pool': ('name', ), - 'get_certificate': ('name', ), - 'get_certificate_authority': ('name', ), - 'get_certificate_revocation_list': ('name', ), - 'get_certificate_template': ('name', ), - 'list_ca_pools': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificate_authorities': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificate_revocation_lists': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificate_templates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'revoke_certificate': ('name', 'reason', 'request_id', ), - 'undelete_certificate_authority': ('name', 'request_id', ), - 'update_ca_pool': ('ca_pool', 'update_mask', 'request_id', ), - 'update_certificate': ('certificate', 'update_mask', 'request_id', ), - 'update_certificate_authority': ('certificate_authority', 'update_mask', 'request_id', ), - 'update_certificate_revocation_list': ('certificate_revocation_list', 'update_mask', 'request_id', ), - 'update_certificate_template': ('certificate_template', 'update_mask', 'request_id', ), - + 'activate_certificate_authority': ('name', 'pem_ca_certificate', 'subordinate_config', 'request_id', ), + 'create_ca_pool': ('parent', 'ca_pool_id', 'ca_pool', 'request_id', ), + 'create_certificate': ('parent', 'certificate', 'certificate_id', 'request_id', 'validate_only', 'issuing_certificate_authority_id', ), + 'create_certificate_authority': ('parent', 'certificate_authority_id', 'certificate_authority', 'request_id', ), + 'create_certificate_template': ('parent', 'certificate_template_id', 'certificate_template', 'request_id', ), + 'delete_ca_pool': ('name', 'request_id', ), + 'delete_certificate_authority': ('name', 'request_id', 'ignore_active_certificates', ), + 'delete_certificate_template': ('name', 'request_id', ), + 'disable_certificate_authority': ('name', 'request_id', ), + 'enable_certificate_authority': ('name', 'request_id', ), + 'fetch_ca_certs': ('ca_pool', 'request_id', ), + 'fetch_certificate_authority_csr': ('name', ), + 'get_ca_pool': ('name', ), + 'get_certificate': ('name', ), + 'get_certificate_authority': ('name', ), + 'get_certificate_revocation_list': ('name', ), + 'get_certificate_template': ('name', ), + 'list_ca_pools': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificate_authorities': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificate_revocation_lists': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificate_templates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'revoke_certificate': ('name', 'reason', 'request_id', ), + 'undelete_certificate_authority': ('name', 'request_id', ), + 'update_ca_pool': ('ca_pool', 'update_mask', 'request_id', ), + 'update_certificate': ('certificate', 'update_mask', 'request_id', ), + 'update_certificate_authority': ('certificate_authority', 'update_mask', 'request_id', ), + 'update_certificate_revocation_list': ('certificate_revocation_list', 'update_mask', 'request_id', ), + 'update_certificate_template': ('certificate_template', 'update_mask', 'request_id', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -101,7 +98,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: value=cst.Dict([ cst.DictElement( cst.SimpleString("'{}'".format(name)), - cst.Element(value=arg.value) +cst.Element(value=arg.value) ) # Note: the args + kwargs looks silly, but keep in mind that # the control parameters had to be stripped out, and that diff --git a/scripts/fixup_privateca_v1beta1_keywords.py b/scripts/fixup_privateca_v1beta1_keywords.py index b6ac80d..afc0c8d 100644 --- a/scripts/fixup_privateca_v1beta1_keywords.py +++ b/scripts/fixup_privateca_v1beta1_keywords.py @@ -1,6 +1,5 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import argparse import os import libcst as cst @@ -41,27 +39,26 @@ def partition( class privatecaCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'activate_certificate_authority': ('name', 'pem_ca_certificate', 'subordinate_config', 'request_id', ), - 'create_certificate': ('parent', 'certificate', 'certificate_id', 'request_id', ), - 'create_certificate_authority': ('parent', 'certificate_authority_id', 'certificate_authority', 'request_id', ), - 'disable_certificate_authority': ('name', 'request_id', ), - 'enable_certificate_authority': ('name', 'request_id', ), - 'fetch_certificate_authority_csr': ('name', ), - 'get_certificate': ('name', ), - 'get_certificate_authority': ('name', ), - 'get_certificate_revocation_list': ('name', ), - 'get_reusable_config': ('name', ), - 'list_certificate_authorities': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificate_revocation_lists': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_certificates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_reusable_configs': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'restore_certificate_authority': ('name', 'request_id', ), - 'revoke_certificate': ('name', 'reason', 'request_id', ), - 'schedule_delete_certificate_authority': ('name', 'request_id', ), - 'update_certificate': ('certificate', 'update_mask', 'request_id', ), - 'update_certificate_authority': ('certificate_authority', 'update_mask', 'request_id', ), - 'update_certificate_revocation_list': ('certificate_revocation_list', 'update_mask', 'request_id', ), - + 'activate_certificate_authority': ('name', 'pem_ca_certificate', 'subordinate_config', 'request_id', ), + 'create_certificate': ('parent', 'certificate', 'certificate_id', 'request_id', ), + 'create_certificate_authority': ('parent', 'certificate_authority_id', 'certificate_authority', 'request_id', ), + 'disable_certificate_authority': ('name', 'request_id', ), + 'enable_certificate_authority': ('name', 'request_id', ), + 'fetch_certificate_authority_csr': ('name', ), + 'get_certificate': ('name', ), + 'get_certificate_authority': ('name', ), + 'get_certificate_revocation_list': ('name', ), + 'get_reusable_config': ('name', ), + 'list_certificate_authorities': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificate_revocation_lists': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_certificates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_reusable_configs': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'restore_certificate_authority': ('name', 'request_id', ), + 'revoke_certificate': ('name', 'reason', 'request_id', ), + 'schedule_delete_certificate_authority': ('name', 'request_id', ), + 'update_certificate': ('certificate', 'update_mask', 'request_id', ), + 'update_certificate_authority': ('certificate_authority', 'update_mask', 'request_id', ), + 'update_certificate_revocation_list': ('certificate_revocation_list', 'update_mask', 'request_id', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -92,7 +89,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: value=cst.Dict([ cst.DictElement( cst.SimpleString("'{}'".format(name)), - cst.Element(value=arg.value) +cst.Element(value=arg.value) ) # Note: the args + kwargs looks silly, but keep in mind that # the control parameters had to be stripped out, and that diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/unit/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/unit/gapic/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/privateca_v1/__init__.py b/tests/unit/gapic/privateca_v1/__init__.py index 42ffdf2..4de6597 100644 --- a/tests/unit/gapic/privateca_v1/__init__.py +++ b/tests/unit/gapic/privateca_v1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py b/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py index a1acc15..ad655bf 100644 --- a/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py +++ b/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,16 +23,16 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +from google.api_core import exceptions as core_exceptions from google.api_core import future from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.security.privateca_v1.services.certificate_authority_service import ( CertificateAuthorityServiceAsyncClient, @@ -47,14 +46,44 @@ from google.cloud.security.privateca_v1.services.certificate_authority_service import ( transports, ) +from google.cloud.security.privateca_v1.services.certificate_authority_service.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.security.privateca_v1.services.certificate_authority_service.transports.base import ( + _GOOGLE_AUTH_VERSION, +) from google.cloud.security.privateca_v1.types import resources from google.cloud.security.privateca_v1.types import service from google.longrunning import operations_pb2 from google.oauth2 import service_account -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.type import expr_pb2 as expr # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import expr_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -109,7 +138,7 @@ def test__get_default_mtls_endpoint(): [CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient,], ) def test_certificate_authority_service_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -127,7 +156,7 @@ def test_certificate_authority_service_client_from_service_account_info(client_c [CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient,], ) def test_certificate_authority_service_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -186,7 +215,7 @@ def test_certificate_authority_service_client_client_options( with mock.patch.object( CertificateAuthorityServiceClient, "get_transport_class" ) as gtc: - transport = transport_class(credentials=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -494,7 +523,7 @@ def test_create_certificate( transport: str = "grpc", request_type=service.CreateCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -515,29 +544,20 @@ def test_create_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.create_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -549,7 +569,7 @@ def test_create_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -559,7 +579,6 @@ def test_create_certificate_empty_call(): client.create_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() @@ -568,7 +587,7 @@ async def test_create_certificate_async( transport: str = "grpc_asyncio", request_type=service.CreateCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -590,28 +609,20 @@ async def test_create_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.create_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -622,12 +633,13 @@ async def test_create_certificate_async_from_dict(): def test_create_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -635,7 +647,6 @@ def test_create_certificate_field_headers(): type(client.transport.create_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.create_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -651,12 +662,13 @@ def test_create_certificate_field_headers(): @pytest.mark.asyncio async def test_create_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -666,7 +678,6 @@ async def test_create_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.create_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -681,7 +692,7 @@ async def test_create_certificate_field_headers_async(): def test_create_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -690,7 +701,6 @@ def test_create_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_certificate( @@ -703,17 +713,14 @@ def test_create_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate == resources.Certificate(name="name_value") - assert args[0].certificate_id == "certificate_id_value" def test_create_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -730,7 +737,7 @@ def test_create_certificate_flattened_error(): @pytest.mark.asyncio async def test_create_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -755,18 +762,15 @@ async def test_create_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate == resources.Certificate(name="name_value") - assert args[0].certificate_id == "certificate_id_value" @pytest.mark.asyncio async def test_create_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -784,7 +788,7 @@ def test_get_certificate( transport: str = "grpc", request_type=service.GetCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -803,29 +807,20 @@ def test_get_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.get_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -837,7 +832,7 @@ def test_get_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -845,7 +840,6 @@ def test_get_certificate_empty_call(): client.get_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() @@ -854,7 +848,7 @@ async def test_get_certificate_async( transport: str = "grpc_asyncio", request_type=service.GetCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -874,28 +868,20 @@ async def test_get_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.get_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -906,18 +892,18 @@ async def test_get_certificate_async_from_dict(): def test_get_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_certificate), "__call__") as call: call.return_value = resources.Certificate() - client.get_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -933,12 +919,13 @@ def test_get_certificate_field_headers(): @pytest.mark.asyncio async def test_get_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -946,7 +933,6 @@ async def test_get_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.get_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -961,14 +947,13 @@ async def test_get_certificate_field_headers_async(): def test_get_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_certificate), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate(name="name_value",) @@ -977,13 +962,12 @@ def test_get_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -997,7 +981,7 @@ def test_get_certificate_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1016,14 +1000,13 @@ async def test_get_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1038,7 +1021,7 @@ def test_list_certificates( transport: str = "grpc", request_type=service.ListCertificatesRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1053,21 +1036,16 @@ def test_list_certificates( call.return_value = service.ListCertificatesResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificatesPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -1079,7 +1057,7 @@ def test_list_certificates_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1089,7 +1067,6 @@ def test_list_certificates_empty_call(): client.list_certificates() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() @@ -1098,7 +1075,7 @@ async def test_list_certificates_async( transport: str = "grpc_asyncio", request_type=service.ListCertificatesRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1116,20 +1093,16 @@ async def test_list_certificates_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificatesAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -1140,12 +1113,13 @@ async def test_list_certificates_async_from_dict(): def test_list_certificates_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1153,7 +1127,6 @@ def test_list_certificates_field_headers(): type(client.transport.list_certificates), "__call__" ) as call: call.return_value = service.ListCertificatesResponse() - client.list_certificates(request) # Establish that the underlying gRPC stub method was called. @@ -1169,12 +1142,13 @@ def test_list_certificates_field_headers(): @pytest.mark.asyncio async def test_list_certificates_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1184,7 +1158,6 @@ async def test_list_certificates_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificatesResponse() ) - await client.list_certificates(request) # Establish that the underlying gRPC stub method was called. @@ -1199,7 +1172,7 @@ async def test_list_certificates_field_headers_async(): def test_list_certificates_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1208,7 +1181,6 @@ def test_list_certificates_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificatesResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificates(parent="parent_value",) @@ -1217,13 +1189,12 @@ def test_list_certificates_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificates_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1237,7 +1208,7 @@ def test_list_certificates_flattened_error(): @pytest.mark.asyncio async def test_list_certificates_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1258,14 +1229,13 @@ async def test_list_certificates_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificates_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1278,7 +1248,7 @@ async def test_list_certificates_flattened_error_async(): def test_list_certificates_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1320,7 +1290,7 @@ def test_list_certificates_pager(): def test_list_certificates_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1354,7 +1324,7 @@ def test_list_certificates_pages(): @pytest.mark.asyncio async def test_list_certificates_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1395,7 +1365,7 @@ async def test_list_certificates_async_pager(): @pytest.mark.asyncio async def test_list_certificates_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1434,7 +1404,7 @@ def test_revoke_certificate( transport: str = "grpc", request_type=service.RevokeCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1455,29 +1425,20 @@ def test_revoke_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1489,7 +1450,7 @@ def test_revoke_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1499,7 +1460,6 @@ def test_revoke_certificate_empty_call(): client.revoke_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() @@ -1508,7 +1468,7 @@ async def test_revoke_certificate_async( transport: str = "grpc_asyncio", request_type=service.RevokeCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1530,28 +1490,20 @@ async def test_revoke_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1562,12 +1514,13 @@ async def test_revoke_certificate_async_from_dict(): def test_revoke_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RevokeCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1575,7 +1528,6 @@ def test_revoke_certificate_field_headers(): type(client.transport.revoke_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1591,12 +1543,13 @@ def test_revoke_certificate_field_headers(): @pytest.mark.asyncio async def test_revoke_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RevokeCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1606,7 +1559,6 @@ async def test_revoke_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1621,7 +1573,7 @@ async def test_revoke_certificate_field_headers_async(): def test_revoke_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1630,7 +1582,6 @@ def test_revoke_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.revoke_certificate(name="name_value",) @@ -1639,13 +1590,12 @@ def test_revoke_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_revoke_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1659,7 +1609,7 @@ def test_revoke_certificate_flattened_error(): @pytest.mark.asyncio async def test_revoke_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1680,14 +1630,13 @@ async def test_revoke_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_revoke_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1702,7 +1651,7 @@ def test_update_certificate( transport: str = "grpc", request_type=service.UpdateCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1723,29 +1672,20 @@ def test_update_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.update_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1757,7 +1697,7 @@ def test_update_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1767,7 +1707,6 @@ def test_update_certificate_empty_call(): client.update_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() @@ -1776,7 +1715,7 @@ async def test_update_certificate_async( transport: str = "grpc_asyncio", request_type=service.UpdateCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1798,28 +1737,20 @@ async def test_update_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.update_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.issuer_certificate_authority == "issuer_certificate_authority_value" - assert response.certificate_template == "certificate_template_value" - assert response.subject_mode == resources.SubjectRequestMode.DEFAULT - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1830,12 +1761,13 @@ async def test_update_certificate_async_from_dict(): def test_update_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRequest() + request.certificate.name = "certificate.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1843,7 +1775,6 @@ def test_update_certificate_field_headers(): type(client.transport.update_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.update_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1861,12 +1792,13 @@ def test_update_certificate_field_headers(): @pytest.mark.asyncio async def test_update_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRequest() + request.certificate.name = "certificate.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1876,7 +1808,6 @@ async def test_update_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.update_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1893,7 +1824,7 @@ async def test_update_certificate_field_headers_async(): def test_update_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1902,27 +1833,24 @@ def test_update_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate( certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].certificate == resources.Certificate(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1931,14 +1859,14 @@ def test_update_certificate_flattened_error(): client.update_certificate( service.UpdateCertificateRequest(), certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1955,23 +1883,21 @@ async def test_update_certificate_flattened_async(): # using the keyword arguments to the method. response = await client.update_certificate( certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].certificate == resources.Certificate(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1980,7 +1906,7 @@ async def test_update_certificate_flattened_error_async(): await client.update_certificate( service.UpdateCertificateRequest(), certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -1988,7 +1914,7 @@ def test_activate_certificate_authority( transport: str = "grpc", request_type=service.ActivateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2001,13 +1927,11 @@ def test_activate_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2022,7 +1946,7 @@ def test_activate_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2032,7 +1956,6 @@ def test_activate_certificate_authority_empty_call(): client.activate_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() @@ -2042,7 +1965,7 @@ async def test_activate_certificate_authority_async( request_type=service.ActivateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2057,13 +1980,11 @@ async def test_activate_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2077,12 +1998,13 @@ async def test_activate_certificate_authority_async_from_dict(): def test_activate_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ActivateCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2090,7 +2012,6 @@ def test_activate_certificate_authority_field_headers(): type(client.transport.activate_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2106,12 +2027,13 @@ def test_activate_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_activate_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ActivateCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2121,7 +2043,6 @@ async def test_activate_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2136,7 +2057,7 @@ async def test_activate_certificate_authority_field_headers_async(): def test_activate_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2145,7 +2066,6 @@ def test_activate_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.activate_certificate_authority(name="name_value",) @@ -2154,13 +2074,12 @@ def test_activate_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_activate_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2174,7 +2093,7 @@ def test_activate_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_activate_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2195,14 +2114,13 @@ async def test_activate_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_activate_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2217,7 +2135,7 @@ def test_create_certificate_authority( transport: str = "grpc", request_type=service.CreateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2230,13 +2148,11 @@ def test_create_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2251,7 +2167,7 @@ def test_create_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2261,7 +2177,6 @@ def test_create_certificate_authority_empty_call(): client.create_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() @@ -2271,7 +2186,7 @@ async def test_create_certificate_authority_async( request_type=service.CreateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2286,13 +2201,11 @@ async def test_create_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2306,12 +2219,13 @@ async def test_create_certificate_authority_async_from_dict(): def test_create_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateAuthorityRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2319,7 +2233,6 @@ def test_create_certificate_authority_field_headers(): type(client.transport.create_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2335,12 +2248,13 @@ def test_create_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_create_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateAuthorityRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2350,7 +2264,6 @@ async def test_create_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2365,7 +2278,7 @@ async def test_create_certificate_authority_field_headers_async(): def test_create_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2374,7 +2287,6 @@ def test_create_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_certificate_authority( @@ -2387,19 +2299,16 @@ def test_create_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - assert args[0].certificate_authority_id == "certificate_authority_id_value" def test_create_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2416,7 +2325,7 @@ def test_create_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_create_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2441,20 +2350,17 @@ async def test_create_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - assert args[0].certificate_authority_id == "certificate_authority_id_value" @pytest.mark.asyncio async def test_create_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2472,7 +2378,7 @@ def test_disable_certificate_authority( transport: str = "grpc", request_type=service.DisableCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2485,13 +2391,11 @@ def test_disable_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2506,7 +2410,7 @@ def test_disable_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2516,7 +2420,6 @@ def test_disable_certificate_authority_empty_call(): client.disable_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() @@ -2526,7 +2429,7 @@ async def test_disable_certificate_authority_async( request_type=service.DisableCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2541,13 +2444,11 @@ async def test_disable_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2561,12 +2462,13 @@ async def test_disable_certificate_authority_async_from_dict(): def test_disable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DisableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2574,7 +2476,6 @@ def test_disable_certificate_authority_field_headers(): type(client.transport.disable_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2590,12 +2491,13 @@ def test_disable_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_disable_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DisableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2605,7 +2507,6 @@ async def test_disable_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2620,7 +2521,7 @@ async def test_disable_certificate_authority_field_headers_async(): def test_disable_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2629,7 +2530,6 @@ def test_disable_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.disable_certificate_authority(name="name_value",) @@ -2638,13 +2538,12 @@ def test_disable_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_disable_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2658,7 +2557,7 @@ def test_disable_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_disable_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2679,14 +2578,13 @@ async def test_disable_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_disable_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2701,7 +2599,7 @@ def test_enable_certificate_authority( transport: str = "grpc", request_type=service.EnableCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2714,13 +2612,11 @@ def test_enable_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2735,7 +2631,7 @@ def test_enable_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2745,7 +2641,6 @@ def test_enable_certificate_authority_empty_call(): client.enable_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() @@ -2755,7 +2650,7 @@ async def test_enable_certificate_authority_async( request_type=service.EnableCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2770,13 +2665,11 @@ async def test_enable_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2790,12 +2683,13 @@ async def test_enable_certificate_authority_async_from_dict(): def test_enable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.EnableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2803,7 +2697,6 @@ def test_enable_certificate_authority_field_headers(): type(client.transport.enable_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2819,12 +2712,13 @@ def test_enable_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_enable_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.EnableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2834,7 +2728,6 @@ async def test_enable_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2849,7 +2742,7 @@ async def test_enable_certificate_authority_field_headers_async(): def test_enable_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2858,7 +2751,6 @@ def test_enable_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.enable_certificate_authority(name="name_value",) @@ -2867,13 +2759,12 @@ def test_enable_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_enable_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2887,7 +2778,7 @@ def test_enable_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_enable_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2908,14 +2799,13 @@ async def test_enable_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_enable_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2930,7 +2820,7 @@ def test_fetch_certificate_authority_csr( transport: str = "grpc", request_type=service.FetchCertificateAuthorityCsrRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2945,19 +2835,15 @@ def test_fetch_certificate_authority_csr( call.return_value = service.FetchCertificateAuthorityCsrResponse( pem_csr="pem_csr_value", ) - response = client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() # Establish that the response is the type that we expect. - assert isinstance(response, service.FetchCertificateAuthorityCsrResponse) - assert response.pem_csr == "pem_csr_value" @@ -2969,7 +2855,7 @@ def test_fetch_certificate_authority_csr_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2979,7 +2865,6 @@ def test_fetch_certificate_authority_csr_empty_call(): client.fetch_certificate_authority_csr() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() @@ -2989,7 +2874,7 @@ async def test_fetch_certificate_authority_csr_async( request_type=service.FetchCertificateAuthorityCsrRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3004,18 +2889,15 @@ async def test_fetch_certificate_authority_csr_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCertificateAuthorityCsrResponse(pem_csr="pem_csr_value",) ) - response = await client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() # Establish that the response is the type that we expect. assert isinstance(response, service.FetchCertificateAuthorityCsrResponse) - assert response.pem_csr == "pem_csr_value" @@ -3026,12 +2908,13 @@ async def test_fetch_certificate_authority_csr_async_from_dict(): def test_fetch_certificate_authority_csr_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCertificateAuthorityCsrRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3039,7 +2922,6 @@ def test_fetch_certificate_authority_csr_field_headers(): type(client.transport.fetch_certificate_authority_csr), "__call__" ) as call: call.return_value = service.FetchCertificateAuthorityCsrResponse() - client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. @@ -3055,12 +2937,13 @@ def test_fetch_certificate_authority_csr_field_headers(): @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCertificateAuthorityCsrRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3070,7 +2953,6 @@ async def test_fetch_certificate_authority_csr_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCertificateAuthorityCsrResponse() ) - await client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. @@ -3085,7 +2967,7 @@ async def test_fetch_certificate_authority_csr_field_headers_async(): def test_fetch_certificate_authority_csr_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3094,7 +2976,6 @@ def test_fetch_certificate_authority_csr_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.FetchCertificateAuthorityCsrResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.fetch_certificate_authority_csr(name="name_value",) @@ -3103,13 +2984,12 @@ def test_fetch_certificate_authority_csr_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_fetch_certificate_authority_csr_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3123,7 +3003,7 @@ def test_fetch_certificate_authority_csr_flattened_error(): @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3144,14 +3024,13 @@ async def test_fetch_certificate_authority_csr_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3166,7 +3045,7 @@ def test_get_certificate_authority( transport: str = "grpc", request_type=service.GetCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3186,29 +3065,20 @@ def test_get_certificate_authority( pem_ca_certificates=["pem_ca_certificates_value"], gcs_bucket="gcs_bucket_value", ) - response = client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CertificateAuthority) - assert response.name == "name_value" - assert response.type_ == resources.CertificateAuthority.Type.SELF_SIGNED - assert response.tier == resources.CaPool.Tier.ENTERPRISE - assert response.state == resources.CertificateAuthority.State.ENABLED - assert response.pem_ca_certificates == ["pem_ca_certificates_value"] - assert response.gcs_bucket == "gcs_bucket_value" @@ -3220,7 +3090,7 @@ def test_get_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3230,7 +3100,6 @@ def test_get_certificate_authority_empty_call(): client.get_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() @@ -3239,7 +3108,7 @@ async def test_get_certificate_authority_async( transport: str = "grpc_asyncio", request_type=service.GetCertificateAuthorityRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3261,28 +3130,20 @@ async def test_get_certificate_authority_async( gcs_bucket="gcs_bucket_value", ) ) - response = await client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CertificateAuthority) - assert response.name == "name_value" - assert response.type_ == resources.CertificateAuthority.Type.SELF_SIGNED - assert response.tier == resources.CaPool.Tier.ENTERPRISE - assert response.state == resources.CertificateAuthority.State.ENABLED - assert response.pem_ca_certificates == ["pem_ca_certificates_value"] - assert response.gcs_bucket == "gcs_bucket_value" @@ -3293,12 +3154,13 @@ async def test_get_certificate_authority_async_from_dict(): def test_get_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3306,7 +3168,6 @@ def test_get_certificate_authority_field_headers(): type(client.transport.get_certificate_authority), "__call__" ) as call: call.return_value = resources.CertificateAuthority() - client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3322,12 +3183,13 @@ def test_get_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_get_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3337,7 +3199,6 @@ async def test_get_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CertificateAuthority() ) - await client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3352,7 +3213,7 @@ async def test_get_certificate_authority_field_headers_async(): def test_get_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3361,7 +3222,6 @@ def test_get_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.CertificateAuthority() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate_authority(name="name_value",) @@ -3370,13 +3230,12 @@ def test_get_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3390,7 +3249,7 @@ def test_get_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3411,14 +3270,13 @@ async def test_get_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3433,7 +3291,7 @@ def test_list_certificate_authorities( transport: str = "grpc", request_type=service.ListCertificateAuthoritiesRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3448,21 +3306,16 @@ def test_list_certificate_authorities( call.return_value = service.ListCertificateAuthoritiesResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificateAuthoritiesPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -3474,7 +3327,7 @@ def test_list_certificate_authorities_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3484,7 +3337,6 @@ def test_list_certificate_authorities_empty_call(): client.list_certificate_authorities() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() @@ -3494,7 +3346,7 @@ async def test_list_certificate_authorities_async( request_type=service.ListCertificateAuthoritiesRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3512,20 +3364,16 @@ async def test_list_certificate_authorities_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificateAuthoritiesAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -3536,12 +3384,13 @@ async def test_list_certificate_authorities_async_from_dict(): def test_list_certificate_authorities_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateAuthoritiesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3549,7 +3398,6 @@ def test_list_certificate_authorities_field_headers(): type(client.transport.list_certificate_authorities), "__call__" ) as call: call.return_value = service.ListCertificateAuthoritiesResponse() - client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. @@ -3565,12 +3413,13 @@ def test_list_certificate_authorities_field_headers(): @pytest.mark.asyncio async def test_list_certificate_authorities_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateAuthoritiesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3580,7 +3429,6 @@ async def test_list_certificate_authorities_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificateAuthoritiesResponse() ) - await client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. @@ -3595,7 +3443,7 @@ async def test_list_certificate_authorities_field_headers_async(): def test_list_certificate_authorities_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3604,7 +3452,6 @@ def test_list_certificate_authorities_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificateAuthoritiesResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificate_authorities(parent="parent_value",) @@ -3613,13 +3460,12 @@ def test_list_certificate_authorities_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificate_authorities_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3633,7 +3479,7 @@ def test_list_certificate_authorities_flattened_error(): @pytest.mark.asyncio async def test_list_certificate_authorities_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3654,14 +3500,13 @@ async def test_list_certificate_authorities_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificate_authorities_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3674,7 +3519,7 @@ async def test_list_certificate_authorities_flattened_error_async(): def test_list_certificate_authorities_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3722,7 +3567,7 @@ def test_list_certificate_authorities_pager(): def test_list_certificate_authorities_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3762,7 +3607,7 @@ def test_list_certificate_authorities_pages(): @pytest.mark.asyncio async def test_list_certificate_authorities_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3809,7 +3654,7 @@ async def test_list_certificate_authorities_async_pager(): @pytest.mark.asyncio async def test_list_certificate_authorities_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3856,7 +3701,7 @@ def test_undelete_certificate_authority( transport: str = "grpc", request_type=service.UndeleteCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3869,13 +3714,11 @@ def test_undelete_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.undelete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -3890,7 +3733,7 @@ def test_undelete_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3900,7 +3743,6 @@ def test_undelete_certificate_authority_empty_call(): client.undelete_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeleteCertificateAuthorityRequest() @@ -3910,7 +3752,7 @@ async def test_undelete_certificate_authority_async( request_type=service.UndeleteCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3925,13 +3767,11 @@ async def test_undelete_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.undelete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -3945,12 +3785,13 @@ async def test_undelete_certificate_authority_async_from_dict(): def test_undelete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UndeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3958,7 +3799,6 @@ def test_undelete_certificate_authority_field_headers(): type(client.transport.undelete_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.undelete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3974,12 +3814,13 @@ def test_undelete_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_undelete_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UndeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3989,7 +3830,6 @@ async def test_undelete_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.undelete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4004,7 +3844,7 @@ async def test_undelete_certificate_authority_field_headers_async(): def test_undelete_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4013,7 +3853,6 @@ def test_undelete_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.undelete_certificate_authority(name="name_value",) @@ -4022,13 +3861,12 @@ def test_undelete_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_undelete_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4042,7 +3880,7 @@ def test_undelete_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_undelete_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4063,14 +3901,13 @@ async def test_undelete_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_undelete_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4085,7 +3922,7 @@ def test_delete_certificate_authority( transport: str = "grpc", request_type=service.DeleteCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4098,13 +3935,11 @@ def test_delete_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4119,7 +3954,7 @@ def test_delete_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4129,7 +3964,6 @@ def test_delete_certificate_authority_empty_call(): client.delete_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateAuthorityRequest() @@ -4139,7 +3973,7 @@ async def test_delete_certificate_authority_async( request_type=service.DeleteCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4154,13 +3988,11 @@ async def test_delete_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4174,12 +4006,13 @@ async def test_delete_certificate_authority_async_from_dict(): def test_delete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4187,7 +4020,6 @@ def test_delete_certificate_authority_field_headers(): type(client.transport.delete_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4203,12 +4035,13 @@ def test_delete_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_delete_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4218,7 +4051,6 @@ async def test_delete_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4233,7 +4065,7 @@ async def test_delete_certificate_authority_field_headers_async(): def test_delete_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4242,7 +4074,6 @@ def test_delete_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_certificate_authority(name="name_value",) @@ -4251,13 +4082,12 @@ def test_delete_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_delete_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4271,7 +4101,7 @@ def test_delete_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_delete_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4292,14 +4122,13 @@ async def test_delete_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_delete_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4314,7 +4143,7 @@ def test_update_certificate_authority( transport: str = "grpc", request_type=service.UpdateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4327,13 +4156,11 @@ def test_update_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4348,7 +4175,7 @@ def test_update_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4358,7 +4185,6 @@ def test_update_certificate_authority_empty_call(): client.update_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() @@ -4368,7 +4194,7 @@ async def test_update_certificate_authority_async( request_type=service.UpdateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4383,13 +4209,11 @@ async def test_update_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4403,12 +4227,13 @@ async def test_update_certificate_authority_async_from_dict(): def test_update_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateAuthorityRequest() + request.certificate_authority.name = "certificate_authority.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4416,7 +4241,6 @@ def test_update_certificate_authority_field_headers(): type(client.transport.update_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4435,12 +4259,13 @@ def test_update_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_update_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateAuthorityRequest() + request.certificate_authority.name = "certificate_authority.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4450,7 +4275,6 @@ async def test_update_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4468,7 +4292,7 @@ async def test_update_certificate_authority_field_headers_async(): def test_update_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4477,29 +4301,26 @@ def test_update_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate_authority( certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4508,14 +4329,14 @@ def test_update_certificate_authority_flattened_error(): client.update_certificate_authority( service.UpdateCertificateAuthorityRequest(), certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4532,25 +4353,23 @@ async def test_update_certificate_authority_flattened_async(): # using the keyword arguments to the method. response = await client.update_certificate_authority( certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4559,7 +4378,7 @@ async def test_update_certificate_authority_flattened_error_async(): await client.update_certificate_authority( service.UpdateCertificateAuthorityRequest(), certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -4567,7 +4386,7 @@ def test_create_ca_pool( transport: str = "grpc", request_type=service.CreateCaPoolRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4578,13 +4397,11 @@ def test_create_ca_pool( with mock.patch.object(type(client.transport.create_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCaPoolRequest() # Establish that the response is the type that we expect. @@ -4599,7 +4416,7 @@ def test_create_ca_pool_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4607,7 +4424,6 @@ def test_create_ca_pool_empty_call(): client.create_ca_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCaPoolRequest() @@ -4616,7 +4432,7 @@ async def test_create_ca_pool_async( transport: str = "grpc_asyncio", request_type=service.CreateCaPoolRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4629,13 +4445,11 @@ async def test_create_ca_pool_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.create_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCaPoolRequest() # Establish that the response is the type that we expect. @@ -4649,18 +4463,18 @@ async def test_create_ca_pool_async_from_dict(): def test_create_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCaPoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_ca_pool), "__call__") as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.create_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -4676,12 +4490,13 @@ def test_create_ca_pool_field_headers(): @pytest.mark.asyncio async def test_create_ca_pool_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCaPoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4689,7 +4504,6 @@ async def test_create_ca_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.create_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -4704,14 +4518,13 @@ async def test_create_ca_pool_field_headers_async(): def test_create_ca_pool_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_ca_pool( @@ -4724,17 +4537,14 @@ def test_create_ca_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].ca_pool == resources.CaPool(name="name_value") - assert args[0].ca_pool_id == "ca_pool_id_value" def test_create_ca_pool_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4751,7 +4561,7 @@ def test_create_ca_pool_flattened_error(): @pytest.mark.asyncio async def test_create_ca_pool_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4774,18 +4584,15 @@ async def test_create_ca_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].ca_pool == resources.CaPool(name="name_value") - assert args[0].ca_pool_id == "ca_pool_id_value" @pytest.mark.asyncio async def test_create_ca_pool_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4803,7 +4610,7 @@ def test_update_ca_pool( transport: str = "grpc", request_type=service.UpdateCaPoolRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4814,13 +4621,11 @@ def test_update_ca_pool( with mock.patch.object(type(client.transport.update_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCaPoolRequest() # Establish that the response is the type that we expect. @@ -4835,7 +4640,7 @@ def test_update_ca_pool_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4843,7 +4648,6 @@ def test_update_ca_pool_empty_call(): client.update_ca_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCaPoolRequest() @@ -4852,7 +4656,7 @@ async def test_update_ca_pool_async( transport: str = "grpc_asyncio", request_type=service.UpdateCaPoolRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4865,13 +4669,11 @@ async def test_update_ca_pool_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCaPoolRequest() # Establish that the response is the type that we expect. @@ -4885,18 +4687,18 @@ async def test_update_ca_pool_async_from_dict(): def test_update_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCaPoolRequest() + request.ca_pool.name = "ca_pool.name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_ca_pool), "__call__") as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -4914,12 +4716,13 @@ def test_update_ca_pool_field_headers(): @pytest.mark.asyncio async def test_update_ca_pool_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCaPoolRequest() + request.ca_pool.name = "ca_pool.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4927,7 +4730,6 @@ async def test_update_ca_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -4944,34 +4746,31 @@ async def test_update_ca_pool_field_headers_async(): def test_update_ca_pool_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_ca_pool( ca_pool=resources.CaPool(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].ca_pool == resources.CaPool(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_ca_pool_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4980,14 +4779,14 @@ def test_update_ca_pool_flattened_error(): client.update_ca_pool( service.UpdateCaPoolRequest(), ca_pool=resources.CaPool(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_ca_pool_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5002,23 +4801,21 @@ async def test_update_ca_pool_flattened_async(): # using the keyword arguments to the method. response = await client.update_ca_pool( ca_pool=resources.CaPool(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].ca_pool == resources.CaPool(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_ca_pool_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5027,13 +4824,13 @@ async def test_update_ca_pool_flattened_error_async(): await client.update_ca_pool( service.UpdateCaPoolRequest(), ca_pool=resources.CaPool(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) def test_get_ca_pool(transport: str = "grpc", request_type=service.GetCaPoolRequest): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5046,21 +4843,16 @@ def test_get_ca_pool(transport: str = "grpc", request_type=service.GetCaPoolRequ call.return_value = resources.CaPool( name="name_value", tier=resources.CaPool.Tier.ENTERPRISE, ) - response = client.get_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCaPoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CaPool) - assert response.name == "name_value" - assert response.tier == resources.CaPool.Tier.ENTERPRISE @@ -5072,7 +4864,7 @@ def test_get_ca_pool_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5080,7 +4872,6 @@ def test_get_ca_pool_empty_call(): client.get_ca_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCaPoolRequest() @@ -5089,7 +4880,7 @@ async def test_get_ca_pool_async( transport: str = "grpc_asyncio", request_type=service.GetCaPoolRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5102,20 +4893,16 @@ async def test_get_ca_pool_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CaPool(name="name_value", tier=resources.CaPool.Tier.ENTERPRISE,) ) - response = await client.get_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCaPoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CaPool) - assert response.name == "name_value" - assert response.tier == resources.CaPool.Tier.ENTERPRISE @@ -5126,18 +4913,18 @@ async def test_get_ca_pool_async_from_dict(): def test_get_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCaPoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_ca_pool), "__call__") as call: call.return_value = resources.CaPool() - client.get_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5153,18 +4940,18 @@ def test_get_ca_pool_field_headers(): @pytest.mark.asyncio async def test_get_ca_pool_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCaPoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_ca_pool), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CaPool()) - await client.get_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5179,14 +4966,13 @@ async def test_get_ca_pool_field_headers_async(): def test_get_ca_pool_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = resources.CaPool() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_ca_pool(name="name_value",) @@ -5195,13 +4981,12 @@ def test_get_ca_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_ca_pool_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5215,7 +5000,7 @@ def test_get_ca_pool_flattened_error(): @pytest.mark.asyncio async def test_get_ca_pool_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5232,14 +5017,13 @@ async def test_get_ca_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_ca_pool_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5254,7 +5038,7 @@ def test_list_ca_pools( transport: str = "grpc", request_type=service.ListCaPoolsRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5267,21 +5051,16 @@ def test_list_ca_pools( call.return_value = service.ListCaPoolsResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_ca_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCaPoolsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCaPoolsPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -5293,7 +5072,7 @@ def test_list_ca_pools_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5301,7 +5080,6 @@ def test_list_ca_pools_empty_call(): client.list_ca_pools() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCaPoolsRequest() @@ -5310,7 +5088,7 @@ async def test_list_ca_pools_async( transport: str = "grpc_asyncio", request_type=service.ListCaPoolsRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5326,20 +5104,16 @@ async def test_list_ca_pools_async( unreachable=["unreachable_value"], ) ) - response = await client.list_ca_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCaPoolsRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCaPoolsAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -5350,18 +5124,18 @@ async def test_list_ca_pools_async_from_dict(): def test_list_ca_pools_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCaPoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_ca_pools), "__call__") as call: call.return_value = service.ListCaPoolsResponse() - client.list_ca_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5377,12 +5151,13 @@ def test_list_ca_pools_field_headers(): @pytest.mark.asyncio async def test_list_ca_pools_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCaPoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5390,7 +5165,6 @@ async def test_list_ca_pools_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCaPoolsResponse() ) - await client.list_ca_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5405,14 +5179,13 @@ async def test_list_ca_pools_field_headers_async(): def test_list_ca_pools_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_ca_pools), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.ListCaPoolsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_ca_pools(parent="parent_value",) @@ -5421,13 +5194,12 @@ def test_list_ca_pools_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_ca_pools_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5441,7 +5213,7 @@ def test_list_ca_pools_flattened_error(): @pytest.mark.asyncio async def test_list_ca_pools_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5460,14 +5232,13 @@ async def test_list_ca_pools_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_ca_pools_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5480,7 +5251,7 @@ async def test_list_ca_pools_flattened_error_async(): def test_list_ca_pools_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5516,7 +5287,7 @@ def test_list_ca_pools_pager(): def test_list_ca_pools_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5544,7 +5315,7 @@ def test_list_ca_pools_pages(): @pytest.mark.asyncio async def test_list_ca_pools_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5579,7 +5350,7 @@ async def test_list_ca_pools_async_pager(): @pytest.mark.asyncio async def test_list_ca_pools_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5612,7 +5383,7 @@ def test_delete_ca_pool( transport: str = "grpc", request_type=service.DeleteCaPoolRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5623,13 +5394,11 @@ def test_delete_ca_pool( with mock.patch.object(type(client.transport.delete_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCaPoolRequest() # Establish that the response is the type that we expect. @@ -5644,7 +5413,7 @@ def test_delete_ca_pool_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5652,7 +5421,6 @@ def test_delete_ca_pool_empty_call(): client.delete_ca_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCaPoolRequest() @@ -5661,7 +5429,7 @@ async def test_delete_ca_pool_async( transport: str = "grpc_asyncio", request_type=service.DeleteCaPoolRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5674,13 +5442,11 @@ async def test_delete_ca_pool_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.delete_ca_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCaPoolRequest() # Establish that the response is the type that we expect. @@ -5694,18 +5460,18 @@ async def test_delete_ca_pool_async_from_dict(): def test_delete_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCaPoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_ca_pool), "__call__") as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5721,12 +5487,13 @@ def test_delete_ca_pool_field_headers(): @pytest.mark.asyncio async def test_delete_ca_pool_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCaPoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5734,7 +5501,6 @@ async def test_delete_ca_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.delete_ca_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5749,14 +5515,13 @@ async def test_delete_ca_pool_field_headers_async(): def test_delete_ca_pool_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_ca_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_ca_pool(name="name_value",) @@ -5765,13 +5530,12 @@ def test_delete_ca_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_delete_ca_pool_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5785,7 +5549,7 @@ def test_delete_ca_pool_flattened_error(): @pytest.mark.asyncio async def test_delete_ca_pool_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5804,14 +5568,13 @@ async def test_delete_ca_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_delete_ca_pool_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5826,7 +5589,7 @@ def test_fetch_ca_certs( transport: str = "grpc", request_type=service.FetchCaCertsRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5837,17 +5600,14 @@ def test_fetch_ca_certs( with mock.patch.object(type(client.transport.fetch_ca_certs), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.FetchCaCertsResponse() - response = client.fetch_ca_certs(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCaCertsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, service.FetchCaCertsResponse) @@ -5859,7 +5619,7 @@ def test_fetch_ca_certs_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5867,7 +5627,6 @@ def test_fetch_ca_certs_empty_call(): client.fetch_ca_certs() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCaCertsRequest() @@ -5876,7 +5635,7 @@ async def test_fetch_ca_certs_async( transport: str = "grpc_asyncio", request_type=service.FetchCaCertsRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5889,13 +5648,11 @@ async def test_fetch_ca_certs_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCaCertsResponse() ) - response = await client.fetch_ca_certs(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCaCertsRequest() # Establish that the response is the type that we expect. @@ -5909,18 +5666,18 @@ async def test_fetch_ca_certs_async_from_dict(): def test_fetch_ca_certs_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCaCertsRequest() + request.ca_pool = "ca_pool/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_ca_certs), "__call__") as call: call.return_value = service.FetchCaCertsResponse() - client.fetch_ca_certs(request) # Establish that the underlying gRPC stub method was called. @@ -5936,12 +5693,13 @@ def test_fetch_ca_certs_field_headers(): @pytest.mark.asyncio async def test_fetch_ca_certs_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCaCertsRequest() + request.ca_pool = "ca_pool/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5949,7 +5707,6 @@ async def test_fetch_ca_certs_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCaCertsResponse() ) - await client.fetch_ca_certs(request) # Establish that the underlying gRPC stub method was called. @@ -5964,14 +5721,13 @@ async def test_fetch_ca_certs_field_headers_async(): def test_fetch_ca_certs_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_ca_certs), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = service.FetchCaCertsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.fetch_ca_certs(ca_pool="ca_pool_value",) @@ -5980,13 +5736,12 @@ def test_fetch_ca_certs_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].ca_pool == "ca_pool_value" def test_fetch_ca_certs_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6000,7 +5755,7 @@ def test_fetch_ca_certs_flattened_error(): @pytest.mark.asyncio async def test_fetch_ca_certs_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6019,14 +5774,13 @@ async def test_fetch_ca_certs_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].ca_pool == "ca_pool_value" @pytest.mark.asyncio async def test_fetch_ca_certs_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6041,7 +5795,7 @@ def test_get_certificate_revocation_list( transport: str = "grpc", request_type=service.GetCertificateRevocationListRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6061,29 +5815,20 @@ def test_get_certificate_revocation_list( state=resources.CertificateRevocationList.State.ACTIVE, revision_id="revision_id_value", ) - response = client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CertificateRevocationList) - assert response.name == "name_value" - assert response.sequence_number == 1601 - assert response.pem_crl == "pem_crl_value" - assert response.access_url == "access_url_value" - assert response.state == resources.CertificateRevocationList.State.ACTIVE - assert response.revision_id == "revision_id_value" @@ -6095,7 +5840,7 @@ def test_get_certificate_revocation_list_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6105,7 +5850,6 @@ def test_get_certificate_revocation_list_empty_call(): client.get_certificate_revocation_list() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() @@ -6115,7 +5859,7 @@ async def test_get_certificate_revocation_list_async( request_type=service.GetCertificateRevocationListRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6137,28 +5881,20 @@ async def test_get_certificate_revocation_list_async( revision_id="revision_id_value", ) ) - response = await client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CertificateRevocationList) - assert response.name == "name_value" - assert response.sequence_number == 1601 - assert response.pem_crl == "pem_crl_value" - assert response.access_url == "access_url_value" - assert response.state == resources.CertificateRevocationList.State.ACTIVE - assert response.revision_id == "revision_id_value" @@ -6169,12 +5905,13 @@ async def test_get_certificate_revocation_list_async_from_dict(): def test_get_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRevocationListRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6182,7 +5919,6 @@ def test_get_certificate_revocation_list_field_headers(): type(client.transport.get_certificate_revocation_list), "__call__" ) as call: call.return_value = resources.CertificateRevocationList() - client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -6198,12 +5934,13 @@ def test_get_certificate_revocation_list_field_headers(): @pytest.mark.asyncio async def test_get_certificate_revocation_list_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRevocationListRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6213,7 +5950,6 @@ async def test_get_certificate_revocation_list_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CertificateRevocationList() ) - await client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -6228,7 +5964,7 @@ async def test_get_certificate_revocation_list_field_headers_async(): def test_get_certificate_revocation_list_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6237,7 +5973,6 @@ def test_get_certificate_revocation_list_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.CertificateRevocationList() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate_revocation_list(name="name_value",) @@ -6246,13 +5981,12 @@ def test_get_certificate_revocation_list_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_revocation_list_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6266,7 +6000,7 @@ def test_get_certificate_revocation_list_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_revocation_list_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6287,14 +6021,13 @@ async def test_get_certificate_revocation_list_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_revocation_list_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6309,7 +6042,7 @@ def test_list_certificate_revocation_lists( transport: str = "grpc", request_type=service.ListCertificateRevocationListsRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6324,21 +6057,16 @@ def test_list_certificate_revocation_lists( call.return_value = service.ListCertificateRevocationListsResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificateRevocationListsPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -6350,7 +6078,7 @@ def test_list_certificate_revocation_lists_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6360,7 +6088,6 @@ def test_list_certificate_revocation_lists_empty_call(): client.list_certificate_revocation_lists() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() @@ -6370,7 +6097,7 @@ async def test_list_certificate_revocation_lists_async( request_type=service.ListCertificateRevocationListsRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6388,20 +6115,16 @@ async def test_list_certificate_revocation_lists_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificateRevocationListsAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -6412,12 +6135,13 @@ async def test_list_certificate_revocation_lists_async_from_dict(): def test_list_certificate_revocation_lists_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateRevocationListsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6425,7 +6149,6 @@ def test_list_certificate_revocation_lists_field_headers(): type(client.transport.list_certificate_revocation_lists), "__call__" ) as call: call.return_value = service.ListCertificateRevocationListsResponse() - client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. @@ -6441,12 +6164,13 @@ def test_list_certificate_revocation_lists_field_headers(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateRevocationListsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6456,7 +6180,6 @@ async def test_list_certificate_revocation_lists_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificateRevocationListsResponse() ) - await client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. @@ -6471,7 +6194,7 @@ async def test_list_certificate_revocation_lists_field_headers_async(): def test_list_certificate_revocation_lists_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6480,7 +6203,6 @@ def test_list_certificate_revocation_lists_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificateRevocationListsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificate_revocation_lists(parent="parent_value",) @@ -6489,13 +6211,12 @@ def test_list_certificate_revocation_lists_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificate_revocation_lists_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6509,7 +6230,7 @@ def test_list_certificate_revocation_lists_flattened_error(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6532,14 +6253,13 @@ async def test_list_certificate_revocation_lists_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificate_revocation_lists_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6552,7 +6272,7 @@ async def test_list_certificate_revocation_lists_flattened_error_async(): def test_list_certificate_revocation_lists_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6600,7 +6320,7 @@ def test_list_certificate_revocation_lists_pager(): def test_list_certificate_revocation_lists_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6640,7 +6360,7 @@ def test_list_certificate_revocation_lists_pages(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6689,7 +6409,7 @@ async def test_list_certificate_revocation_lists_async_pager(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6736,7 +6456,7 @@ def test_update_certificate_revocation_list( transport: str = "grpc", request_type=service.UpdateCertificateRevocationListRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6749,13 +6469,11 @@ def test_update_certificate_revocation_list( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() # Establish that the response is the type that we expect. @@ -6770,7 +6488,7 @@ def test_update_certificate_revocation_list_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6780,7 +6498,6 @@ def test_update_certificate_revocation_list_empty_call(): client.update_certificate_revocation_list() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() @@ -6790,7 +6507,7 @@ async def test_update_certificate_revocation_list_async( request_type=service.UpdateCertificateRevocationListRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6805,13 +6522,11 @@ async def test_update_certificate_revocation_list_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() # Establish that the response is the type that we expect. @@ -6825,12 +6540,13 @@ async def test_update_certificate_revocation_list_async_from_dict(): def test_update_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRevocationListRequest() + request.certificate_revocation_list.name = "certificate_revocation_list.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6838,7 +6554,6 @@ def test_update_certificate_revocation_list_field_headers(): type(client.transport.update_certificate_revocation_list), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -6857,12 +6572,13 @@ def test_update_certificate_revocation_list_field_headers(): @pytest.mark.asyncio async def test_update_certificate_revocation_list_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRevocationListRequest() + request.certificate_revocation_list.name = "certificate_revocation_list.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6872,7 +6588,6 @@ async def test_update_certificate_revocation_list_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -6890,7 +6605,7 @@ async def test_update_certificate_revocation_list_field_headers_async(): def test_update_certificate_revocation_list_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6899,33 +6614,30 @@ def test_update_certificate_revocation_list_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate_revocation_list( certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[ 0 ].certificate_revocation_list == resources.CertificateRevocationList( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_revocation_list_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6936,14 +6648,14 @@ def test_update_certificate_revocation_list_flattened_error(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_revocation_list_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6962,27 +6674,25 @@ async def test_update_certificate_revocation_list_flattened_async(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[ 0 ].certificate_revocation_list == resources.CertificateRevocationList( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_revocation_list_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6993,7 +6703,7 @@ async def test_update_certificate_revocation_list_flattened_error_async(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -7001,7 +6711,7 @@ def test_create_certificate_template( transport: str = "grpc", request_type=service.CreateCertificateTemplateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7014,13 +6724,11 @@ def test_create_certificate_template( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -7035,7 +6743,7 @@ def test_create_certificate_template_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7045,7 +6753,6 @@ def test_create_certificate_template_empty_call(): client.create_certificate_template() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateTemplateRequest() @@ -7055,7 +6762,7 @@ async def test_create_certificate_template_async( request_type=service.CreateCertificateTemplateRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7070,13 +6777,11 @@ async def test_create_certificate_template_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.create_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -7090,12 +6795,13 @@ async def test_create_certificate_template_async_from_dict(): def test_create_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateTemplateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7103,7 +6809,6 @@ def test_create_certificate_template_field_headers(): type(client.transport.create_certificate_template), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.create_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7119,12 +6824,13 @@ def test_create_certificate_template_field_headers(): @pytest.mark.asyncio async def test_create_certificate_template_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateTemplateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7134,7 +6840,6 @@ async def test_create_certificate_template_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.create_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7149,7 +6854,7 @@ async def test_create_certificate_template_field_headers_async(): def test_create_certificate_template_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7158,7 +6863,6 @@ def test_create_certificate_template_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_certificate_template( @@ -7171,19 +6875,16 @@ def test_create_certificate_template_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_template == resources.CertificateTemplate( name="name_value" ) - assert args[0].certificate_template_id == "certificate_template_id_value" def test_create_certificate_template_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7200,7 +6901,7 @@ def test_create_certificate_template_flattened_error(): @pytest.mark.asyncio async def test_create_certificate_template_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7225,20 +6926,17 @@ async def test_create_certificate_template_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_template == resources.CertificateTemplate( name="name_value" ) - assert args[0].certificate_template_id == "certificate_template_id_value" @pytest.mark.asyncio async def test_create_certificate_template_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7256,7 +6954,7 @@ def test_delete_certificate_template( transport: str = "grpc", request_type=service.DeleteCertificateTemplateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7269,13 +6967,11 @@ def test_delete_certificate_template( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -7290,7 +6986,7 @@ def test_delete_certificate_template_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7300,7 +6996,6 @@ def test_delete_certificate_template_empty_call(): client.delete_certificate_template() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateTemplateRequest() @@ -7310,7 +7005,7 @@ async def test_delete_certificate_template_async( request_type=service.DeleteCertificateTemplateRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7325,13 +7020,11 @@ async def test_delete_certificate_template_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.delete_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -7345,12 +7038,13 @@ async def test_delete_certificate_template_async_from_dict(): def test_delete_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCertificateTemplateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7358,7 +7052,6 @@ def test_delete_certificate_template_field_headers(): type(client.transport.delete_certificate_template), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7374,12 +7067,13 @@ def test_delete_certificate_template_field_headers(): @pytest.mark.asyncio async def test_delete_certificate_template_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DeleteCertificateTemplateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7389,7 +7083,6 @@ async def test_delete_certificate_template_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.delete_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7404,7 +7097,7 @@ async def test_delete_certificate_template_field_headers_async(): def test_delete_certificate_template_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7413,7 +7106,6 @@ def test_delete_certificate_template_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_certificate_template(name="name_value",) @@ -7422,13 +7114,12 @@ def test_delete_certificate_template_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_delete_certificate_template_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7442,7 +7133,7 @@ def test_delete_certificate_template_flattened_error(): @pytest.mark.asyncio async def test_delete_certificate_template_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7463,14 +7154,13 @@ async def test_delete_certificate_template_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_delete_certificate_template_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7485,7 +7175,7 @@ def test_get_certificate_template( transport: str = "grpc", request_type=service.GetCertificateTemplateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7500,21 +7190,16 @@ def test_get_certificate_template( call.return_value = resources.CertificateTemplate( name="name_value", description="description_value", ) - response = client.get_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateTemplateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CertificateTemplate) - assert response.name == "name_value" - assert response.description == "description_value" @@ -7526,7 +7211,7 @@ def test_get_certificate_template_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7536,7 +7221,6 @@ def test_get_certificate_template_empty_call(): client.get_certificate_template() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateTemplateRequest() @@ -7545,7 +7229,7 @@ async def test_get_certificate_template_async( transport: str = "grpc_asyncio", request_type=service.GetCertificateTemplateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7562,20 +7246,16 @@ async def test_get_certificate_template_async( name="name_value", description="description_value", ) ) - response = await client.get_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateTemplateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CertificateTemplate) - assert response.name == "name_value" - assert response.description == "description_value" @@ -7586,12 +7266,13 @@ async def test_get_certificate_template_async_from_dict(): def test_get_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateTemplateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7599,7 +7280,6 @@ def test_get_certificate_template_field_headers(): type(client.transport.get_certificate_template), "__call__" ) as call: call.return_value = resources.CertificateTemplate() - client.get_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7615,12 +7295,13 @@ def test_get_certificate_template_field_headers(): @pytest.mark.asyncio async def test_get_certificate_template_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateTemplateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7630,7 +7311,6 @@ async def test_get_certificate_template_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CertificateTemplate() ) - await client.get_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -7645,7 +7325,7 @@ async def test_get_certificate_template_field_headers_async(): def test_get_certificate_template_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7654,7 +7334,6 @@ def test_get_certificate_template_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.CertificateTemplate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate_template(name="name_value",) @@ -7663,13 +7342,12 @@ def test_get_certificate_template_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_template_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7683,7 +7361,7 @@ def test_get_certificate_template_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_template_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7704,14 +7382,13 @@ async def test_get_certificate_template_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_template_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7726,7 +7403,7 @@ def test_list_certificate_templates( transport: str = "grpc", request_type=service.ListCertificateTemplatesRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7741,21 +7418,16 @@ def test_list_certificate_templates( call.return_value = service.ListCertificateTemplatesResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificate_templates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateTemplatesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificateTemplatesPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -7767,7 +7439,7 @@ def test_list_certificate_templates_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7777,7 +7449,6 @@ def test_list_certificate_templates_empty_call(): client.list_certificate_templates() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateTemplatesRequest() @@ -7787,7 +7458,7 @@ async def test_list_certificate_templates_async( request_type=service.ListCertificateTemplatesRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7805,20 +7476,16 @@ async def test_list_certificate_templates_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificate_templates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateTemplatesRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificateTemplatesAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -7829,12 +7496,13 @@ async def test_list_certificate_templates_async_from_dict(): def test_list_certificate_templates_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateTemplatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7842,7 +7510,6 @@ def test_list_certificate_templates_field_headers(): type(client.transport.list_certificate_templates), "__call__" ) as call: call.return_value = service.ListCertificateTemplatesResponse() - client.list_certificate_templates(request) # Establish that the underlying gRPC stub method was called. @@ -7858,12 +7525,13 @@ def test_list_certificate_templates_field_headers(): @pytest.mark.asyncio async def test_list_certificate_templates_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateTemplatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7873,7 +7541,6 @@ async def test_list_certificate_templates_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificateTemplatesResponse() ) - await client.list_certificate_templates(request) # Establish that the underlying gRPC stub method was called. @@ -7888,7 +7555,7 @@ async def test_list_certificate_templates_field_headers_async(): def test_list_certificate_templates_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7897,7 +7564,6 @@ def test_list_certificate_templates_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificateTemplatesResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificate_templates(parent="parent_value",) @@ -7906,13 +7572,12 @@ def test_list_certificate_templates_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificate_templates_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7926,7 +7591,7 @@ def test_list_certificate_templates_flattened_error(): @pytest.mark.asyncio async def test_list_certificate_templates_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7947,14 +7612,13 @@ async def test_list_certificate_templates_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificate_templates_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7967,7 +7631,7 @@ async def test_list_certificate_templates_flattened_error_async(): def test_list_certificate_templates_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8015,7 +7679,7 @@ def test_list_certificate_templates_pager(): def test_list_certificate_templates_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8055,7 +7719,7 @@ def test_list_certificate_templates_pages(): @pytest.mark.asyncio async def test_list_certificate_templates_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8102,7 +7766,7 @@ async def test_list_certificate_templates_async_pager(): @pytest.mark.asyncio async def test_list_certificate_templates_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8147,7 +7811,7 @@ def test_update_certificate_template( transport: str = "grpc", request_type=service.UpdateCertificateTemplateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8160,13 +7824,11 @@ def test_update_certificate_template( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -8181,7 +7843,7 @@ def test_update_certificate_template_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8191,7 +7853,6 @@ def test_update_certificate_template_empty_call(): client.update_certificate_template() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateTemplateRequest() @@ -8201,7 +7862,7 @@ async def test_update_certificate_template_async( request_type=service.UpdateCertificateTemplateRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8216,13 +7877,11 @@ async def test_update_certificate_template_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_certificate_template(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateTemplateRequest() # Establish that the response is the type that we expect. @@ -8236,12 +7895,13 @@ async def test_update_certificate_template_async_from_dict(): def test_update_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateTemplateRequest() + request.certificate_template.name = "certificate_template.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8249,7 +7909,6 @@ def test_update_certificate_template_field_headers(): type(client.transport.update_certificate_template), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -8268,12 +7927,13 @@ def test_update_certificate_template_field_headers(): @pytest.mark.asyncio async def test_update_certificate_template_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateTemplateRequest() + request.certificate_template.name = "certificate_template.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8283,7 +7943,6 @@ async def test_update_certificate_template_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_certificate_template(request) # Establish that the underlying gRPC stub method was called. @@ -8301,7 +7960,7 @@ async def test_update_certificate_template_field_headers_async(): def test_update_certificate_template_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8310,29 +7969,26 @@ def test_update_certificate_template_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate_template( certificate_template=resources.CertificateTemplate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].certificate_template == resources.CertificateTemplate( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_template_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8341,14 +7997,14 @@ def test_update_certificate_template_flattened_error(): client.update_certificate_template( service.UpdateCertificateTemplateRequest(), certificate_template=resources.CertificateTemplate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_template_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8365,25 +8021,23 @@ async def test_update_certificate_template_flattened_async(): # using the keyword arguments to the method. response = await client.update_certificate_template( certificate_template=resources.CertificateTemplate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].certificate_template == resources.CertificateTemplate( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_template_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8392,23 +8046,23 @@ async def test_update_certificate_template_flattened_error_async(): await client.update_certificate_template( service.UpdateCertificateTemplateRequest(), certificate_template=resources.CertificateTemplate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( @@ -8418,7 +8072,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( @@ -8429,7 +8083,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CertificateAuthorityServiceClient(transport=transport) assert client.transport is transport @@ -8438,13 +8092,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -8459,8 +8113,8 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -8468,7 +8122,7 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, transports.CertificateAuthorityServiceGrpcTransport, @@ -8477,9 +8131,9 @@ def test_transport_grpc_default(): def test_certificate_authority_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CertificateAuthorityServiceTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -8491,7 +8145,7 @@ def test_certificate_authority_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CertificateAuthorityServiceTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -8537,15 +8191,37 @@ def test_certificate_authority_service_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_certificate_authority_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CertificateAuthorityServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id="octopus", + ) + + +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_base_transport_with_credentials_file_old_google_auth(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True ) as load_creds, mock.patch( "google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (credentials.AnonymousCredentials(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CertificateAuthorityServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -8558,19 +8234,33 @@ def test_certificate_authority_service_base_transport_with_credentials_file(): def test_certificate_authority_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( "google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CertificateAuthorityServiceTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_certificate_authority_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + CertificateAuthorityServiceClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id=None, + ) + + +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_auth_adc_old_google_auth(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CertificateAuthorityServiceClient() adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), @@ -8578,20 +8268,169 @@ def test_certificate_authority_service_auth_adc(): ) -def test_certificate_authority_service_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +def test_certificate_authority_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.CertificateAuthorityServiceGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id="octopus", ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_transport_auth_adc_old_google_auth( + transport_class, +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus") adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), quota_project_id="octopus", ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_gte_1_26_0 +def test_certificate_authority_service_transport_create_channel( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=["1", "2"], + default_host="privateca.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_lt_1_26_0 +def test_certificate_authority_service_transport_create_channel_old_api_core( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class(quota_project_id="octopus") + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_lt_1_26_0 +def test_certificate_authority_service_transport_create_channel_user_scopes( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=["1", "2"], + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "transport_class", [ @@ -8602,7 +8441,7 @@ def test_certificate_authority_service_transport_auth_adc(): def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -8641,7 +8480,7 @@ def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtl def test_certificate_authority_service_host_no_port(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="privateca.googleapis.com" ), @@ -8651,7 +8490,7 @@ def test_certificate_authority_service_host_no_port(): def test_certificate_authority_service_host_with_port(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="privateca.googleapis.com:8000" ), @@ -8707,9 +8546,9 @@ def test_certificate_authority_service_transport_channel_mtls_with_client_cert_s mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -8785,7 +8624,7 @@ def test_certificate_authority_service_transport_channel_mtls_with_adc(transport def test_certificate_authority_service_grpc_lro_client(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8798,7 +8637,7 @@ def test_certificate_authority_service_grpc_lro_client(): def test_certificate_authority_service_grpc_lro_async_client(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8813,7 +8652,6 @@ def test_ca_pool_path(): project = "squid" location = "clam" ca_pool = "whelk" - expected = "projects/{project}/locations/{location}/caPools/{ca_pool}".format( project=project, location=location, ca_pool=ca_pool, ) @@ -8839,7 +8677,6 @@ def test_certificate_path(): location = "mussel" ca_pool = "winkle" certificate = "nautilus" - expected = "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}".format( project=project, location=location, ca_pool=ca_pool, certificate=certificate, ) @@ -8868,7 +8705,6 @@ def test_certificate_authority_path(): location = "octopus" ca_pool = "oyster" certificate_authority = "nudibranch" - expected = "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format( project=project, location=location, @@ -8901,7 +8737,6 @@ def test_certificate_revocation_list_path(): ca_pool = "squid" certificate_authority = "clam" certificate_revocation_list = "whelk" - expected = "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}".format( project=project, location=location, @@ -8938,7 +8773,6 @@ def test_certificate_template_path(): project = "winkle" location = "nautilus" certificate_template = "scallop" - expected = "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}".format( project=project, location=location, certificate_template=certificate_template, ) @@ -8963,7 +8797,6 @@ def test_parse_certificate_template_path(): def test_common_billing_account_path(): billing_account = "whelk" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -8986,7 +8819,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) actual = CertificateAuthorityServiceClient.common_folder_path(folder) assert expected == actual @@ -9005,7 +8837,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) actual = CertificateAuthorityServiceClient.common_organization_path(organization) assert expected == actual @@ -9024,7 +8855,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) actual = CertificateAuthorityServiceClient.common_project_path(project) assert expected == actual @@ -9044,7 +8874,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "scallop" location = "abalone" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -9071,7 +8900,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.CertificateAuthorityServiceTransport, "_prep_wrapped_messages" ) as prep: client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -9080,6 +8909,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = CertificateAuthorityServiceClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/privateca_v1beta1/__init__.py b/tests/unit/gapic/privateca_v1beta1/__init__.py index 42ffdf2..4de6597 100644 --- a/tests/unit/gapic/privateca_v1beta1/__init__.py +++ b/tests/unit/gapic/privateca_v1beta1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py b/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py index 95f86bf..e0f948a 100644 --- a/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py +++ b/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,16 +23,16 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +from google.api_core import exceptions as core_exceptions from google.api_core import future from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import ( CertificateAuthorityServiceAsyncClient, @@ -47,14 +46,44 @@ from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import ( transports, ) +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.base import ( + _GOOGLE_AUTH_VERSION, +) from google.cloud.security.privateca_v1beta1.types import resources from google.cloud.security.privateca_v1beta1.types import service from google.longrunning import operations_pb2 from google.oauth2 import service_account -from google.protobuf import duration_pb2 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -109,7 +138,7 @@ def test__get_default_mtls_endpoint(): [CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient,], ) def test_certificate_authority_service_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -127,7 +156,7 @@ def test_certificate_authority_service_client_from_service_account_info(client_c [CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient,], ) def test_certificate_authority_service_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -186,7 +215,7 @@ def test_certificate_authority_service_client_client_options( with mock.patch.object( CertificateAuthorityServiceClient, "get_transport_class" ) as gtc: - transport = transport_class(credentials=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -494,7 +523,7 @@ def test_create_certificate( transport: str = "grpc", request_type=service.CreateCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -512,23 +541,17 @@ def test_create_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.create_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -540,7 +563,7 @@ def test_create_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -550,7 +573,6 @@ def test_create_certificate_empty_call(): client.create_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() @@ -559,7 +581,7 @@ async def test_create_certificate_async( transport: str = "grpc_asyncio", request_type=service.CreateCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -578,22 +600,17 @@ async def test_create_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.create_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -604,12 +621,13 @@ async def test_create_certificate_async_from_dict(): def test_create_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -617,7 +635,6 @@ def test_create_certificate_field_headers(): type(client.transport.create_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.create_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -633,12 +650,13 @@ def test_create_certificate_field_headers(): @pytest.mark.asyncio async def test_create_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -648,7 +666,6 @@ async def test_create_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.create_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -663,7 +680,7 @@ async def test_create_certificate_field_headers_async(): def test_create_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -672,7 +689,6 @@ def test_create_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_certificate( @@ -685,17 +701,14 @@ def test_create_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate == resources.Certificate(name="name_value") - assert args[0].certificate_id == "certificate_id_value" def test_create_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -712,7 +725,7 @@ def test_create_certificate_flattened_error(): @pytest.mark.asyncio async def test_create_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -737,18 +750,15 @@ async def test_create_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate == resources.Certificate(name="name_value") - assert args[0].certificate_id == "certificate_id_value" @pytest.mark.asyncio async def test_create_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -766,7 +776,7 @@ def test_get_certificate( transport: str = "grpc", request_type=service.GetCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -782,23 +792,17 @@ def test_get_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.get_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -810,7 +814,7 @@ def test_get_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -818,7 +822,6 @@ def test_get_certificate_empty_call(): client.get_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() @@ -827,7 +830,7 @@ async def test_get_certificate_async( transport: str = "grpc_asyncio", request_type=service.GetCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -844,22 +847,17 @@ async def test_get_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.get_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -870,18 +868,18 @@ async def test_get_certificate_async_from_dict(): def test_get_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_certificate), "__call__") as call: call.return_value = resources.Certificate() - client.get_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -897,12 +895,13 @@ def test_get_certificate_field_headers(): @pytest.mark.asyncio async def test_get_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -910,7 +909,6 @@ async def test_get_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.get_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -925,14 +923,13 @@ async def test_get_certificate_field_headers_async(): def test_get_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_certificate), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate(name="name_value",) @@ -941,13 +938,12 @@ def test_get_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -961,7 +957,7 @@ def test_get_certificate_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -980,14 +976,13 @@ async def test_get_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1002,7 +997,7 @@ def test_list_certificates( transport: str = "grpc", request_type=service.ListCertificatesRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1017,21 +1012,16 @@ def test_list_certificates( call.return_value = service.ListCertificatesResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificatesPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -1043,7 +1033,7 @@ def test_list_certificates_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1053,7 +1043,6 @@ def test_list_certificates_empty_call(): client.list_certificates() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() @@ -1062,7 +1051,7 @@ async def test_list_certificates_async( transport: str = "grpc_asyncio", request_type=service.ListCertificatesRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1080,20 +1069,16 @@ async def test_list_certificates_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificates(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificatesAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -1104,12 +1089,13 @@ async def test_list_certificates_async_from_dict(): def test_list_certificates_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1117,7 +1103,6 @@ def test_list_certificates_field_headers(): type(client.transport.list_certificates), "__call__" ) as call: call.return_value = service.ListCertificatesResponse() - client.list_certificates(request) # Establish that the underlying gRPC stub method was called. @@ -1133,12 +1118,13 @@ def test_list_certificates_field_headers(): @pytest.mark.asyncio async def test_list_certificates_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificatesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1148,7 +1134,6 @@ async def test_list_certificates_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificatesResponse() ) - await client.list_certificates(request) # Establish that the underlying gRPC stub method was called. @@ -1163,7 +1148,7 @@ async def test_list_certificates_field_headers_async(): def test_list_certificates_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1172,7 +1157,6 @@ def test_list_certificates_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificatesResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificates(parent="parent_value",) @@ -1181,13 +1165,12 @@ def test_list_certificates_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificates_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1201,7 +1184,7 @@ def test_list_certificates_flattened_error(): @pytest.mark.asyncio async def test_list_certificates_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1222,14 +1205,13 @@ async def test_list_certificates_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificates_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1242,7 +1224,7 @@ async def test_list_certificates_flattened_error_async(): def test_list_certificates_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1284,7 +1266,7 @@ def test_list_certificates_pager(): def test_list_certificates_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1318,7 +1300,7 @@ def test_list_certificates_pages(): @pytest.mark.asyncio async def test_list_certificates_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1359,7 +1341,7 @@ async def test_list_certificates_async_pager(): @pytest.mark.asyncio async def test_list_certificates_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1398,7 +1380,7 @@ def test_revoke_certificate( transport: str = "grpc", request_type=service.RevokeCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1416,23 +1398,17 @@ def test_revoke_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1444,7 +1420,7 @@ def test_revoke_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1454,7 +1430,6 @@ def test_revoke_certificate_empty_call(): client.revoke_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() @@ -1463,7 +1438,7 @@ async def test_revoke_certificate_async( transport: str = "grpc_asyncio", request_type=service.RevokeCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1482,22 +1457,17 @@ async def test_revoke_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1508,12 +1478,13 @@ async def test_revoke_certificate_async_from_dict(): def test_revoke_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RevokeCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1521,7 +1492,6 @@ def test_revoke_certificate_field_headers(): type(client.transport.revoke_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1537,12 +1507,13 @@ def test_revoke_certificate_field_headers(): @pytest.mark.asyncio async def test_revoke_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RevokeCertificateRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1552,7 +1523,6 @@ async def test_revoke_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.revoke_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1567,7 +1537,7 @@ async def test_revoke_certificate_field_headers_async(): def test_revoke_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1576,7 +1546,6 @@ def test_revoke_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.revoke_certificate(name="name_value",) @@ -1585,13 +1554,12 @@ def test_revoke_certificate_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_revoke_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1605,7 +1573,7 @@ def test_revoke_certificate_flattened_error(): @pytest.mark.asyncio async def test_revoke_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1626,14 +1594,13 @@ async def test_revoke_certificate_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_revoke_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1648,7 +1615,7 @@ def test_update_certificate( transport: str = "grpc", request_type=service.UpdateCertificateRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1666,23 +1633,17 @@ def test_update_certificate( pem_certificate_chain=["pem_certificate_chain_value"], pem_csr="pem_csr_value", ) - response = client.update_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1694,7 +1655,7 @@ def test_update_certificate_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1704,7 +1665,6 @@ def test_update_certificate_empty_call(): client.update_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() @@ -1713,7 +1673,7 @@ async def test_update_certificate_async( transport: str = "grpc_asyncio", request_type=service.UpdateCertificateRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1732,22 +1692,17 @@ async def test_update_certificate_async( pem_certificate_chain=["pem_certificate_chain_value"], ) ) - response = await client.update_certificate(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.Certificate) - assert response.name == "name_value" - assert response.pem_certificate == "pem_certificate_value" - assert response.pem_certificate_chain == ["pem_certificate_chain_value"] @@ -1758,12 +1713,13 @@ async def test_update_certificate_async_from_dict(): def test_update_certificate_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRequest() + request.certificate.name = "certificate.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1771,7 +1727,6 @@ def test_update_certificate_field_headers(): type(client.transport.update_certificate), "__call__" ) as call: call.return_value = resources.Certificate() - client.update_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1789,12 +1744,13 @@ def test_update_certificate_field_headers(): @pytest.mark.asyncio async def test_update_certificate_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRequest() + request.certificate.name = "certificate.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1804,7 +1760,6 @@ async def test_update_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.Certificate() ) - await client.update_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1821,7 +1776,7 @@ async def test_update_certificate_field_headers_async(): def test_update_certificate_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1830,27 +1785,24 @@ def test_update_certificate_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.Certificate() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate( certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].certificate == resources.Certificate(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1859,14 +1811,14 @@ def test_update_certificate_flattened_error(): client.update_certificate( service.UpdateCertificateRequest(), certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1883,23 +1835,21 @@ async def test_update_certificate_flattened_async(): # using the keyword arguments to the method. response = await client.update_certificate( certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].certificate == resources.Certificate(name="name_value") - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1908,7 +1858,7 @@ async def test_update_certificate_flattened_error_async(): await client.update_certificate( service.UpdateCertificateRequest(), certificate=resources.Certificate(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -1916,7 +1866,7 @@ def test_activate_certificate_authority( transport: str = "grpc", request_type=service.ActivateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1929,13 +1879,11 @@ def test_activate_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -1950,7 +1898,7 @@ def test_activate_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1960,7 +1908,6 @@ def test_activate_certificate_authority_empty_call(): client.activate_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() @@ -1970,7 +1917,7 @@ async def test_activate_certificate_authority_async( request_type=service.ActivateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1985,13 +1932,11 @@ async def test_activate_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2005,12 +1950,13 @@ async def test_activate_certificate_authority_async_from_dict(): def test_activate_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ActivateCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2018,7 +1964,6 @@ def test_activate_certificate_authority_field_headers(): type(client.transport.activate_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2034,12 +1979,13 @@ def test_activate_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_activate_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ActivateCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2049,7 +1995,6 @@ async def test_activate_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.activate_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2064,7 +2009,7 @@ async def test_activate_certificate_authority_field_headers_async(): def test_activate_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2073,7 +2018,6 @@ def test_activate_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.activate_certificate_authority(name="name_value",) @@ -2082,13 +2026,12 @@ def test_activate_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_activate_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2102,7 +2045,7 @@ def test_activate_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_activate_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2123,14 +2066,13 @@ async def test_activate_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_activate_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2145,7 +2087,7 @@ def test_create_certificate_authority( transport: str = "grpc", request_type=service.CreateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2158,13 +2100,11 @@ def test_create_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2179,7 +2119,7 @@ def test_create_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2189,7 +2129,6 @@ def test_create_certificate_authority_empty_call(): client.create_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() @@ -2199,7 +2138,7 @@ async def test_create_certificate_authority_async( request_type=service.CreateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2214,13 +2153,11 @@ async def test_create_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2234,12 +2171,13 @@ async def test_create_certificate_authority_async_from_dict(): def test_create_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateAuthorityRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2247,7 +2185,6 @@ def test_create_certificate_authority_field_headers(): type(client.transport.create_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2263,12 +2200,13 @@ def test_create_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_create_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.CreateCertificateAuthorityRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2278,7 +2216,6 @@ async def test_create_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.create_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2293,7 +2230,7 @@ async def test_create_certificate_authority_field_headers_async(): def test_create_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2302,7 +2239,6 @@ def test_create_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_certificate_authority( @@ -2315,19 +2251,16 @@ def test_create_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - assert args[0].certificate_authority_id == "certificate_authority_id_value" def test_create_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2344,7 +2277,7 @@ def test_create_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_create_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2369,20 +2302,17 @@ async def test_create_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - assert args[0].certificate_authority_id == "certificate_authority_id_value" @pytest.mark.asyncio async def test_create_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2400,7 +2330,7 @@ def test_disable_certificate_authority( transport: str = "grpc", request_type=service.DisableCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2413,13 +2343,11 @@ def test_disable_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2434,7 +2362,7 @@ def test_disable_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2444,7 +2372,6 @@ def test_disable_certificate_authority_empty_call(): client.disable_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() @@ -2454,7 +2381,7 @@ async def test_disable_certificate_authority_async( request_type=service.DisableCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2469,13 +2396,11 @@ async def test_disable_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2489,12 +2414,13 @@ async def test_disable_certificate_authority_async_from_dict(): def test_disable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DisableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2502,7 +2428,6 @@ def test_disable_certificate_authority_field_headers(): type(client.transport.disable_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2518,12 +2443,13 @@ def test_disable_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_disable_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.DisableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2533,7 +2459,6 @@ async def test_disable_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.disable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2548,7 +2473,7 @@ async def test_disable_certificate_authority_field_headers_async(): def test_disable_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2557,7 +2482,6 @@ def test_disable_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.disable_certificate_authority(name="name_value",) @@ -2566,13 +2490,12 @@ def test_disable_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_disable_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2586,7 +2509,7 @@ def test_disable_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_disable_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2607,14 +2530,13 @@ async def test_disable_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_disable_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2629,7 +2551,7 @@ def test_enable_certificate_authority( transport: str = "grpc", request_type=service.EnableCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2642,13 +2564,11 @@ def test_enable_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2663,7 +2583,7 @@ def test_enable_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2673,7 +2593,6 @@ def test_enable_certificate_authority_empty_call(): client.enable_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() @@ -2683,7 +2602,7 @@ async def test_enable_certificate_authority_async( request_type=service.EnableCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2698,13 +2617,11 @@ async def test_enable_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -2718,12 +2635,13 @@ async def test_enable_certificate_authority_async_from_dict(): def test_enable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.EnableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2731,7 +2649,6 @@ def test_enable_certificate_authority_field_headers(): type(client.transport.enable_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2747,12 +2664,13 @@ def test_enable_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_enable_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.EnableCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2762,7 +2680,6 @@ async def test_enable_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.enable_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -2777,7 +2694,7 @@ async def test_enable_certificate_authority_field_headers_async(): def test_enable_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2786,7 +2703,6 @@ def test_enable_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.enable_certificate_authority(name="name_value",) @@ -2795,13 +2711,12 @@ def test_enable_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_enable_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2815,7 +2730,7 @@ def test_enable_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_enable_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2836,14 +2751,13 @@ async def test_enable_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_enable_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2858,7 +2772,7 @@ def test_fetch_certificate_authority_csr( transport: str = "grpc", request_type=service.FetchCertificateAuthorityCsrRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2873,19 +2787,15 @@ def test_fetch_certificate_authority_csr( call.return_value = service.FetchCertificateAuthorityCsrResponse( pem_csr="pem_csr_value", ) - response = client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() # Establish that the response is the type that we expect. - assert isinstance(response, service.FetchCertificateAuthorityCsrResponse) - assert response.pem_csr == "pem_csr_value" @@ -2897,7 +2807,7 @@ def test_fetch_certificate_authority_csr_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2907,7 +2817,6 @@ def test_fetch_certificate_authority_csr_empty_call(): client.fetch_certificate_authority_csr() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() @@ -2917,7 +2826,7 @@ async def test_fetch_certificate_authority_csr_async( request_type=service.FetchCertificateAuthorityCsrRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2932,18 +2841,15 @@ async def test_fetch_certificate_authority_csr_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCertificateAuthorityCsrResponse(pem_csr="pem_csr_value",) ) - response = await client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() # Establish that the response is the type that we expect. assert isinstance(response, service.FetchCertificateAuthorityCsrResponse) - assert response.pem_csr == "pem_csr_value" @@ -2954,12 +2860,13 @@ async def test_fetch_certificate_authority_csr_async_from_dict(): def test_fetch_certificate_authority_csr_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCertificateAuthorityCsrRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2967,7 +2874,6 @@ def test_fetch_certificate_authority_csr_field_headers(): type(client.transport.fetch_certificate_authority_csr), "__call__" ) as call: call.return_value = service.FetchCertificateAuthorityCsrResponse() - client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. @@ -2983,12 +2889,13 @@ def test_fetch_certificate_authority_csr_field_headers(): @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.FetchCertificateAuthorityCsrRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2998,7 +2905,6 @@ async def test_fetch_certificate_authority_csr_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.FetchCertificateAuthorityCsrResponse() ) - await client.fetch_certificate_authority_csr(request) # Establish that the underlying gRPC stub method was called. @@ -3013,7 +2919,7 @@ async def test_fetch_certificate_authority_csr_field_headers_async(): def test_fetch_certificate_authority_csr_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3022,7 +2928,6 @@ def test_fetch_certificate_authority_csr_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.FetchCertificateAuthorityCsrResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.fetch_certificate_authority_csr(name="name_value",) @@ -3031,13 +2936,12 @@ def test_fetch_certificate_authority_csr_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_fetch_certificate_authority_csr_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3051,7 +2955,7 @@ def test_fetch_certificate_authority_csr_flattened_error(): @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3072,14 +2976,13 @@ async def test_fetch_certificate_authority_csr_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_fetch_certificate_authority_csr_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3094,7 +2997,7 @@ def test_get_certificate_authority( transport: str = "grpc", request_type=service.GetCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3114,29 +3017,20 @@ def test_get_certificate_authority( pem_ca_certificates=["pem_ca_certificates_value"], gcs_bucket="gcs_bucket_value", ) - response = client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CertificateAuthority) - assert response.name == "name_value" - assert response.type_ == resources.CertificateAuthority.Type.SELF_SIGNED - assert response.tier == resources.CertificateAuthority.Tier.ENTERPRISE - assert response.state == resources.CertificateAuthority.State.ENABLED - assert response.pem_ca_certificates == ["pem_ca_certificates_value"] - assert response.gcs_bucket == "gcs_bucket_value" @@ -3148,7 +3042,7 @@ def test_get_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3158,7 +3052,6 @@ def test_get_certificate_authority_empty_call(): client.get_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() @@ -3167,7 +3060,7 @@ async def test_get_certificate_authority_async( transport: str = "grpc_asyncio", request_type=service.GetCertificateAuthorityRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3189,28 +3082,20 @@ async def test_get_certificate_authority_async( gcs_bucket="gcs_bucket_value", ) ) - response = await client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CertificateAuthority) - assert response.name == "name_value" - assert response.type_ == resources.CertificateAuthority.Type.SELF_SIGNED - assert response.tier == resources.CertificateAuthority.Tier.ENTERPRISE - assert response.state == resources.CertificateAuthority.State.ENABLED - assert response.pem_ca_certificates == ["pem_ca_certificates_value"] - assert response.gcs_bucket == "gcs_bucket_value" @@ -3221,12 +3106,13 @@ async def test_get_certificate_authority_async_from_dict(): def test_get_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3234,7 +3120,6 @@ def test_get_certificate_authority_field_headers(): type(client.transport.get_certificate_authority), "__call__" ) as call: call.return_value = resources.CertificateAuthority() - client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3250,12 +3135,13 @@ def test_get_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_get_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3265,7 +3151,6 @@ async def test_get_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CertificateAuthority() ) - await client.get_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3280,7 +3165,7 @@ async def test_get_certificate_authority_field_headers_async(): def test_get_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3289,7 +3174,6 @@ def test_get_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.CertificateAuthority() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate_authority(name="name_value",) @@ -3298,13 +3182,12 @@ def test_get_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3318,7 +3201,7 @@ def test_get_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3339,14 +3222,13 @@ async def test_get_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3361,7 +3243,7 @@ def test_list_certificate_authorities( transport: str = "grpc", request_type=service.ListCertificateAuthoritiesRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3376,21 +3258,16 @@ def test_list_certificate_authorities( call.return_value = service.ListCertificateAuthoritiesResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificateAuthoritiesPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -3402,7 +3279,7 @@ def test_list_certificate_authorities_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3412,7 +3289,6 @@ def test_list_certificate_authorities_empty_call(): client.list_certificate_authorities() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() @@ -3422,7 +3298,7 @@ async def test_list_certificate_authorities_async( request_type=service.ListCertificateAuthoritiesRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3440,20 +3316,16 @@ async def test_list_certificate_authorities_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificateAuthoritiesAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -3464,12 +3336,13 @@ async def test_list_certificate_authorities_async_from_dict(): def test_list_certificate_authorities_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateAuthoritiesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3477,7 +3350,6 @@ def test_list_certificate_authorities_field_headers(): type(client.transport.list_certificate_authorities), "__call__" ) as call: call.return_value = service.ListCertificateAuthoritiesResponse() - client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. @@ -3493,12 +3365,13 @@ def test_list_certificate_authorities_field_headers(): @pytest.mark.asyncio async def test_list_certificate_authorities_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateAuthoritiesRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3508,7 +3381,6 @@ async def test_list_certificate_authorities_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificateAuthoritiesResponse() ) - await client.list_certificate_authorities(request) # Establish that the underlying gRPC stub method was called. @@ -3523,7 +3395,7 @@ async def test_list_certificate_authorities_field_headers_async(): def test_list_certificate_authorities_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3532,7 +3404,6 @@ def test_list_certificate_authorities_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificateAuthoritiesResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificate_authorities(parent="parent_value",) @@ -3541,13 +3412,12 @@ def test_list_certificate_authorities_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificate_authorities_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3561,7 +3431,7 @@ def test_list_certificate_authorities_flattened_error(): @pytest.mark.asyncio async def test_list_certificate_authorities_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3582,14 +3452,13 @@ async def test_list_certificate_authorities_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificate_authorities_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3602,7 +3471,7 @@ async def test_list_certificate_authorities_flattened_error_async(): def test_list_certificate_authorities_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3650,7 +3519,7 @@ def test_list_certificate_authorities_pager(): def test_list_certificate_authorities_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3690,7 +3559,7 @@ def test_list_certificate_authorities_pages(): @pytest.mark.asyncio async def test_list_certificate_authorities_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3737,7 +3606,7 @@ async def test_list_certificate_authorities_async_pager(): @pytest.mark.asyncio async def test_list_certificate_authorities_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3784,7 +3653,7 @@ def test_restore_certificate_authority( transport: str = "grpc", request_type=service.RestoreCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3797,13 +3666,11 @@ def test_restore_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.restore_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -3818,7 +3685,7 @@ def test_restore_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3828,7 +3695,6 @@ def test_restore_certificate_authority_empty_call(): client.restore_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCertificateAuthorityRequest() @@ -3838,7 +3704,7 @@ async def test_restore_certificate_authority_async( request_type=service.RestoreCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3853,13 +3719,11 @@ async def test_restore_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.restore_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -3873,12 +3737,13 @@ async def test_restore_certificate_authority_async_from_dict(): def test_restore_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RestoreCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3886,7 +3751,6 @@ def test_restore_certificate_authority_field_headers(): type(client.transport.restore_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.restore_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3902,12 +3766,13 @@ def test_restore_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_restore_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.RestoreCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3917,7 +3782,6 @@ async def test_restore_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.restore_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -3932,7 +3796,7 @@ async def test_restore_certificate_authority_field_headers_async(): def test_restore_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3941,7 +3805,6 @@ def test_restore_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.restore_certificate_authority(name="name_value",) @@ -3950,13 +3813,12 @@ def test_restore_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_restore_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3970,7 +3832,7 @@ def test_restore_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_restore_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3991,14 +3853,13 @@ async def test_restore_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_restore_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4014,7 +3875,7 @@ def test_schedule_delete_certificate_authority( request_type=service.ScheduleDeleteCertificateAuthorityRequest, ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4027,13 +3888,11 @@ def test_schedule_delete_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.schedule_delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4048,7 +3907,7 @@ def test_schedule_delete_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4058,7 +3917,6 @@ def test_schedule_delete_certificate_authority_empty_call(): client.schedule_delete_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest() @@ -4068,7 +3926,7 @@ async def test_schedule_delete_certificate_authority_async( request_type=service.ScheduleDeleteCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4083,13 +3941,11 @@ async def test_schedule_delete_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.schedule_delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4103,12 +3959,13 @@ async def test_schedule_delete_certificate_authority_async_from_dict(): def test_schedule_delete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ScheduleDeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4116,7 +3973,6 @@ def test_schedule_delete_certificate_authority_field_headers(): type(client.transport.schedule_delete_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.schedule_delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4132,12 +3988,13 @@ def test_schedule_delete_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_schedule_delete_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ScheduleDeleteCertificateAuthorityRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4147,7 +4004,6 @@ async def test_schedule_delete_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.schedule_delete_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4162,7 +4018,7 @@ async def test_schedule_delete_certificate_authority_field_headers_async(): def test_schedule_delete_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4171,7 +4027,6 @@ def test_schedule_delete_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.schedule_delete_certificate_authority(name="name_value",) @@ -4180,13 +4035,12 @@ def test_schedule_delete_certificate_authority_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_schedule_delete_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4200,7 +4054,7 @@ def test_schedule_delete_certificate_authority_flattened_error(): @pytest.mark.asyncio async def test_schedule_delete_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4223,14 +4077,13 @@ async def test_schedule_delete_certificate_authority_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_schedule_delete_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4245,7 +4098,7 @@ def test_update_certificate_authority( transport: str = "grpc", request_type=service.UpdateCertificateAuthorityRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4258,13 +4111,11 @@ def test_update_certificate_authority( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4279,7 +4130,7 @@ def test_update_certificate_authority_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4289,7 +4140,6 @@ def test_update_certificate_authority_empty_call(): client.update_certificate_authority() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() @@ -4299,7 +4149,7 @@ async def test_update_certificate_authority_async( request_type=service.UpdateCertificateAuthorityRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4314,13 +4164,11 @@ async def test_update_certificate_authority_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() # Establish that the response is the type that we expect. @@ -4334,12 +4182,13 @@ async def test_update_certificate_authority_async_from_dict(): def test_update_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateAuthorityRequest() + request.certificate_authority.name = "certificate_authority.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4347,7 +4196,6 @@ def test_update_certificate_authority_field_headers(): type(client.transport.update_certificate_authority), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4366,12 +4214,13 @@ def test_update_certificate_authority_field_headers(): @pytest.mark.asyncio async def test_update_certificate_authority_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateAuthorityRequest() + request.certificate_authority.name = "certificate_authority.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4381,7 +4230,6 @@ async def test_update_certificate_authority_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_certificate_authority(request) # Establish that the underlying gRPC stub method was called. @@ -4399,7 +4247,7 @@ async def test_update_certificate_authority_field_headers_async(): def test_update_certificate_authority_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4408,29 +4256,26 @@ def test_update_certificate_authority_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate_authority( certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_authority_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4439,14 +4284,14 @@ def test_update_certificate_authority_flattened_error(): client.update_certificate_authority( service.UpdateCertificateAuthorityRequest(), certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_authority_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4463,25 +4308,23 @@ async def test_update_certificate_authority_flattened_async(): # using the keyword arguments to the method. response = await client.update_certificate_authority( certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].certificate_authority == resources.CertificateAuthority( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_authority_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4490,7 +4333,7 @@ async def test_update_certificate_authority_flattened_error_async(): await client.update_certificate_authority( service.UpdateCertificateAuthorityRequest(), certificate_authority=resources.CertificateAuthority(name="name_value"), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -4498,7 +4341,7 @@ def test_get_certificate_revocation_list( transport: str = "grpc", request_type=service.GetCertificateRevocationListRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4517,27 +4360,19 @@ def test_get_certificate_revocation_list( access_url="access_url_value", state=resources.CertificateRevocationList.State.ACTIVE, ) - response = client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CertificateRevocationList) - assert response.name == "name_value" - assert response.sequence_number == 1601 - assert response.pem_crl == "pem_crl_value" - assert response.access_url == "access_url_value" - assert response.state == resources.CertificateRevocationList.State.ACTIVE @@ -4549,7 +4384,7 @@ def test_get_certificate_revocation_list_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4559,7 +4394,6 @@ def test_get_certificate_revocation_list_empty_call(): client.get_certificate_revocation_list() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() @@ -4569,7 +4403,7 @@ async def test_get_certificate_revocation_list_async( request_type=service.GetCertificateRevocationListRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4590,26 +4424,19 @@ async def test_get_certificate_revocation_list_async( state=resources.CertificateRevocationList.State.ACTIVE, ) ) - response = await client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.CertificateRevocationList) - assert response.name == "name_value" - assert response.sequence_number == 1601 - assert response.pem_crl == "pem_crl_value" - assert response.access_url == "access_url_value" - assert response.state == resources.CertificateRevocationList.State.ACTIVE @@ -4620,12 +4447,13 @@ async def test_get_certificate_revocation_list_async_from_dict(): def test_get_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRevocationListRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4633,7 +4461,6 @@ def test_get_certificate_revocation_list_field_headers(): type(client.transport.get_certificate_revocation_list), "__call__" ) as call: call.return_value = resources.CertificateRevocationList() - client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -4649,12 +4476,13 @@ def test_get_certificate_revocation_list_field_headers(): @pytest.mark.asyncio async def test_get_certificate_revocation_list_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetCertificateRevocationListRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4664,7 +4492,6 @@ async def test_get_certificate_revocation_list_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.CertificateRevocationList() ) - await client.get_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -4679,7 +4506,7 @@ async def test_get_certificate_revocation_list_field_headers_async(): def test_get_certificate_revocation_list_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4688,7 +4515,6 @@ def test_get_certificate_revocation_list_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.CertificateRevocationList() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_certificate_revocation_list(name="name_value",) @@ -4697,13 +4523,12 @@ def test_get_certificate_revocation_list_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_certificate_revocation_list_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4717,7 +4542,7 @@ def test_get_certificate_revocation_list_flattened_error(): @pytest.mark.asyncio async def test_get_certificate_revocation_list_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4738,14 +4563,13 @@ async def test_get_certificate_revocation_list_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_certificate_revocation_list_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4760,7 +4584,7 @@ def test_list_certificate_revocation_lists( transport: str = "grpc", request_type=service.ListCertificateRevocationListsRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4775,21 +4599,16 @@ def test_list_certificate_revocation_lists( call.return_value = service.ListCertificateRevocationListsResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCertificateRevocationListsPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -4801,7 +4620,7 @@ def test_list_certificate_revocation_lists_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4811,7 +4630,6 @@ def test_list_certificate_revocation_lists_empty_call(): client.list_certificate_revocation_lists() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() @@ -4821,7 +4639,7 @@ async def test_list_certificate_revocation_lists_async( request_type=service.ListCertificateRevocationListsRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4839,20 +4657,16 @@ async def test_list_certificate_revocation_lists_async( unreachable=["unreachable_value"], ) ) - response = await client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListCertificateRevocationListsAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -4863,12 +4677,13 @@ async def test_list_certificate_revocation_lists_async_from_dict(): def test_list_certificate_revocation_lists_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateRevocationListsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4876,7 +4691,6 @@ def test_list_certificate_revocation_lists_field_headers(): type(client.transport.list_certificate_revocation_lists), "__call__" ) as call: call.return_value = service.ListCertificateRevocationListsResponse() - client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. @@ -4892,12 +4706,13 @@ def test_list_certificate_revocation_lists_field_headers(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListCertificateRevocationListsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4907,7 +4722,6 @@ async def test_list_certificate_revocation_lists_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListCertificateRevocationListsResponse() ) - await client.list_certificate_revocation_lists(request) # Establish that the underlying gRPC stub method was called. @@ -4922,7 +4736,7 @@ async def test_list_certificate_revocation_lists_field_headers_async(): def test_list_certificate_revocation_lists_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4931,7 +4745,6 @@ def test_list_certificate_revocation_lists_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListCertificateRevocationListsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_certificate_revocation_lists(parent="parent_value",) @@ -4940,13 +4753,12 @@ def test_list_certificate_revocation_lists_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_certificate_revocation_lists_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4960,7 +4772,7 @@ def test_list_certificate_revocation_lists_flattened_error(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4983,14 +4795,13 @@ async def test_list_certificate_revocation_lists_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_certificate_revocation_lists_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5003,7 +4814,7 @@ async def test_list_certificate_revocation_lists_flattened_error_async(): def test_list_certificate_revocation_lists_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5051,7 +4862,7 @@ def test_list_certificate_revocation_lists_pager(): def test_list_certificate_revocation_lists_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5091,7 +4902,7 @@ def test_list_certificate_revocation_lists_pages(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5140,7 +4951,7 @@ async def test_list_certificate_revocation_lists_async_pager(): @pytest.mark.asyncio async def test_list_certificate_revocation_lists_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5187,7 +4998,7 @@ def test_update_certificate_revocation_list( transport: str = "grpc", request_type=service.UpdateCertificateRevocationListRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5200,13 +5011,11 @@ def test_update_certificate_revocation_list( ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() # Establish that the response is the type that we expect. @@ -5221,7 +5030,7 @@ def test_update_certificate_revocation_list_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5231,7 +5040,6 @@ def test_update_certificate_revocation_list_empty_call(): client.update_certificate_revocation_list() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() @@ -5241,7 +5049,7 @@ async def test_update_certificate_revocation_list_async( request_type=service.UpdateCertificateRevocationListRequest, ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5256,13 +5064,11 @@ async def test_update_certificate_revocation_list_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) - response = await client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() # Establish that the response is the type that we expect. @@ -5276,12 +5082,13 @@ async def test_update_certificate_revocation_list_async_from_dict(): def test_update_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRevocationListRequest() + request.certificate_revocation_list.name = "certificate_revocation_list.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5289,7 +5096,6 @@ def test_update_certificate_revocation_list_field_headers(): type(client.transport.update_certificate_revocation_list), "__call__" ) as call: call.return_value = operations_pb2.Operation(name="operations/op") - client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -5308,12 +5114,13 @@ def test_update_certificate_revocation_list_field_headers(): @pytest.mark.asyncio async def test_update_certificate_revocation_list_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.UpdateCertificateRevocationListRequest() + request.certificate_revocation_list.name = "certificate_revocation_list.name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5323,7 +5130,6 @@ async def test_update_certificate_revocation_list_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) - await client.update_certificate_revocation_list(request) # Establish that the underlying gRPC stub method was called. @@ -5341,7 +5147,7 @@ async def test_update_certificate_revocation_list_field_headers_async(): def test_update_certificate_revocation_list_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5350,33 +5156,30 @@ def test_update_certificate_revocation_list_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_certificate_revocation_list( certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[ 0 ].certificate_revocation_list == resources.CertificateRevocationList( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) def test_update_certificate_revocation_list_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5387,14 +5190,14 @@ def test_update_certificate_revocation_list_flattened_error(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio async def test_update_certificate_revocation_list_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5413,27 +5216,25 @@ async def test_update_certificate_revocation_list_flattened_async(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[ 0 ].certificate_revocation_list == resources.CertificateRevocationList( name="name_value" ) - - assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"]) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio async def test_update_certificate_revocation_list_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5444,7 +5245,7 @@ async def test_update_certificate_revocation_list_flattened_error_async(): certificate_revocation_list=resources.CertificateRevocationList( name="name_value" ), - update_mask=field_mask.FieldMask(paths=["paths_value"]), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -5452,7 +5253,7 @@ def test_get_reusable_config( transport: str = "grpc", request_type=service.GetReusableConfigRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5467,21 +5268,16 @@ def test_get_reusable_config( call.return_value = resources.ReusableConfig( name="name_value", description="description_value", ) - response = client.get_reusable_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.GetReusableConfigRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ReusableConfig) - assert response.name == "name_value" - assert response.description == "description_value" @@ -5493,7 +5289,7 @@ def test_get_reusable_config_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5503,7 +5299,6 @@ def test_get_reusable_config_empty_call(): client.get_reusable_config() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetReusableConfigRequest() @@ -5512,7 +5307,7 @@ async def test_get_reusable_config_async( transport: str = "grpc_asyncio", request_type=service.GetReusableConfigRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5529,20 +5324,16 @@ async def test_get_reusable_config_async( name="name_value", description="description_value", ) ) - response = await client.get_reusable_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.GetReusableConfigRequest() # Establish that the response is the type that we expect. assert isinstance(response, resources.ReusableConfig) - assert response.name == "name_value" - assert response.description == "description_value" @@ -5553,12 +5344,13 @@ async def test_get_reusable_config_async_from_dict(): def test_get_reusable_config_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetReusableConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5566,7 +5358,6 @@ def test_get_reusable_config_field_headers(): type(client.transport.get_reusable_config), "__call__" ) as call: call.return_value = resources.ReusableConfig() - client.get_reusable_config(request) # Establish that the underlying gRPC stub method was called. @@ -5582,12 +5373,13 @@ def test_get_reusable_config_field_headers(): @pytest.mark.asyncio async def test_get_reusable_config_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.GetReusableConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5597,7 +5389,6 @@ async def test_get_reusable_config_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.ReusableConfig() ) - await client.get_reusable_config(request) # Establish that the underlying gRPC stub method was called. @@ -5612,7 +5403,7 @@ async def test_get_reusable_config_field_headers_async(): def test_get_reusable_config_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5621,7 +5412,6 @@ def test_get_reusable_config_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.ReusableConfig() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_reusable_config(name="name_value",) @@ -5630,13 +5420,12 @@ def test_get_reusable_config_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" def test_get_reusable_config_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5650,7 +5439,7 @@ def test_get_reusable_config_flattened_error(): @pytest.mark.asyncio async def test_get_reusable_config_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5671,14 +5460,13 @@ async def test_get_reusable_config_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_reusable_config_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5693,7 +5481,7 @@ def test_list_reusable_configs( transport: str = "grpc", request_type=service.ListReusableConfigsRequest ): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5708,21 +5496,16 @@ def test_list_reusable_configs( call.return_value = service.ListReusableConfigsResponse( next_page_token="next_page_token_value", unreachable=["unreachable_value"], ) - response = client.list_reusable_configs(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == service.ListReusableConfigsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListReusableConfigsPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -5734,7 +5517,7 @@ def test_list_reusable_configs_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 = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5744,7 +5527,6 @@ def test_list_reusable_configs_empty_call(): client.list_reusable_configs() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListReusableConfigsRequest() @@ -5753,7 +5535,7 @@ async def test_list_reusable_configs_async( transport: str = "grpc_asyncio", request_type=service.ListReusableConfigsRequest ): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5771,20 +5553,16 @@ async def test_list_reusable_configs_async( unreachable=["unreachable_value"], ) ) - response = await client.list_reusable_configs(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == service.ListReusableConfigsRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListReusableConfigsAsyncPager) - assert response.next_page_token == "next_page_token_value" - assert response.unreachable == ["unreachable_value"] @@ -5795,12 +5573,13 @@ async def test_list_reusable_configs_async_from_dict(): def test_list_reusable_configs_field_headers(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListReusableConfigsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5808,7 +5587,6 @@ def test_list_reusable_configs_field_headers(): type(client.transport.list_reusable_configs), "__call__" ) as call: call.return_value = service.ListReusableConfigsResponse() - client.list_reusable_configs(request) # Establish that the underlying gRPC stub method was called. @@ -5824,12 +5602,13 @@ def test_list_reusable_configs_field_headers(): @pytest.mark.asyncio async def test_list_reusable_configs_field_headers_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = service.ListReusableConfigsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5839,7 +5618,6 @@ async def test_list_reusable_configs_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( service.ListReusableConfigsResponse() ) - await client.list_reusable_configs(request) # Establish that the underlying gRPC stub method was called. @@ -5854,7 +5632,7 @@ async def test_list_reusable_configs_field_headers_async(): def test_list_reusable_configs_flattened(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5863,7 +5641,6 @@ def test_list_reusable_configs_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = service.ListReusableConfigsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_reusable_configs(parent="parent_value",) @@ -5872,13 +5649,12 @@ def test_list_reusable_configs_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_reusable_configs_flattened_error(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5892,7 +5668,7 @@ def test_list_reusable_configs_flattened_error(): @pytest.mark.asyncio async def test_list_reusable_configs_flattened_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5913,14 +5689,13 @@ async def test_list_reusable_configs_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_reusable_configs_flattened_error_async(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5933,7 +5708,7 @@ async def test_list_reusable_configs_flattened_error_async(): def test_list_reusable_configs_pager(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5980,7 +5755,7 @@ def test_list_reusable_configs_pager(): def test_list_reusable_configs_pages(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6019,7 +5794,7 @@ def test_list_reusable_configs_pages(): @pytest.mark.asyncio async def test_list_reusable_configs_async_pager(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6065,7 +5840,7 @@ async def test_list_reusable_configs_async_pager(): @pytest.mark.asyncio async def test_list_reusable_configs_async_pages(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6108,16 +5883,16 @@ async def test_list_reusable_configs_async_pages(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( @@ -6127,7 +5902,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CertificateAuthorityServiceClient( @@ -6138,7 +5913,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CertificateAuthorityServiceClient(transport=transport) assert client.transport is transport @@ -6147,13 +5922,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6168,8 +5943,8 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6177,7 +5952,7 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, transports.CertificateAuthorityServiceGrpcTransport, @@ -6186,9 +5961,9 @@ def test_transport_grpc_default(): def test_certificate_authority_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CertificateAuthorityServiceTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6200,7 +5975,7 @@ def test_certificate_authority_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CertificateAuthorityServiceTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6237,15 +6012,37 @@ def test_certificate_authority_service_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_certificate_authority_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + google.auth, "load_credentials_from_file", autospec=True ) as load_creds, mock.patch( "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (credentials.AnonymousCredentials(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CertificateAuthorityServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id="octopus", + ) + + +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_base_transport_with_credentials_file_old_google_auth(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CertificateAuthorityServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -6258,19 +6055,33 @@ def test_certificate_authority_service_base_transport_with_credentials_file(): def test_certificate_authority_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CertificateAuthorityServiceTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_certificate_authority_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + CertificateAuthorityServiceClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id=None, + ) + + +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_auth_adc_old_google_auth(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CertificateAuthorityServiceClient() adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), @@ -6278,20 +6089,169 @@ def test_certificate_authority_service_auth_adc(): ) -def test_certificate_authority_service_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +def test_certificate_authority_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.CertificateAuthorityServiceGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id="octopus", ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +@requires_google_auth_lt_1_25_0 +def test_certificate_authority_service_transport_auth_adc_old_google_auth( + transport_class, +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus") adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), quota_project_id="octopus", ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_gte_1_26_0 +def test_certificate_authority_service_transport_create_channel( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=["1", "2"], + default_host="privateca.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_lt_1_26_0 +def test_certificate_authority_service_transport_create_channel_old_api_core( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class(quota_project_id="octopus") + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + ( + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + grpc_helpers_async, + ), + ], +) +@requires_api_core_lt_1_26_0 +def test_certificate_authority_service_transport_create_channel_user_scopes( + transport_class, grpc_helpers +): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=["1", "2"], + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "transport_class", [ @@ -6302,7 +6262,7 @@ def test_certificate_authority_service_transport_auth_adc(): def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6341,7 +6301,7 @@ def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtl def test_certificate_authority_service_host_no_port(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="privateca.googleapis.com" ), @@ -6351,7 +6311,7 @@ def test_certificate_authority_service_host_no_port(): def test_certificate_authority_service_host_with_port(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="privateca.googleapis.com:8000" ), @@ -6407,9 +6367,9 @@ def test_certificate_authority_service_transport_channel_mtls_with_client_cert_s mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -6485,7 +6445,7 @@ def test_certificate_authority_service_transport_channel_mtls_with_adc(transport def test_certificate_authority_service_grpc_lro_client(): client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6498,7 +6458,7 @@ def test_certificate_authority_service_grpc_lro_client(): def test_certificate_authority_service_grpc_lro_async_client(): client = CertificateAuthorityServiceAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6514,7 +6474,6 @@ def test_certificate_path(): location = "clam" certificate_authority = "whelk" certificate = "octopus" - expected = "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format( project=project, location=location, @@ -6545,7 +6504,6 @@ def test_certificate_authority_path(): project = "winkle" location = "nautilus" certificate_authority = "scallop" - expected = "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}".format( project=project, location=location, certificate_authority=certificate_authority, ) @@ -6573,7 +6531,6 @@ def test_certificate_revocation_list_path(): location = "octopus" certificate_authority = "oyster" certificate_revocation_list = "nudibranch" - expected = "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificateRevocationLists/{certificate_revocation_list}".format( project=project, location=location, @@ -6608,7 +6565,6 @@ def test_reusable_config_path(): project = "scallop" location = "abalone" reusable_config = "squid" - expected = "projects/{project}/locations/{location}/reusableConfigs/{reusable_config}".format( project=project, location=location, reusable_config=reusable_config, ) @@ -6633,7 +6589,6 @@ def test_parse_reusable_config_path(): def test_common_billing_account_path(): billing_account = "oyster" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -6656,7 +6611,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) actual = CertificateAuthorityServiceClient.common_folder_path(folder) assert expected == actual @@ -6675,7 +6629,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) actual = CertificateAuthorityServiceClient.common_organization_path(organization) assert expected == actual @@ -6694,7 +6647,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) actual = CertificateAuthorityServiceClient.common_project_path(project) assert expected == actual @@ -6714,7 +6666,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "squid" location = "clam" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -6741,7 +6692,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.CertificateAuthorityServiceTransport, "_prep_wrapped_messages" ) as prep: client = CertificateAuthorityServiceClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6750,6 +6701,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = CertificateAuthorityServiceClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info)